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

ros2 parameter listener/callback

asked 2020-09-16 08:40:25 -0500

protoGuy gravatar image

Greetings fellow developers, I have recently started to work with ros2 eloquent and came across few issues I need some help for.

This question however may not be ros2 specific but rather a general ros question. I have created a publisher node in cpp where I set several parameter using a .yaml file. Is there any type of built in ros method to trigger an event when a parameter is changed ? I do not want to change the .yaml file itself but rather change the parameter while the node is running i.e. using ros2 param set.

Suppose one parameter is "log=true" by default and whenever this is changed (for example to "log=false") I want to call a print function to display "changed: log = 10". Obviously I could do that in cpp implementing a listener function myself. However I am wondering if ros2 has some built in tools to do that.

I would really appreaciate your help since I did not find something like that reading the documentation.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-09-16 23:50:54 -0500

aarushg gravatar image

Yes there is, it's called on_parameter_event. Example can be found in ros2 demos - https://github.com/ros2/demos/blob/ma....

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-09-16 08:40:25 -0500

Seen: 1,205 times

Last updated: Sep 16 '20