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

Dynamically set plugin parameters using python

asked 2021-08-12 06:24:31 -0500

lxg gravatar image

Hello, is there a way to set the plugin parameters dynamically for the plugins such as hector plugin imu or gps updaterate. Say using rospy.set_param("param_name")?

How can I retrieve or set their values from with ROS? I could not find anything related to this. Thanks a lot.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-08-12 08:44:32 -0500

rappy gravatar image

All dynamically reconfigurable parameters through rqt can also be listed and updated through python API of dynamic_reconfigure package a simple tutorial can be found in the link below

http://wiki.ros.org/hokuyo_node/Tutor...

You simply get and set desired parameters as follows.

import dynamic_reconfigure.client

client = dynamic_reconfigure.client.Client(<node_to_reconfigure>, timeout = 10)
parameters = client.get_configuration()
params = { 'my_string_parameter' : 'value', 'my_int_parameter' : 5 }
config = client.update_configuration(params)
edit flag offensive delete link more

Comments

@rappy thanks, indeed, I need something like this but the plugin for which i need it is a gazebo_ros plugin loaded from a .so file. I have tried but can not load it successfully with these settings since its node is not is not explicitly written anywhere. Anyway i can incorporate this method to the .so files such as gazebo_ros_imu.so or gazebo_ros_gps.so ? thanks alot.

lxg gravatar image lxg  ( 2021-08-12 09:56:38 -0500 )edit

As far as I know this only works for dynamically reconfigurable parameters, for example, all parameters of move_base/DWAPlannerROS but if the parameters are not listed in rqt dynamic reconfigure you cannot modify them with this method. It is also possible to change the parameters as you have written like rospy.set_param("/param_name",3) but I am not sure if gazebo plugins can update this parameter in runtime if you change it like this.

rappy gravatar image rappy  ( 2021-08-13 02:40:38 -0500 )edit

@rappy, let alone update them, I can not retrieve gazebo plugin parameters using this method. I can get the updatable gazebo parameters themselves but not the plugin parameters. So may be there's no way to update gazebo plugin parameters during runtime at the moment.

lxg gravatar image lxg  ( 2021-08-13 03:00:25 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2021-08-12 06:24:31 -0500

Seen: 480 times

Last updated: Aug 12 '21