ROS学习笔记(五):重要命令的理解以及ROS Topics初试水

官方中文教程
概念理解:

  • rosout:相当于stdout/stderr
    stdout – 标准输出设备 (printf("…")) 同 stdout。
    stderr – 标准错误输出设备
    两者默认向屏幕输出。
    但如果用转向标准输出到磁盘文件,则可看出两者区别。stdout输出到磁盘文件,stderr在屏幕。
  • roscore: 主机+ rosout + 参数服务器
  • rospy = python 客户端库
  • roscpp = c++ 客户端库

三大命令:

  1. 使用roscore:roscore 是你在运行所有ROS程序前首先要运行的命令。
    命令行:~$ roscore
    显示如下:
li@li-Lenovo:~$ roscore
... logging to /home/li/.ros/log/7943f016-b37e-11ea-aa6f-c83dd494a8c1/roslaunch-li-Lenovo-11581.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://li-Lenovo:45017/
ros_comm version 1.14.5


SUMMARY
========

PARAMETERS
 * /rosdistro: melodic
 * /rosversion: 1.14.5

NODES

auto-starting new master
process[master]: started with pid [11591]
ROS_MASTER_URI=http://li-Lenovo:11311/

setting /run_id to 7943f016-b37e-11ea-aa6f-c83dd494a8c1
process[rosout-1]: started with pid [11602]
started core service [/rosout]

  1. 使用rosnode:获取节点信息
li@li-Lenovo:~$ 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'
  1. 使用 rosrun:跑来自命令行中被给软件包中的一个节点

Usage:

$ rosrun [package_name] [node_name]
"""通过命令行重新配置名称"""
$ rosrun [package_name] [node_name]:=my_turtle

ROS话题,它来了,它来了,它真的大摇大摆的走来了!

实现publishing 和 subscribe 之间的互相通信

在这里插入图片描述
中间的/turtle1/cmd_vel相当于ROS Topics

其他的内容跟着教程走就可以,不难,enjoy!

猜你喜欢

转载自blog.csdn.net/qq_42910179/article/details/106884407