当前位置:网站首页>ROS学习_基础
ROS学习_基础
2022-07-06 06:43:00 【Leslie X徐】
ROS命令行工具使用
一、常用命令
- roscore :启动ros
- rosrun :
rosrun [package_name] [node_name]
调用节点 参数为功能包名和节点名称 - rosnode :
rosnode list
列出当前运行的节点 - rqt_graph :可视化当前运行的节点
- rostopic :进行话题的操作
rostopic pub
:发布话题消息rostopic type
:查看消息类型
- rosservice :进行服务的操作
rosservice call
:发布服务请求
- rosparam
- rosmsg :获取消息的详细信息
- rossrv
二、示例:海龟仿真
启动ROS Master:
$roscore
启动海龟仿真器:
$rosrun turtlesim turtlesim_node
启动海龟控制节点:
$rosrun turtlesim turtle_teleop_key
注意:这三个命令分别在三个终端执行。运行
三、发布话题消息
发布消息 让海龟一直移动。
- 先查看消息类型
~$ rostopic type /turtle1/cmd_vel
geometry_msgs/Twist
~$ rosmsg show geometry_msgs/Twist
geometry_msgs/Vector3 linear
float64 x
float64 y
float64 z
geometry_msgs/Vector3 angular
float64 x
float64 y
float64 z
- 编写参数
~$ rostopic pub -r 10 /turtle1/cmd_vel geometry_msgs/Twist " linear: x: 1.0 y: 0.0 z: 0.0 angular: x: 0.0 y: 0.0 z: 0.0 "
注意:参数对齐
- 运行
四、发布服务请求
发布服务请求,添加新的海龟。
- 查看请求信息
~$ rosservice info /spawn
Node: /turtlesim
URI: rosrpc://ros2go:39063
Type: turtlesim/Spawn
Args: x y theta name
- 发布请求
~$ rosservice call /spawn " x: 5.0 y: 5.0 theta: 0.0 name: 'turtle2' "
name: "turtle2"
- 运行
五、话题和服务的区别
- 话题 (Topic)
- 节点间的异步通信机制
- 使用 发布/订阅 模型
- 话题数据:消息(Message) 文件格式
.msg
- 服务 (Service)
- 节点间的同步通信机制
- 使用 客户端/服务器(C/S) 模型
- 数据:文件格式
.srv
边栏推荐
- Market segmentation of supermarket customers based on purchase behavior data (RFM model)
- Office doc add in - Online CS
- Simple use of MySQL database: add, delete, modify and query
- LeetCode - 152 乘积最大子数组
- 成功解决AttributeError: Can only use .cat accessor with a ‘category‘ dtype
- 自动化测试环境配置
- Traffic encryption of red blue confrontation (OpenSSL encrypted transmission, MSF traffic encryption, CS modifying profile for traffic encryption)
- Pallet management in SAP SD delivery process
- Reflex WMS中阶系列3:显示已发货可换组
- Database basics exercise part 2
猜你喜欢
Phishing & filename inversion & Office remote template
26岁从财务转行软件测试,4年沉淀我已经是25k的测开工程师...
Biomedical English contract translation, characteristics of Vocabulary Translation
How do programmers remember code and programming language?
[unity] how to export FBX in untiy
如何做好金融文献翻译?
Pallet management in SAP SD delivery process
字幕翻译中翻英一分钟多少钱?
SAP SD发货流程中托盘的管理
[ 英語 ] 語法重塑 之 動詞分類 —— 英語兔學習筆記(2)
随机推荐
Leetcode daily question (1997. first day where you have been in all the rooms)
【刷题】怎么样才能正确的迎接面试?
Leetcode - 152 product maximum subarray
P5706 [deep foundation 2. Example 8] redistributing fat house water -- February 13, 2022
机器学习植物叶片识别
How do programmers remember code and programming language?
Tms320c665x + Xilinx artix7 DSP + FPGA high speed core board
Bitcoinwin (BCW): the lending platform Celsius conceals losses of 35000 eth or insolvency
SAP SD发货流程中托盘的管理
Day 245/300 JS foreach data cannot be updated to the object after multi-layer nesting
利用快捷方式-LNK-上线CS
Apache dolphin scheduler source code analysis (super detailed)
How to do a good job in financial literature translation?
Database basics exercise part 2
Thesis abstract translation, multilingual pure human translation
女生学软件测试难不难 入门门槛低,学起来还是比较简单的
Office doc add in - Online CS
Summary of leetcode's dynamic programming 4
MySQL5.72. MSI installation failed
成功解决TypeError: data type ‘category‘ not understood