当前位置:网站首页>Ros2 learning notes (IX) -- Summary of common instructions for ros2 command line operation (II)
Ros2 learning notes (IX) -- Summary of common instructions for ros2 command line operation (II)
2022-04-21 14:11:00 【Stream wind bathes snow】
brief introduction : In the sixth 、 7、 ... and 、 Custom messages are described in Chapter 8 (Message)、 service (Service)、 action (Action) Implementation process , In addition, the application of parameters is also introduced , During the learning process, we interspersed some command-line operations to debug or verify relevant functions , This section details the command line operations related to these contents , It is verified by the functions that have been realized in the virtual simulation environment .
news 、 service 、 Action in ROS2 It is uniformly called interface in (interface), The command line operation of the interface has been introduced in Section 5 , Our custom interface , Can pass ros2 interface list see , Because I unify all interfaces into the same package , So you can also pass ros2 interface package Command to view all created interfaces , Or use ros2 interface show View the interface content .

besides , service 、 action 、 Parameters and unique operation commands .
1、 Service operation tools ros2 service
1.1 ros2 service list
Command function : List the services in the domain ,-t Service message types can be listed at the same time
Command format :ros2 service list <-t>

1.2 ros2 service type
Command function : Lists the data types of the specified service
Command format :ros2 service type <service_name>

1.3 ros2 service find
Command function : Lists the services in the domain that use the specified data type
Command format :ros2 service find <type_name>

1.4 ros2 service call
Command function : Request services synchronously from the command line
Command format :ros2 servie call <service_name> <type_name> <request_data>
Order sample :$ ros2 service call /change_map_name duckietown_interface/srv/ChangeMap "{map_name: '4way'}"

2、 Action operation tools ros2 action
2.1 ros2 action list
Command function : List the available actions in the domain ,-t Action message types can be displayed at the same time
Command format :ros2 action list <-t>

2.2 ros2 action info
Command function : View specified action Information , You can see the server and client
Command format :ros2 action info <action_name>

2.3 ros2 action send_goal
Command function : Simulate the client to initiate action request
Command format :ros2 action send_goal <action_name> <type_name> <goal_data> <--feedback>
Order sample :$ ros2 action send_goal /crossing_acton duckietown_interface/action/Crossing "{speed: 0.2, direction: 'right'}" --feedback

notes :--feedback Specify whether to display feedback topic information
3、 Parameter operation tool ros2 param
3.1 ros2 param list
Command function : List the parameters available in the domain
Command format :ros2 param list

3.2 ros2 param get
Command function : View the current value of the specified parameter
Command format :ros2 param get <node_name> <param_name>

3.3 ros2 param set
Command function : Set the value of the specified parameter
Command format :ros2 param set <node_name> <param_name> <new_value>

3.4 ros2 param delete
Command function : Delete parameters ( Generally do not use )
Command format :ros2 param delete <node_name> <param_name>
3.5 ros2 param describe
Command function : Displays descriptive information about declared parameters , Add descriptive information when declaring parameters to view
Command format :ros2 param describe <node_name> <param_name>
3.6 ros2 param dump
Command function : All current parameter values “ dump ” Save to a file for later use
Command format :ros2 param dump <node_name> --output-dir < Save the path >
Order sample :$ ros2 param dump /line_detect_node --output-dir ~/ros2_ws/src/line_detect/line_detect/
Save the parameters to the same directory as the source file , The file name is consistent with the node name , File for yaml Format , After saving, the contents are as follows :
/line_detect_node:
ros__parameters:
color_select: white
red_h_high: 10
red_h_low: 156
red_s_high: 255
red_s_low: 43
red_v_high: 255
red_v_low: 46
use_sim_time: false
white_h_high: 180
white_h_low: 0
white_s_high: 50
white_s_low: 0
white_v_high: 255
white_v_low: 100
yellow_h_high: 34
yellow_h_low: 26
yellow_s_high: 255
yellow_s_low: 43
yellow_v_high: 255
yellow_v_low: 46
3.7 ros2 param load
Command function : Load existing parameters into the node
Command format :ros2 run <package_name><node_name> --ros-args --params-file <file_name>
Order sample :$ ros2 run line_detect line_detect_node --ros-args --params-file src/line_detect/line_detect/line_detect_node.yaml
版权声明
本文为[Stream wind bathes snow]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204211354387051.html
边栏推荐
猜你喜欢
随机推荐
ROS2学习笔记(七)-- 自定义动作实现路口转弯
深度剖析TCP三次握手,面试官拍案叫绝
There are two important limits of the limit existence criterion
socket做的简单网络嗅探器
Tcpdump packet capture and nmap are easy to use
C语言每日一题第一天
English word memory method based on anki + vocabulary
一改测试步骤代码就全写?为什么不试试用 Yaml实现数据驱动?
C语言每日一题——[NOIP2008]ISBN号码(牛客网第76题)
爬虫实例:爬取中国大学排名
干掉项目中杂乱 的 if-else,试试状态模式,这才是优雅的实现方式
REST-assured 获取日志到文件并结合 Allure 报告进行展示
MySQL 5.7 Optimization: explain the execution plan in nearly 10000 words
The stack concept is transformed into cyclic bracket matching inverse Polish expression simulation to achieve full dry goods
数组的动态创建
Infinitesimal and infinity
初学者3种简单排序的个人总结
Congratulations to EDG for winning the 2021 hero League global finals
函数的连续性
Introduction to redis cluster construction and management








