ros2 run传递参数的格式
ros2 run teleop_twist_keyboard teleop_twist_keyboard --ros-args -r /cmd_vel:=/model/vehicle_blue/cmd_vel #这个只能用于重命名节点名称
可以用以下语法直接从命令行中设置参数:
ros2 run package_name executable_name --ros-args -p param_name:=param_value
下面这个示例可以运行命令:
ros2 run demo_nodes_cpp parameter_blackboard --ros-args -p some_int:=42 -p "a_string:=Hello world" -p "some_lists.some_integers:=[1, 2, 3, 4]" -p "some_lists.some_doubles:=[3.14, 2.718]"
///这个参数是ros2参数服务器的那个参数,不是传递给可执行文件的参数
7 Load parameter file on node startup?
To start the same node using your saved parameter values, use:
ros2 run <package_name> <executable_name> --ros-args --params-file <file_name>
This is the same command you always use to start turtlesim, with the added flags?--ros-args
?and?--params-file
, followed by the file you want to load.
Stop your running turtlesim node, and try reloading it with your saved parameters, using:
ros2 run turtlesim turtlesim_node --ros-args --params-file turtlesim.yaml
The turtlesim window should appear as usual, but with the purple background you set earlier.
格式: ros2 run [-h] [--prefix PREFIX] package_name executable_name ...
Run a package specific executable
positional arguments:
? package_name ? ? Name of the ROS package
? executable_name ?Name of the executable
? argv ? ? ? ? ? ? Pass arbitrary arguments to the executable
options:
? -h, --help ? ? ? show this help message and exit
? --prefix PREFIX ?Prefix command, which should go before the executable. Command must be wrapped in quotes if it contains spaces (e.g. --prefix 'gdb -ex run --args').
这个就是ros2 run在launch文件里面的搞法:
<node>
? ? ? ? <param name='abc'? value='123'?/>
</node>
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。 如若内容造成侵权/违法违规/事实不符,请联系我的编程经验分享网邮箱:veading@qq.com进行投诉反馈,一经查实,立即删除!