本篇教程分类总结了ROS常用的命令,方便阅读和查找
帮助命令都是在Ros指令后面加 --help来实现,以rostopic命令为例
rostopic --help
# 返回内容如下
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 -h for more detailed usage, e.g. 'rostopic echo -h'
ROS Shell指令主要用于文件管理,包管理,可以使我们在ROS环境中使用常用的bash shell命令。
这部分命令用于查询节点、话题、服务的信息,查看和修改参数等功能。
可以看一下帮助命令:
$ rostopic --help
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'
常用指令如下:
rostopic list # 显示可用的rostopic 列表
rostopic echo [options] /topic # 显示指定topic发布的信息,
#举例:rostopic echo /turtle1/pose
rostopic type [-h] topic_or_field # 显示topic信息的类型,常和 rosmsg show 一起使用,
# 用于查看topic的消息数据格式
# 举例:rostopic type /turtle1/cmd_vel | rosmsg show
rostopic pub /topic type [args...] # 使用topic发送ROS信息
# 举例
rostopic pub /turtle1/cmd_vel geometry_msgs/Twist -r 1 -- '[2,0,0]' '[0,0,1.8]'
先看一下帮助信息
$ rosservice --help
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'
常用指令如下
rosservice list # 显示rosservice列表
rosservice call /service [args] # 调用rosservice,完成service的任务
# 举例:rosservice call /turtle1/teleport_absolute 5 5 0
rosservice type /service # 显示server的消息类型,常和 rossrv show 一起使用,用于显示
# rosservice消息的数据格式
# 举例:rosservice type /turtle1/teleport_absolute | rossrv show
rosparam能让我们在ROS参数服务器(Parameter Server)上存储和操作数据。帮助内容如下:
$ rosparam --help
rosparam is a command-line tool for getting, setting, and deleting parameters from the ROS Parameter Server.
Commands:
rosparam set set parameter
rosparam get get parameter
rosparam load load parameters from file
rosparam dump dump parameters to file
rosparam delete delete parameter
rosparam list list parameter names
常用命令:
rosparam list # 显示可用参数
rosparam set [param_name] # 设置指定参数
rosparam get [param_name] # 获取指定参数
rosparam get / # 获取所有参数
欢迎各位老铁一键三连,本号后续会不断更新树莓派、人工智能、STM32、ROS小车相关文章和知识。
大家对感兴趣的知识点可以在文章下面留言,我可以优先帮大家讲解哦
欢迎大家光临我的淘宝小店,会定期推出教程中使用的物美价优的硬件,你的光临就是对我的支持
原创不易,转载请说明出处。