how to set user-defined argument in launchfile ?
ros2 run let the user specify its own argument, i'd like to know if it is possible to use a user-defined argument in launch file ?
ros2 run my_pkg my_node --my_param=my_val --ros-args -p node_param:=value
launch_file
- node:
pkg: "my_pkg"
exec: "my_node"
param:
- name: "node_param"
value: "value"
?:?
alternatively, I cannot define a node parameter in my node (python). I used rclpy.parameter.Parameter (before rclpy.init), it makes command line run without error, but not value is set in the variable.
Asked by SĂ©bastienL on 2023-06-29 09:55:25 UTC
Answers
You can have dedicated parameters stored in a yaml file, and specify in the launch instructions that you want to use the particular parameters file. See here for more information: https://roboticsbackend.com/ros2-yaml-params/
Asked by sampreets3 on 2023-06-29 11:06:21 UTC
Comments