Size: 3416
Comment:
|
Size: 3536
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 74: | Line 74: |
creating a client instance (node is the name of the node to reconfigure, for example 'hokuyo_node') | creating a client instance ({{{node_to_reconfigure}}} is the name of the node to reconfigure, for example 'hokuyo_node') |
Line 77: | Line 77: |
client = dynamic_reconfigure.DynamicReconfigureClient(node) | client = dynamic_reconfigure.DynamicReconfigureClient(<node_to_reconfigure>) |
Line 80: | Line 80: |
and calling update_configuration with a dictionary of changes to make | and calling update_configuration with a dictionary of changes to make (note that you do '''not''' need the preceding underscore on the parameter names) |
Note: This tutorial assumes that you have completed the previous tutorials: How to use Hokuyo laser scanners with the hokuyo_node, How to dynamically reconfigure the hokuyo_node using reconfigure_gui. |
![]() |
How to dynamically reconfigure the hokuyo_node from the command line or code.
Description: After completing this tutorial, you will be able to reconfigure the parameters of the hokuyo_node from the command line or python code.Keywords: reconfigure, Hokuyo, parameters, laser driver, laser, laser scanner, laser scan
Tutorial Level: INTERMEDIATE
Contents
Compiling
Start by getting the dependencies and compiling dynamic_reconfigure.
$ rosdep install dynamic_reconfigure $ rosmake dynamic_reconfigure
Using dynamic_reconfigure from the command line
You can reconfigure the hokuyo_node parameters by calling dynamic_reconfigure from the command line with the following invocation:
rosrun dynamic_reconfigure dynparam paramset /<node_name> _<param>:=<value>
For example, if the node is named hokuyo_node and the parameter is min_ang, the call would look like:
rosrun dynamic_reconfigure dynparam paramset /hokuyo_node _min_ang:=-1.0
Try it with any of the hokuyo_node parameters.
You can see the result of setting the parameters by visualizing the laser scan in rviz.
Using dynparam from Python code
You can change hokuyo_node parameters from Python scripts by importing:
import py_dynamic_reconfigure as dynamic_reconfigure
creating a node
rospy.init_node('myconfig_py', anonymous=True)
creating a client instance (node_to_reconfigure is the name of the node to reconfigure, for example 'hokuyo_node')
client = dynamic_reconfigure.DynamicReconfigureClient(<node_to_reconfigure>)
and calling update_configuration with a dictionary of changes to make (note that you do not need the preceding underscore on the parameter names)
params = { 'my_string_parameter' : 'value', 'my_int_parameter' : 5 } config = client.update_configuration(params)
config now contains the full configuration of the node after the parameter update.
Using dynparam from C++ code
Not yet implemented. Call the shell command as a temporary workaround.