Adding parameters by command line in EloquentROS2 is not working like tutorial
I'm following this tutorial to add a few parameters to my ROS2 node. My package iris_lama_ros2
has a node slam2d_ros
which I run with
ros2 run iris_lama_ros2 slam2d_ros --ros-args -p some_int:=42
And on my code, I want to retrieve this parameter and store it on a local variable.
int local_some_int;
node->get_parameter("some_int", local_some_int);
Problem is, this doesn't work. And even on another terminal, only a use_sim_time
is found
$ ros2 param list slam2d_ros
use_sim_time
Am I doing something obviously wrong? Or do I need to setup my package and node to take parameters with some specific configuration?
Does your slam2d_ros node declare the some_int parameter ? In ROS2 parameters must be declared beforehand by default, otherwise you need to explicitly allow undeclared parameters. Some more details and links at https://answers.ros.org/question/3259...