0
$\begingroup$

Rosanswers logo

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/199608/roslaunch-order-of-rosparams/)

BUT I have this example where I first noticed the use of this attribute: https://github.com/AprilRobotics/apriltag_ros/blob/master/apriltag_ros/launch/continuous_detection.launch

<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?


Originally posted by vane on ROS Answers with karma: 35 on 2022-05-28

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by Mike Scheutzow with karma: 4903 on 2022-05-29

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by vane on 2022-05-29:
I compared the dumps of the param server with both clear_params true/false and they are identical

Comment by Mike Scheutzow on 2022-05-29:
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.

Comment by vane on 2022-05-30:
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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.