赞
踩
内容来自ros2官方wiki的Tutorials部分:Tutorials — ROS 2 Documentation: Humble documentationhttps://docs.ros.org/en/humble/Tutorials.html
仅仅用于自查和学习,有误尽情指正!!
目录
ros2 run <package_name> <executable_name>
传入一个消息类型,返回 具体的信息,跟一些 -t 指令连在一起用很好用,因为 -t 指令会在输出后面连带着 type。
ros2 interface show <msg type>
Running a single launch file with the ros2 launch
command will start up your entire system - all nodes and their configurations - at once.
展示所有正在运行的节点的名称。
返回与该节点交互的订阅者、发布者、service和action的列表。
ros2 node info <node_name>
展示所有正在运行的话题的名称。
ros2 topic list -t #同时还会返回话题的类型
查看在话题上发布的数据,终端输入后,会增加一个subscriber,接受来自话题的数据,显示 在终端上。
ros2 topic echo <topic_name>
和上面的 echo 是相对的一个,给一个话题发数据,此话题的subscriber就会接收到发送的消息了。
ros2 topic pub <topic_name> <msg_type> '<args>'
返回topic的信息。
ros2 topic info <topic_name>
控制一个topic进行的速率。
展示所有正在运行的服务。 还可以加一个 -t 指令,后面就会显示其类型,配合 ros2 interface show 很好用!
返回服务的类型
ros2 service type <service_name>
根据类型 查正在运行的服务
ros2 service find <type_name>
调用一个service,像一个节点给另一个发请求。有一个值得注意的点就是 <arguments> 这个参数调用时要写一个双引号的,比如这个箱子:
"{x: 2, y: 2, theta: 0.2, name: ''}"
可以发现其中‘:’的后面都有个空格,这个空格得加上。
ros2 service call <service_name> <service_type> <arguments>
参数可以为 node 增加配置项
展示每个节点的一些配置参数。
显示参数类型和当前值
ros2 param get <node_name> <parameter_name>
设置参数咯
ros2 param set <node_name> <parameter_name> <value>
导出节点的参数,顺便还可以把参数写进一个yaml文件
ros2 param dump <node_name>
加载一个yaml文件的参数,应该叫参数文件
- ros2 param load <node_name> <parameter_file>
-
- # 也可以在启动的时候配置参数
- ros2 run <package_name> <executable_name> --ros-args --params-file <file_name>
当使用 node info 指令的时候,有一个选项就是action,可以看到其中的action。
This action server chose to abort the first goal because it got a new one. It could have chosen something else, like reject the new goal or execute the second goal after the first one finished. Don’t assume every action server will choose to abort the current goal when it gets a new one.
返回action
查看一个action的信息
发送一个操作目标 ,会返回一个结果,如果想看到feedback的信息,就需要后面加一个 --feedback;
记录操作到一个文件,然后可以复现一下子,ros1中不能完美复现,不知道2怎么样
ros2 bag record <topic_name>
ros2 bag info <bag_file_name>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。