diff --git a/README.md b/README.md new file mode 100644 index 0000000..56202d7 --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +This contains two packages: + - `simple_timer` contains timing related functions, and a wrapper for calling some kernel scheduling functions + - `priority_executor` contains the modified executor and some nodes to test it + +In `priority_executor`: + - `priority_executor.cpp` subclasses `rclcpp::Executor` to allow for additional customization + - `priority_memory_strategy.hpp` is a modified version of `rclcpp`s `allocator_memory_strategy.hpp` that selects callbacks based on either the earliest deadline, or a relative priority. Executor polls this for ready callbacks. + - `test_nodes.cpp` adds timer-based publishing nodes and dummy worker nodes that can be arranged in chains. It uses `dummy_workload.hpp` to generate a workload. + - `f1tenth_test.cpp` sets up a chain of nodes similar to [https://intra.ece.ucr.edu/~hyoseung/pdf/rtas21_picas.pdf](https://intra.ece.ucr.edu/~hyoseung/pdf/rtas21_picas.pdf) + diff --git a/src/priority_executor/src/f1tenth_test.cpp b/src/priority_executor/src/f1tenth_test.cpp index 9d32d43..d0a7f3b 100644 --- a/src/priority_executor/src/f1tenth_test.cpp +++ b/src/priority_executor/src/f1tenth_test.cpp @@ -266,7 +266,8 @@ int main(int argc, char **argv) rclcpp::shutdown(); std::ofstream output_file; - std::string suffix = "_rtis_alloc"; + // useful if testing different variations + std::string suffix = ""; if (schedule_type == DEADLINE) { output_file.open("experiments/results/f1tenth_full" + std::to_string(NUM_EXECUTORS) + "c" + suffix + ".txt"); diff --git a/src/priority_executor/src/primes_workload.cpp b/src/priority_executor/src/primes_workload.cpp index 272c5b1..387d1f5 100644 --- a/src/priority_executor/src/primes_workload.cpp +++ b/src/priority_executor/src/primes_workload.cpp @@ -1,4 +1,5 @@ #include "priority_executor/primes_workload.hpp" +#include ktimeunit nth_prime_silly(int n, double millis) { // struct tms this_thread_times; @@ -23,6 +24,10 @@ ktimeunit nth_prime_silly(int n, double millis) { sum += j; } + if (cum_time - start_cpu_time > millis) + { + std::cout << "Warning: Time limit exceeded" << std::endl; + } } return get_thread_time(&currTime) - start_cpu_time; }