ros2 param dump: `null` breaks round-trip numerical parameters
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 262
- Forks
- 228
- Avg merge
- 23h 15m
- Merged PRs (30d)
- 12
Description
Summary
ros2 param dump sometimes produces invalid YAML for a ros2 run. I would think that round-trip ROS params are a desirable feature. (Named after round-trip YAML.)
User Story
My user story is that I wish to use my IDE to debug a ROS node with insanely complex params - a full MoveIt config (462 lines long).
This is not specific to MoveIt, but is instead an example of ros2 param at scale. It is not feasible to manually convert every key to a command line arg or to ros2 param set them individually.
What I've been doing is:
- ros2 launch the node (using the moveit config builder)
- Get all its params:
ros2 param dump /my_moveit_node > params.yaml - In the IDE, load the params from the YAML file:
ros2 run my_pkg my_moveit_node --ros-args --params-file params.yaml
Expected behavior
It loads as is and I only have to regenerate the YAML file when the ros2 launch config changes.
Actual behavior
Sometimes, the node halts.
terminate called after throwing an instance of 'rclcpp::exceptions::InvalidParameterTypeException'
what(): parameter 'robot_description_planning.joint_limits.joint_1.max_position' has invalid type: expected [double] got [string]
The YAML file contains
/my_moveit_node:
ros__parameters:
robot_description_planning:
joint_limits:
joint_1:
has_acceleration_limits: false
has_jerk_limits: null
has_velocity_limits: true
max_acceleration: 0
max_position: null
max_velocity: 1.5
min_position: null
I didn't set the null values. I have never even seen these keys. I am guessing they were filled in automatically by some declaration magic.
Requested behavior
Support round-trip params.
- During
ros2 param dump, do not fill in unset param values withnull. - If there is a good reason to dump
null, make it toggleable with a command-line flag.
Suggested Workaround
Use bash-fu on your params file to delete any line containing the text null
sed -i '/null/d' params.yaml
(You could also use grep -v, but I find this shorter)
Environment
Ubuntu 22.04
ROS2 humble
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the ros2 param dump entry point and reproduce the issue using the provided dump and params-file commands. Trace how unset values become YAML null; done means the dumped file can be loaded by ros2 run without numerical parameters being interpreted as strings or rejected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100