当前位置:网站首页>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
边栏推荐
- 【软件测试进阶第1步】自动化测试基础知识
- Biomedical localization translation services
- Pallet management in SAP SD delivery process
- LeetCode每日一题(971. Flip Binary Tree To Match Preorder Traversal)
- Leetcode - 152 product maximum subarray
- Thesis abstract translation, multilingual pure human translation
- MySQL5.72.msi安装失败
- 雲上有AI,讓地球科學研究更省力
- Database basics exercise part 2
- Reflex WMS medium level series 3: display shipped replaceable groups
猜你喜欢

机器学习植物叶片识别

Do you really know the use of idea?

接口自动化测试实践指导(上):接口自动化需要做哪些准备工作

Chinese English comparison: you can do this Best of luck

Cobalt Strike特征修改

基于购买行为数据对超市顾客进行市场细分(RFM模型)

翻译影视剧字幕,这些特点务必要了解

The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower

CS通过(CDN+证书)powershell上线详细版

Office doc add in - Online CS
随机推荐
CS通过(CDN+证书)powershell上线详细版
ECS accessKey key disclosure and utilization
Modify the list page on the basis of jeecg boot code generation (combined with customized components)
翻译生物医学说明书,英译中怎样效果佳
Grouping convolution and DW convolution, residuals and inverted residuals, bottleneck and linearbottleneck
How to translate biomedical instructions in English
基于PyTorch和Fast RCNN快速实现目标识别
It is necessary to understand these characteristics in translating subtitles of film and television dramas
Erreur de type résolue avec succès: type de données « catégorie» non sous - jacente
Office doc add in - Online CS
How to reconstruct the class explosion caused by m*n strategies?
Bitcoinwin (BCW): the lending platform Celsius conceals losses of 35000 eth or insolvency
How to convert flv file to MP4 file? A simple solution
Phishing & filename inversion & Office remote template
【刷题】怎么样才能正确的迎接面试?
[Yu Yue education] flower cultivation reference materials of Weifang Vocational College
成功解决TypeError: data type ‘category‘ not understood
成功解决TypeError: data type ‘category‘ not understood
Data security -- 13 -- data security lifecycle management
Making interactive page of "left tree and right table" based on jeecg-boot