-
Notifications
You must be signed in to change notification settings - Fork 487
Closed
Labels
bugSomething isn't workingSomething isn't working
Milestone
Description
Bug report
Required Info:
- Client library:
- rclcpp 45d74ba
Steps to reproduce issue
Add a print in the time source onparameter_event callback by applying this patch to rclcpp
diff --git a/rclcpp/src/rclcpp/time_source.cpp b/rclcpp/src/rclcpp/time_source.cpp
index bfd0ea2..0952d85 100644
--- a/rclcpp/src/rclcpp/time_source.cpp
+++ b/rclcpp/src/rclcpp/time_source.cpp
@@ -225,9 +225,11 @@ void TimeSource::on_parameter_event(const rcl_interfaces::msg::ParameterEvent::S
}
if (it.second->value.bool_value) {
parameter_state_ = SET_TRUE;
+ RCUTILS_LOG_ERROR("enabling ros time!")
enable_ros_time();
} else {
parameter_state_ = SET_FALSE;
+ RCUTILS_LOG_ERROR("disabling ros time!")
disable_ros_time();
}
}Shell 1: run a C++ listener:
ros2 run demo_nodes_cpp listener
Shell 2: run another C++ node:
ros2 run demo_nodes_cpp add_two_ints_server
Shell 3:
Set use_sim_time on the listener:
$ ros2 param set listener use_sim_time true
Set parameter successful
Expected behavior
Shell 1 should print:
[ERROR] []: enabling ros time!
Shell 2 should not print anything
Actual behavior
Both shells print
[ERROR] []: enabling ros time!
Additional information
This is due to the fact that:
/parameter_eventsis a global topic and its messages don't contain any node specific information. We could:- add information about the node in the message (see Add RclHeader message rcl_interfaces#27 for a proposal)
- make the
parameter_eventstopic namespaced on the nodes (discussed in Parameters refactor ros2#432)
- rclcpp is listening to
parameter_eventsand parsing its data to know what's hosted on the same node. It should instead leverage its own parameter server (created in all nodes by default) to get notified when a new value ofuse_sim_timehas been set
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working