@ferstar
2015-11-09T15:51:58.000000Z
字数 1586
阅读 2728
ROS
Nodes: A node is an executable that uses ROS to communicate with other nodes.
Messages: ROS data type used when subscribing or publishing to a topic.
Topics: Nodes can publish messages to a topic as well as subscribe to a topic to receive messages.
Master: Name service for ROS (i.e. helps nodes find each other)
rosout: ROS equivalent of stdout/stderr
roscore: Master + rosout + parameter server (parameter server will be introduced later)
可能遇到的问题
Q:无法初始化
A:sudo chown -R <your_username> ~/.ros
一般会是权限问题,需要修改.ros目录归属即可
保持你执行roscore的shell不管,新开一个shell,执行
rosnode list
输出同wiki
表示没有任何节点在运行
获取点特殊的信息:
rosnode info /rosout
结果
Node [/rosout]
Publications:
* /rosout_agg [rosgraph_msgs/Log]
Subscriptions:
* /rosout [unknown type]
Services:
* /rosout/set_logger_level
* /rosout/get_loggers
contacting node http://ferstar-Vostro-3800:42663/ ...
Pid: 14328
顾名思义,就是运行软件包了
rosrun [package_name] [node_name]
例子:rosrun turtlesim turtlesim_node
结果:出现一只乌龟~囧rz
保持当前终端不变,新开一shell
rosnode list
结果同wiki
ROS其中一个强大的功能就是你可以通过终端命令修改节点名字
干掉之前打开的那个乌龟窗口,然后执行
rosrun turtlesim turtlesim_node __name:=hello_ros
乌龟又一次出现,不过现在的节点列表变成了
/hello_ros
/rosout
/turtlesim
然后ping一下节点
rosnode ping hello_ros
输出
rosnode: node is [/hello_ros]
pinging /hello_ros with a timeout of 3.0s
xmlrpc reply from http://ferstar-Vostro-3800:59627/ time=0.408888ms
xmlrpc reply from http://ferstar-Vostro-3800:59627/ time=0.682831ms
xmlrpc reply from http://ferstar-Vostro-3800:59627/ time=0.699043ms
我们用了三个指令