[Discourse.ros.org] [Next Generation ROS] Initializing ROS 2 parameters

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[Discourse.ros.org] [Next Generation ROS] Initializing ROS 2 parameters

Mn Nikpour via ros-users


Sorry for asking this seemingly noob question, but I wasn't able to find the answer anywhere: How can you set a parameter to an initial value when launching a node?

I understand that ROS 2 will use a python based launch system, which isn't yet available (is that still so?).  On the github page for the new launch system there were some few examples, but they didn't seem to set any parameters.

I would have assumed that parameters can be set through command line arguments, like it was possible in ROS 1. Certainly the ROS 1 syntax doesn't work anymore. I wasn't able to locate any code that parses parameters in the RCL github repository. Is this functionality not yet implemented? Is it recommended to just use ordinary command line arguments instead (through getop etc.)?

Thanks





---
[Visit Topic](https://discourse.ros.org/t/initializing-ros-2-parameters/3542/1) or reply to this email to respond.


If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list
[hidden email]
http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <http://lists.ros.org/mailman//options/ros-users>
Reply | Threaded
Open this post in threaded view
|

[Discourse.ros.org] [Next Generation ROS] Initializing ROS 2 parameters

Mn Nikpour via ros-users


I don't believe that there is anything like that in place at the moment.

I have just been manually parsing the command line arguments and then setting the parameters from them. This is how I am doing it:
https://github.com/matt-attack/marti_common/blob/ros2_devel/swri_roscpp/include/swri_roscpp/node.h#L84





---
[Visit Topic](https://discourse.ros.org/t/initializing-ros-2-parameters/3542/2) or reply to this email to respond.


If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list
[hidden email]
http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <http://lists.ros.org/mailman//options/ros-users>
Reply | Threaded
Open this post in threaded view
|

[Discourse.ros.org] [Next Generation ROS] Initializing ROS 2 parameters

Mn Nikpour via ros-users
In reply to this post by Mn Nikpour via ros-users


Thanks, I guess I'll do something like that too.





---
[Visit Topic](https://discourse.ros.org/t/initializing-ros-2-parameters/3542/3) or reply to this email to respond.


If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list
[hidden email]
http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <http://lists.ros.org/mailman//options/ros-users>
Reply | Threaded
Open this post in threaded view
|

[Discourse.ros.org] [Next Generation ROS] Initializing ROS 2 parameters

Mn Nikpour via ros-users
In reply to this post by Mn Nikpour via ros-users


> How can you set a parameter to an initial value when launching a node?

Indeed, we do not have that yet. But that's on our short list of things to do, since something like roslaunch isn't that useful if you cannot remap things and set parameters from the start of a node.

We first want to tie up some loose ends with parameters (https://github.com/ros2/ros2/issues/432) and then we'll do setting parameters from at least the command line (when you have your own executable).

Even with that we still need to find a way to support initializing the parameters with the "nodelet" style of loading a node, where you run a process and then dynamically load your node into that process with a service call. As well as other patterns, like when you have multiple nodes in a single executable.

[quote="nerian, post:1, topic:3542"]
I understand that ROS 2 will use a python based launch system, which isnt yet available (is that still so?).
[/quote]

That's correct, we have something that can run and manage processes (called [`launch`](https://github.com/ros2/launch)), but not the equivalent of "roslaunch" which can actually run nodes and take remappings for topics or set parameters or place whole nodes and other launch files into a namespace.

[quote="nerian, post:1, topic:3542"]
I would have assumed that parameters can be set through command line arguments, like it was possible in ROS 1. Certainly the ROS 1 syntax doesnt work anymore. I wasnt able to locate any code that parses parameters in the RCL github repository. Is this functionality not yet implemented? Is it recommended to just use ordinary command line arguments instead (through getop etc.)?
[/quote]


We will support that, but likely not exactly like the ROS 1 syntax (since we can have more than one node per executable now). We don't have anything implemented yet, but as I said, it's on the todo list. For now the best workaround is as you suggested, parsing your own arguments and setting the parameters to that.





---
[Visit Topic](https://discourse.ros.org/t/initializing-ros-2-parameters/3542/4) or reply to this email to respond.


If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list
[hidden email]
http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <http://lists.ros.org/mailman//options/ros-users>
Reply | Threaded
Open this post in threaded view
|

[Discourse.ros.org] [Next Generation ROS] Initializing ROS 2 parameters

Mn Nikpour via ros-users
In reply to this post by Mn Nikpour via ros-users


[quote="wjwwood, post:4, topic:3542"]
Even with that we still need to find a way to support initializing the parameters with the nodelet style of loading a node, where you run a process and then dynamically load your node into that process with a service call.
[/quote]


Although it's not necessarily the best way, one way we have used successfully to do this is to pass a string containing the parameters formatted like the arguments to a URL ("blurgle.com?arg1=val1&arg2=val2" etc.). The advantage of this approach is that it's easy to adapt to different styles of service call. The disadvantage is translating all parameters to text, which must be reparsed, and it being unwieldy for complex data structures.





---
[Visit Topic](https://discourse.ros.org/t/initializing-ros-2-parameters/3542/5) or reply to this email to respond.


If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list
[hidden email]
http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <http://lists.ros.org/mailman//options/ros-users>
Reply | Threaded
Open this post in threaded view
|

[Discourse.ros.org] [Next Generation ROS] Initializing ROS 2 parameters

Mn Nikpour via ros-users
In reply to this post by Mn Nikpour via ros-users


> ...not the equivalent of roslaunch which can actually run nodes and take remappings for topics or set parameters...

I don't think that remapping nodes or handling parameters on the command line should fall to the responsibility of a wrapper in ROS2. Let's just make the underlying libraries handle those command line parameters. E.g. we already pass process args into `rclcpp::init` -- just use those args for remapping.





---
[Visit Topic](https://discourse.ros.org/t/initializing-ros-2-parameters/3542/6) or reply to this email to respond.


If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list
[hidden email]
http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <http://lists.ros.org/mailman//options/ros-users>