Ask Your Question

Rosparam in RqtGui

asked 2014-08-05 06:06:26 -0500

Edmodi gravatar image

Hi, is there a way in Ros to implement a funcition to get/set parameter of rosparam server similar to rosservice in python?


edit retag flag offensive close merge delete



Are you asking how to get/set parameters programmatically using python? Or are you asking how to get/set parameters using the rqt gui?

Airuno2L gravatar image Airuno2L  ( 2014-08-05 06:23:43 -0500 )edit

Programmatically using python because I need to create a rqt plugin

Edmodi gravatar image Edmodi  ( 2014-08-05 06:43:56 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2014-08-05 07:57:15 -0500

Airuno2L gravatar image

updated 2014-08-05 08:05:00 -0500

This link should have all the information you need.

There are many ways to get:

global_name = rospy.get_param("/global_name")
relative_name = rospy.get_param("relative_name")
private_param = rospy.get_param('~private_name')    
default_param = rospy.get_param('default_param', 'default_value')

# fetch a group (dictionary) of parameters
gains = rospy.get_param('gains')
p, i, d = gains['P'], gains['I'], gains['D']

And set:

rospy.set_param('a_string', 'baz')
rospy.set_param('~private_int', 2)
rospy.set_param('list_of_floats', [1., 2., 3., 4.])
rospy.set_param('bool_True', True)
rospy.set_param('gains', {'p': 1, 'i': 2, 'd': 3})

rospy.get_param('gains/P') #should return 1

You can do a lot of other things like delete params, check and see if a param exists, list all params, etc. All of it is covered in that link.

This might be of interest to. It looks like someone already had something like this but used the rx stuff (I just skimmed it, you might want to look closer).

Lastly, if you do build a plugin, please let people know about it here to prevent duplicate efforts. I also notice on that page that the description of the Node_Manager plugin says something about managing params, you might want to look at that to.

edit flag offensive delete link more


Perfect, thanks for you time

Edmodi gravatar image Edmodi  ( 2014-08-06 00:54:30 -0500 )edit

Glad to help. If that answers your question, please mark it as the answer (the little check mark).

Airuno2L gravatar image Airuno2L  ( 2014-08-06 06:19:02 -0500 )edit

Done. Thanks

Edmodi gravatar image Edmodi  ( 2014-08-06 06:45:40 -0500 )edit
130s gravatar image 130s  ( 2014-08-06 10:27:56 -0500 )edit

It looks like that only works for parameters that are setup with dynamic_reconfigure. "In the future, arbitrary parameters that are not associated with any nodes (which are not handled by dynamic_reconfigure) might become handled. However, currently as the name indicates, this pkg solely is dependent on dynamic_reconfigure that allows access to only those params latched to nodes."

Airuno2L gravatar image Airuno2L  ( 2014-08-07 06:58:29 -0500 )edit

Yeah, I just thought if OP specifically wants to handle non-dyn-reconf parameters wasn't clear.

130s gravatar image 130s  ( 2014-08-08 22:44:19 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-08-05 06:06:26 -0500

Seen: 1,301 times

Last updated: Aug 05 '14