ros / dynamic_reconfigure

BSD 3-Clause "New" or "Revised" License
47 stars 112 forks source link

dynparam set_from_parameters usage confusing #166

Open martinakos opened 3 years ago

martinakos commented 3 years ago

I think I need a clarification.

The description of dynparam set_from_parameters node_name is: "Load the configuration for a node from the Parameter Server." I guess that means to set the dynamic reconfigure parameters from a node with the corresponding parameter values in the parameter server for that node.

In contrast dynparam shows this example usage which includes a parameter asignment: Example command line: dynparam set_from_parameters wge100_camera _camera_url:=foo

I guess the assignment is to make possible to load the value of the parameter foo in the paramserver to the dynamic reconfigure parameter _camera_url.

If so, I don't understand my output below:

$ rosrun dynamic_reconfigure dynparam get /octomap_server
{'groups': {'ground_filter_plane_distance': 0.07, 'sensor_model_hit': 0.9900000010199071, 'parent': 0, 'filter_speckles': False, 'sensor_model_max': 0.8800000047967025, 'pointcloud_min_z': -100.0, 'ground_filter_distance': 0.04, 'groups': {}, 'pointcloud_max_z': 100.0, 'occupancy_max_z': 1.8, 'id': 0, 'sensor_model_min': 0.2899999946048837, 'sensor_model_miss': 0.03999999901895479, 'name': 'Default', 'parameters': {}, 'compress_map': True, 'max_depth': 16, 'state': True, 'ground_filter_angle': 0.15, 'filter_ground': False, 'occupancy_min_z': 0.2, 'sensor_model_max_range': 5.0, 'type': '', 'incremental_2D_projection': False}, 'ground_filter_plane_distance': 0.07, 'sensor_model_miss': 0.03999999901895479, 'filter_ground': False, 'incremental_2D_projection': False, 'compress_map': True, 'sensor_model_max': 0.8800000047967025, 'pointcloud_min_z': -100.0, 'ground_filter_distance': 0.04, 'filter_speckles': False, 'ground_filter_angle': 0.15, 'sensor_model_hit': 0.9900000010199071, 'pointcloud_max_z': 100.0, 'occupancy_max_z': 1.8, 'occupancy_min_z': 0.2, 'sensor_model_max_range': 5.0, 'max_depth': 16, 'sensor_model_min': 0.2899999946048837}

$ rosparam get /octomap_server/
compress_map: true
filter_ground: false
filter_speckles: false
frame_id: map
ground_filter_angle: 0.15
ground_filter_distance: 0.04
ground_filter_plane_distance: 0.07
incremental_2D_projection: false
local_map_half_size_x: 4.0
local_map_half_size_y: 4.0
local_map_half_size_z: 4.0
max_depth: 16
occupancy_max_z: 1.8
occupancy_min_z: 0.2
paused: false
pointcloud_max_z: 100.0
pointcloud_min_z: -100.0
resolution: 0.05
sensor_model: {hit: 0.99, max: 0.88, max_range: 5.0, min: 0.29, miss: 0.04}
sensor_model_hit: 0.9900000010199071
sensor_model_max: 0.8800000047967025
sensor_model_max_range: 5.0
sensor_model_min: 0.2899999946048837
sensor_model_miss: 0.03999999901895479

$ rosrun dynamic_reconfigure dynparam set_from_parameters /octomap_server
error updating parameters: no parameters found on parameter server

$ rosrun dynamic_reconfigure dynparam set_from_parameters /octomap_server sensor_model_hit:=sensor_model_hit
error updating parameters: no parameters found on parameter server

$ rosrun dynamic_reconfigure dynparam set_from_parameters /octomap_server sensor_model_hit:=sensor_model/hit
error updating parameters: no parameters found on parameter server

Why do I get this error? am I using dynparam set_from_parameters correctly?

BoyanH commented 5 months ago

Looking at the source

try:
        params = rospy.get_param("~")
    except KeyError:
        print('error updating parameters: no parameters found on parameter server', file=sys.stderr)
        return

it seems like it was intended to only set given parameters, not load any from the server. rospy.get_param("~") retrieves the private parameters of the current node, which are expected to be passed as remappings on the command line. The way I managed to use it was via:

$ rosrun dynamic_reconfigure dynparam set_from_parameters /octomap_server _sensor_model_hit:=0.98

Note the leading underscore.