ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Ahoy, Matey!

It appears that we be a missing something in your code example, because the error what(): Node has already been added to an executor. should only occur if you add your node to an rclcpp::Executor and/or pass it to rclcpp::spin more than once. From the code you've shared I only be able to spot it being used like this in one place, i.e. when you do rclcpp::spin(std::make_shared<TestParameter>());.

I do have some other comment for yer, however:

  • Store ye node, do this instead auto n = std::make_shared<TestParameter>(); rclcpp::spin(n);
  • Ye don't need a rclcpp::SyncParametersClient to change parameters on yer own node, just use rclcpp::Node::set_parameters (or a similar method), see: http://docs.ros2.org/bouncy/api/rclcpp/classrclcpp_1_1_node.html#a7d8af4dc449c7130ccc396814b86c14d

(btw, it's talk like a pirate day: https://discourse.ros.org/t/answer-ros-questions-like-a-pirate-day-2k18/6058)