Setting private rosparams through a launch file

asked 2018-08-19 17:39:43 -0500

AC3021 gravatar image

updated 2018-08-19 19:25:14 -0500

I have a node where I initialize a set of expected parameters to default values. I am treating the parameters like class member variables. I am now trying to set these parameters through a launch file to but it does not appear to be working. When I set the parameter through a launch file and run rosparam get /some_node_name/value I get the default value of 0

In node.py

class MyNode:
    def __init__(self):
        rospy.init_node('my_node')
        # Create all expected parameters
        rospy.set_param('~number', 0)

In the launch file

<node name='some_node_name' pkg='my_pkg' type='node.py' output='screen'>
    <param name='~number' value=10 />
</node>

Am I missing something? Or is this not possible? I was keeping the parameters "private" as I will be launching multiple nodes of the same type, all with different node names

edit retag flag offensive close merge delete

Comments

Have you tried not using ~ in your launch file for the private parameters?

jayess gravatar image jayess  ( 2018-08-19 19:19:27 -0500 )edit

Also, what does

not working

mean?

jayess gravatar image jayess  ( 2018-08-19 19:20:00 -0500 )edit