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 
  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值