Conversation
…ter_events subscription Every node's TimeSource subscribed to /parameter_events only to see its own use_sim_time change (upstream TODO ros2#609). With N nodes every declare_parameter of every node is delivered to, and dropped by, all N nodes. On an AMR (234 nodes) this is ~10k events x ~210 subscribers during startup. use_sim_time is now applied in a local post-set-parameters callback. Measured on amr47: /parameter_events subscribers 210 -> 24, container start to nav2 active ~71 s -> ~61 s. The /clock subscription is created without QoS override parameters when use_sim_time is switched on at runtime, because parameters cannot be declared from within a parameter callback. The value given at startup is handled as before. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011FfCzN8XKNXLTuCXBWJcK5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Every node's
TimeSourcesubscribes to/parameter_eventsonly to notice a change of its ownuse_sim_time(upstream TODO ros2#609). With N nodes, eachdeclare_parameterof each node is delivered to all N nodes and dropped by N-1 of them. On an AMR (234 nodes) that is about 10k events to about 210 subscribers during startup.Change
use_sim_timeis applied in a local post-set-parameters callback. The subscription and theon_parameter_eventhandler are removed.Measured on amr47 (stack restart, container start until nav2 "Managed nodes are active")
/parameter_eventssubscribersAll 234 nodes came up, with the same died/traceback counts in the launch log as before.
Behaviour notes
use_sim_timeis switched on at runtime, the/clocksubscription is created without the QoS override parameters, because parameters cannot be declared from within a parameter callback. (This is the reason upstream went through the topic.) Tested on an isolated domain withstatic_transform_publisher:ros2 param set ... use_sim_time true/false/true/false/trueall succeed and the/clocksubscription appears and disappears.use_sim_timeis no longer tracked (parameter_state_ = UNSET); the parameter is declared by the TimeSource itself.node_base_lock_while the parameter mutex is held;attachNodetakes them the other way round, but registers the callback as its last step.foxglove_bridge,SmacPlannerHybrid(global costmap resolution), the rosbag recorder.Not run: the rclcpp unit tests (
test_time_source). Built withBUILD_TESTING=OFFon the robot and on the dev machine. The version tested on the robot still contained the unusedon_parameter_event; its removal was compile-checked only.🤖 Generated with Claude Code
https://claude.ai/code/session_011FfCzN8XKNXLTuCXBWJcK5