当前位置:网站首页>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
边栏推荐
- Leetcode daily question (1870. minimum speed to arrive on time)
- 电子书-CHM-上线CS
- Windows Server 2016 standard installing Oracle
- [unity] how to export FBX in untiy
- LeetCode每日一题(1870. Minimum Speed to Arrive on Time)
- Erreur de type résolue avec succès: type de données « catégorie» non sous - jacente
- 【软件测试进阶第1步】自动化测试基础知识
- [ 英语 ] 语法重塑 之 动词分类 —— 英语兔学习笔记(2)
- 接口自动化测试实践指导(上):接口自动化需要做哪些准备工作
- Monotonic stack
猜你喜欢
(practice C language every day) reverse linked list II
How to reconstruct the class explosion caused by m*n strategies?
The internationalization of domestic games is inseparable from professional translation companies
Apache dolphin scheduler source code analysis (super detailed)
Chinese English comparison: you can do this Best of luck
基于购买行为数据对超市顾客进行市场细分(RFM模型)
[English] Verb Classification of grammatical reconstruction -- English rabbit learning notes (2)
Grouping convolution and DW convolution, residuals and inverted residuals, bottleneck and linearbottleneck
如何做好金融文献翻译?
字幕翻译中翻英一分钟多少钱?
随机推荐
Fedora/rehl installation semanage
端午节快乐Wish Dragon Boat Festival is happy
一文读懂简单查询代价估算
Tms320c665x + Xilinx artix7 DSP + FPGA high speed core board
[English] Grammar remodeling: the core framework of English Learning -- English rabbit learning notes (1)
详解SQL中Groupings Sets 语句的功能和底层实现逻辑
Day 248/300 thoughts on how graduates find jobs
Day 245/300 JS forEach 多层嵌套后数据无法更新到对象中
Successfully solved typeerror: data type 'category' not understood
Bitcoinwin (BCW): the lending platform Celsius conceals losses of 35000 eth or insolvency
Reflex WMS中阶系列3:显示已发货可换组
E-book CHM online CS
Financial German translation, a professional translation company in Beijing
电子书-CHM-上线CS
At the age of 26, I changed my career from finance to software testing. After four years of precipitation, I have been a 25K Test Development Engineer
Today's summer solstice
Bitcoinwin (BCW): 借贷平台Celsius隐瞒亏损3.5万枚ETH 或资不抵债
[brush questions] how can we correctly meet the interview?
[Yu Yue education] flower cultivation reference materials of Weifang Vocational College
Leetcode daily question (1870. minimum speed to arrive on time)