You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and do: ros2 run pkg_name exe_name --ros-args -p "calib:=yes"
I get no exception and it prints 1, that is the same as true!!
While doing: ros2 run pkg_name exe_name --ros-args -p "calib:=ok"
gives me the inverse exception as before: parameter 'calib' has invalid type: expected [bool] got [string]. !!!
Is this expected?
The text was updated successfully, but these errors were encountered:
Unfortunately, yes, though it is a bug. We interpret a bunch of this stuff as YAML, and since "yes"/"no" gets automatically converted to a boolean in YAML, that's how it ends up here.
We partially fixed this in ros2/ros2cli#684 , where you can now force the type to be used in ros2 param by using the YAML !!str, but we didn't fix it in rclcpp or elsewhere.
For now, I'd say the best workaround is to avoid yes and no (and true and false for that matter) in your strings. It's not ideal, but until we have full support for the !!str syntax, it is the best we can do.
Windows 10
ROS2 Foxy binaries
Cyclone-DDS
rclcpp
Steps to reproduce issue
Use whatever node you want and add somewhere:
Then try run the node with:
Expected behavior
The CLI prints yes.
Actual behavior
Exception triggered with description:
parameter 'calib' has invalid type: expected [string] got [bool].
Additional information
If I launch the node with:
ros2 run pkg_name exe_name --ros-args -p "calib:=ok"
I get the expected behaviour (ok printed).
If I modify the code to accept a bool parameter, like this:
and do:
ros2 run pkg_name exe_name --ros-args -p "calib:=yes"
I get no exception and it prints 1, that is the same as true!!
While doing:
ros2 run pkg_name exe_name --ros-args -p "calib:=ok"
gives me the inverse exception as before:
parameter 'calib' has invalid type: expected [bool] got [string].
!!!Is this expected?
The text was updated successfully, but these errors were encountered: