Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graph executables comparison #2

Draft
wants to merge 42 commits into
base: rolling
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
698be8b
Added priority events queue
nightduck Dec 19, 2023
4edc19d
Added rudimentary test
nightduck Dec 20, 2023
2bb8d4a
priority events unit test passing
nightduck Jan 12, 2024
cb4f36b
Added include for vector
nightduck Jan 29, 2024
6950ce2
Initial work on graph executable
nightduck Nov 29, 2023
8d8d7fb
Adjusted API to eliminate disruption
nightduck Dec 1, 2023
c68787c
Linting
nightduck Dec 1, 2023
0ab0958
Apply skeleton for graph executor
nightduck Jan 29, 2024
01525ec
Doesn't build but I want to go home
nightduck Jan 29, 2024
60d6006
Wrote out logic for build graph from subscriptions
nightduck Feb 3, 2024
c86901b
Fix build error
nightduck Feb 3, 2024
bf9e222
More work on graph building logic
nightduck Feb 3, 2024
ad076c9
Added graph building logic
nightduck Feb 6, 2024
9a8d5d3
First iteration of graph_executor unit test running
nightduck Feb 15, 2024
917bd57
Finished 2nd round of unit tests
nightduck Feb 16, 2024
44f45cc
All unit tests passing
nightduck Feb 16, 2024
b263cdb
Updated priority calculation
nightduck Feb 16, 2024
105635d
Rewrote default function to assign priorities
nightduck Feb 23, 2024
1426ef1
Linting
nightduck Feb 29, 2024
4ec22f2
Fixed infinite loop
nightduck Mar 1, 2024
c757f21
Ran experiments with nonpreemptive heuristic
nightduck Mar 25, 2024
93c00ae
Changed heuristic back to semipreemptible rate-monotonic
nightduck Mar 25, 2024
2dd2989
Refactored PriorityEventsQueue to use fixed priorities in map, debugg…
nightduck Mar 28, 2024
3633459
Fixed bug where children weren't linking to parents
nightduck Mar 29, 2024
fb8a915
Removed printfs
nightduck Mar 29, 2024
72aee6f
Reverted to burst-tolerant heuristic
nightduck Mar 29, 2024
c2524cd
Added enqueue_unsafe variant to events queue
nightduck May 7, 2024
2a3826f
Added decrement bfs priority heuristic
nightduck May 7, 2024
06807a3
Merge branch 'graph_executables' of github.com:nightduck/rclcpp into …
nightduck May 7, 2024
4ff4d64
Gave timer management thread rt priority
nightduck May 7, 2024
07c898e
Modifications for DE
nightduck May 8, 2024
e49f3f8
Bug fix in run_timers
nightduck May 8, 2024
3b41f95
Dumb workaround bc apparently directly linking to rcl is bad
nightduck May 14, 2024
35b1828
Modifications to enable EDF executor
nightduck May 15, 2024
d55f982
Hacky patch to correctly enqueue series of timers under RO in single …
nightduck May 15, 2024
d54745b
Fix for EDF
nightduck May 16, 2024
7611b12
RE bug fix
nightduck May 16, 2024
1b06e2e
Moved modified timers manager and events executor to their own files
nightduck May 21, 2024
97ffed2
Put in original version of events executor for comparison
nightduck May 21, 2024
0e863a7
Re-removed RO bug where dispatcher thread never sleeps
nightduck May 21, 2024
e80ddd5
Fixed type issue causing incorrect schedules in EDF
nightduck May 23, 2024
d01e105
Fixed compile warnings
nightduck Jun 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions rclcpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ set(${PROJECT_NAME}_SRCS
src/rclcpp/executors/static_single_threaded_executor.cpp
src/rclcpp/expand_topic_or_service_name.cpp
src/rclcpp/experimental/executors/events_executor/events_executor.cpp
src/rclcpp/experimental/executors/events_executor/events_executor_rt.cpp
src/rclcpp/experimental/executors/graph_executor.cpp
src/rclcpp/experimental/graph_executable.cpp
src/rclcpp/experimental/timers_manager.cpp
src/rclcpp/experimental/timers_manager_rt.cpp
src/rclcpp/future_return_code.cpp
src/rclcpp/generic_publisher.cpp
src/rclcpp/generic_subscription.cpp
Expand Down
49 changes: 49 additions & 0 deletions rclcpp/executor_kpi_summary_report_15s.md

Large diffs are not rendered by default.

25 changes: 20 additions & 5 deletions rclcpp/include/rclcpp/create_subscription.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ create_subscription(
),
typename MessageMemoryStrategyT::SharedPtr msg_mem_strat = (
MessageMemoryStrategyT::create_default()
)
),
std::initializer_list<rclcpp::PublisherBase::SharedPtr> publishers = {}
)
{
using rclcpp::node_interfaces::get_node_topics_interface;
Expand Down Expand Up @@ -133,6 +134,17 @@ create_subscription(
qos;

auto sub = node_topics_interface->create_subscription(topic_name, factory, actual_qos);

// Get any subscriptions downstream from the publisher and add their graph_node_t to this one
for (auto & publisher : publishers) {
auto topic_name = publisher->get_topic_name();
sub->add_output_topic(topic_name);
}

// Add input topic name and link to rcl_subscription_t pointer
sub->add_input_topic(sub->get_topic_name());
sub->add_key(sub->get_subscription_handle().get());

node_topics_interface->add_subscription(sub, options.callback_group);

return std::dynamic_pointer_cast<SubscriptionT>(sub);
Expand Down Expand Up @@ -183,12 +195,14 @@ create_subscription(
),
typename MessageMemoryStrategyT::SharedPtr msg_mem_strat = (
MessageMemoryStrategyT::create_default()
)
),
std::initializer_list<rclcpp::PublisherBase::SharedPtr> publishers = {}
)
{
return rclcpp::detail::create_subscription<
MessageT, CallbackT, AllocatorT, SubscriptionT, MessageMemoryStrategyT>(
node, node, topic_name, qos, std::forward<CallbackT>(callback), options, msg_mem_strat);
node, node, topic_name, qos, std::forward<CallbackT>(callback),
options, msg_mem_strat, publishers);
}

