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

How does roslaunch node clear_params work exactly?

asked 2022-05-28 10:32:41 -0500

vane gravatar image

How exactly does 'clear_params' attribute of node and group works? Description from here: http://wiki.ros.org/roslaunch/XML/node

clear_params="true|false"(optional) Delete all parameters in the node's private namespace before launch.

I assumed that it would be used to clear all the parameters in the node's private name space, maybe for the purpose of making sure that the defaults from code are loaded, since the launch rosparam and param declarations are loaded before the nodes are started (here is a nice summary: https://answers.ros.org/question/1996...)

BUT I have this example where I first noticed the use of this attribute: https://github.com/AprilRobotics/apri...

<launch>
  <arg name="launch_prefix" default="" /> <!-- set to value="gdbserver localhost:10000" for remote debugging -->
  <arg name="node_namespace" default="apriltag_ros_continuous_node" />
  <arg name="camera_name" default="/camera_rect" />
  <arg name="image_topic" default="image_rect" />

  <!-- Set parameters -->
  <rosparam command="load" file="$(find apriltag_ros)/config/settings.yaml" ns="$(arg node_namespace)" />
  <rosparam command="load" file="$(find apriltag_ros)/config/tags.yaml" ns="$(arg node_namespace)" />

  <node pkg="apriltag_ros" type="apriltag_ros_continuous_node" name="$(arg node_namespace)" clear_params="true" output="screen" launch-prefix="$(arg launch_prefix)" >
    <!-- Remap topics from those used in code to those on the ROS network -->
    <remap from="image_rect" to="$(arg camera_name)/$(arg image_topic)" />
    <remap from="camera_info" to="$(arg camera_name)/camera_info" />

    <param name="publish_tag_detections_image" type="bool" value="true" />      <!-- default: false -->
  </node>
</launch>

So I would assume that the 'clear_params' would actually clear the parameter values from both the previous rosparam tags AND the child param tag. But this is not the case, all these settings are taken into account. So how does clear_params works and for what reason was it used in the example above?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-05-29 11:21:35 -0500

Mike Scheutzow gravatar image

Assuming that text in the wiki is correct, I agree with your analysis. It may be debug code left in by accident.

If you are able to run that launch file, you could verify the actual behavior by using the command line rosparam list to see if any of those parameters are present on the param server.

edit flag offensive delete link more

Comments

I compared the dumps of the param server with both clear_params true/false and they are identical

vane gravatar image vane  ( 2022-05-29 13:01:49 -0500 )edit

That is unexpected, because in the git repo there are parameter values assigned in settings.yaml and tags.yaml. Do you see those properties in the list?

It looks like the wiki only tells part of the story. The behavior I see is that this flag is executed before any parameter server properties are set to their new values. This is useful when a rosparam property is no longer present in the current launch file.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2022-05-29 18:08:43 -0500 )edit

Yeah, that would be a consistent scenario that makes sense and would be useful in niche situations. I personally hate having implicit/default settings of any kind

vane gravatar image vane  ( 2022-05-30 03:28:10 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2022-05-28 10:32:41 -0500

Seen: 589 times

Last updated: May 29 '22