ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

ROS 常用命令

2021-06-17 21:30:00  阅读:247  来源: 互联网

标签:ROS list rosservice rostopic 常用命令 turtlesim rosnode


ROS 常用命令


前言

本文以“小海龟”的例程为例,记录常用的ROS命令。

一、启动ROS自带的“小海龟”

  1. 启动ROS Master
roscore
  1. 启动仿真器
rosrun turtlesim turtlesim_node
  1. 启动海龟控制节点
rosrun turtlesim turtle_teletop_key

此时可以用键盘来控制海龟的运动了。效果如图所示:
这个海龟三个头哎

二、ROS 常用命令

1. rqt_graph显示节点关系

输入

rqt_graph

可得
在这里插入图片描述

2. rosnode

$ rosnode
rosnode is a command-line tool for printing information about ROS Nodes.

Commands:
	rosnode ping	test connectivity to node
	rosnode list	list active nodes
	rosnode info	print information about node
	rosnode machine	list nodes running on a particular machine or list machines
	rosnode kill	kill a running node
	rosnode cleanup	purge registration information of unreachable nodes

Type rosnode <command> -h for more detailed usage, e.g. 'rosnode ping -h'

列出所有活跃节点

~  rosnode list                       
/rosout
/teleop_turtle
/turtlesim

查询某一节点(以/turtlesim为例)的详细信息

~  rosnode info /turtlesim              
--------------------------------------------------------------------------------
Node [/turtlesim]
Publications: 
 * /rosout [rosgraph_msgs/Log]
 * /turtle1/color_sensor [turtlesim/Color]
 * /turtle1/pose [turtlesim/Pose]

Subscriptions: 
 * /turtle1/cmd_vel [geometry_msgs/Twist]

Services: 
 * /clear
 * /kill
 * /reset
 * /spawn
 * /turtle1/set_pen
 * /turtle1/teleport_absolute
 * /turtle1/teleport_relative
 * /turtlesim/get_loggers
 * /turtlesim/set_logger_level


contacting node http://mxt-Yoga:44213/ ...
Pid: 25826
Connections:
 * topic: /rosout
    * to: /rosout
    * direction: outbound (41939 - 127.0.0.1:46220) [30]
    * transport: TCPROS
 * topic: /turtle1/cmd_vel
    * to: /teleop_turtle (http://mxt-Yoga:39913/)
    * direction: inbound (36026 - mxt-Yoga:59331) [32]
    * transport: TCPROS

3. rostopic

 ~  rostopic          
rostopic is a command-line tool for printing information about ROS Topics.

Commands:
	rostopic bw	display bandwidth used by topic
	rostopic delay	display delay of topic from timestamp in header
	rostopic echo	print messages to screen
	rostopic find	find topics by type
	rostopic hz	display publishing rate of topic    
	rostopic info	print information about active topic
	rostopic list	list active topics
	rostopic pub	publish data to topic
	rostopic type	print topic or field type

Type rostopic <command> -h for more detailed usage, e.g. 'rostopic echo -h'

4. rosservice

 ~  rosservice                       
Commands:
	rosservice args	print service arguments
	rosservice call	call the service with the provided args
	rosservice find	find services by service type
	rosservice info	print information about service
	rosservice list	list active services
	rosservice type	print service type
	rosservice uri	print service ROSRPC uri

Type rosservice <command> -h for more detailed usage, e.g. 'rosservice call -h'

5. 话题记录

rosbag record -a -O cmd_record

其中

  • -a是指保存所有(all)的数据
  • -O是指保存数据为压缩包的格式,-O后面的名字即为压缩包的命名

6. 话题复现

rosbag play cmd_record.bag 

标签:ROS,list,rosservice,rostopic,常用命令,turtlesim,rosnode
来源: https://blog.csdn.net/MaXiaoTiancsdn/article/details/118001319

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有