当前位置:网站首页>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
边栏推荐
- Day 248/300 关于毕业生如何找工作的思考
- 【软件测试进阶第1步】自动化测试基础知识
- Distributed system basic (V) protocol (I)
- 金融德语翻译,北京专业的翻译公司
- Introduction and underlying analysis of regular expressions
- [ 英语 ] 语法重塑 之 动词分类 —— 英语兔学习笔记(2)
- Apache dolphin scheduler source code analysis (super detailed)
- CS通过(CDN+证书)powershell上线详细版
- What is the difference between int (1) and int (10)? Senior developers can't tell!
- 翻译影视剧字幕,这些特点务必要了解
猜你喜欢

Changes in the number of words in English papers translated into Chinese

同事上了个厕所,我帮产品妹子轻松完成BI数据产品顺便得到奶茶奖励

C语言_双创建、前插,尾插,遍历,删除

Machine learning plant leaf recognition

基于PyTorch和Fast RCNN快速实现目标识别

医疗软件检测机构怎么找,一航软件测评是专家

How much is it to translate Chinese into English for one minute?

英语论文翻译成中文字数变化

Financial German translation, a professional translation company in Beijing

今日夏至 Today‘s summer solstice
随机推荐
Cobalt strike feature modification
What are the commonly used English words and sentences about COVID-19?
ECS accessKey key disclosure and utilization
LeetCode - 152 乘积最大子数组
生物医学本地化翻译服务
Every API has its foundation when a building rises from the ground
Erreur de type résolue avec succès: type de données « catégorie» non sous - jacente
ROS2安装及基础知识介绍
Day 246/300 SSH connection prompt "remote host identification has changed!"
AI on the cloud makes earth science research easier
钓鱼&文件名反转&office远程模板
Office-DOC加载宏-上线CS
Thesis abstract translation, multilingual pure human translation
Suspended else
UNIPRO Gantt chart "first experience": multi scene exploration behind attention to details
26岁从财务转行软件测试,4年沉淀我已经是25k的测开工程师...
Introduction and underlying analysis of regular expressions
MySQL high frequency interview 20 questions, necessary (important)
How to reconstruct the class explosion caused by m*n strategies?
AttributeError: Can‘t get attribute ‘SPPF‘ on <module ‘models. common‘ from ‘/home/yolov5/models/comm