/// Create and return a subscription of the given MessageT type.
Expand All @@ -213,13 +227,14 @@ create_subscription(
),
typename MessageMemoryStrategyT::SharedPtr msg_mem_strat = (
MessageMemoryStrategyT::create_default()
)
),
std::initializer_list<rclcpp::PublisherBase::SharedPtr> publishers = {}
)
{
return rclcpp::detail::create_subscription<
MessageT, CallbackT, AllocatorT, SubscriptionT, MessageMemoryStrategyT>(
node_parameters, node_topics, topic_name, qos,
std::forward<CallbackT>(callback), options, msg_mem_strat);
std::forward<CallbackT>(callback), options, msg_mem_strat, publishers);
}

} // namespace rclcpp
Expand Down
19 changes: 18 additions & 1 deletion rclcpp/include/rclcpp/create_timer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ create_timer(
group,
rclcpp::node_interfaces::get_node_base_interface(node).get(),
rclcpp::node_interfaces::get_node_timers_interface(node).get(),
{},
autostart);
}

Expand Down Expand Up @@ -150,6 +151,7 @@ create_timer(
rclcpp::CallbackGroup::SharedPtr group,
node_interfaces::NodeBaseInterface * node_base,
node_interfaces::NodeTimersInterface * node_timers,
std::initializer_list<rclcpp::PublisherBase::SharedPtr> publishers = {},
bool autostart = true)
{
if (clock == nullptr) {
Expand All @@ -168,6 +170,13 @@ create_timer(
auto timer = rclcpp::GenericTimer<CallbackT>::make_shared(
std::move(clock), period_ns, std::move(callback), node_base->get_context(), autostart);
node_timers->add_timer(timer, group);

// Get any subscriptions downstream from the publisher and add their graph_node_t to this one
for (auto & publisher : publishers) {
auto topic_name = publisher->get_topic_name();
timer->add_output_topic(topic_name);
}

return timer;
}

Expand All @@ -194,6 +203,7 @@ create_wall_timer(
rclcpp::CallbackGroup::SharedPtr group,
node_interfaces::NodeBaseInterface * node_base,
node_interfaces::NodeTimersInterface * node_timers,
std::initializer_list<rclcpp::PublisherBase::SharedPtr> publishers = {},
bool autostart = true)
{
if (node_base == nullptr) {
Expand All @@ -206,9 +216,16 @@ create_wall_timer(

const std::chrono::nanoseconds period_ns = detail::safe_cast_to_period_in_ns(period);

// Add a new wall timer.
// Create a new wall timer.
auto timer = rclcpp::WallTimer<CallbackT>::make_shared(
period_ns, std::move(callback), node_base->get_context(), autostart);

// Get any subscriptions downstream from the publisher and add their graph_node_t to this one
for (auto & publisher : publishers) {
auto topic_name = publisher->get_topic_name();
timer->add_output_topic(topic_name);
}

node_timers->add_timer(timer, group);
return timer;
}
Expand Down
2 changes: 1 addition & 1 deletion rclcpp/include/rclcpp/executors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "rclcpp/executors/multi_threaded_executor.hpp"
#include "rclcpp/executors/single_threaded_executor.hpp"
#include "rclcpp/executors/static_single_threaded_executor.hpp"
#include "rclcpp/experimental/executors/events_executor/events_executor.hpp"
#include "rclcpp/experimental/executors/events_executor/events_executor_rt.hpp"
#include "rclcpp/node.hpp"
#include "rclcpp/utilities.hpp"
#include "rclcpp/visibility_control.hpp"
Expand Down
Loading