[ros-users] [Discourse.ros.org] [Next Generation ROS] Composition and Parameters: Best Practice Suggestions

Rohan Agrawal ros.discourse at gmail.com
Wed Mar 29 01:48:13 UTC 2017




[quote="dayoung99, post:10, topic:1001"]
I haven't seen an example of doing ros params not involving the "manual_composition" yet.  All the tutorials for parameters still appear to use clients/services.
[/quote]
This is the only place I know that is using the node interface, but there might be others. https://github.com/ros2/turtlebot2_demo/blob/master/turtlebot2_drivers/src/kobuki_node.cpp 

As for `register_param_change_callback`, I can see how the comments could be confusing. To clarify, the function is supposed to act atomically in sense that any changes to state in your code are only expected to occur if all the parameters are valid. In other words if changing the parameters modifies internal variables, it is expected to change nothing if it fails. 

This restriction/expectation is there because otherwise the atomic parameter API could guarantee nothing. 

Another note, it is expect that you set the result manually in the callback, by doing `result.successful = true` after you verify that the parameters are valid for your node.

The parameter callback is actually called by `set_parameters_atomically`. By calling `set_parameters_atomically` inside your callback you are actually creating a cycle, creating the memory errors you are seeing (probably some kind of stackoverflow).

Hope that helps.






---
[Visit Topic](https://discourse.ros.org/t/composition-and-parameters-best-practice-suggestions/1001/11) or reply to this email to respond.




More information about the ros-users mailing list