ROS Tutorials 1.5-1.7

ROS Tutorials

理解 ROS Nodes

Nodes

A node really isn't much more than an executable file within a ROS package. ROS nodes use a ROS client library to communicate with other nodes. Nodes can publish or subscribe to a Topic. Nodes can also provide or use a Service.

Client Libraries

ROS client libraries allow nodes written in different programming languages to communicate:

  • rospy = python client library
  • roscpp = c++ client library

roscore

roscore is the first thing you should run when using ROS.

$ roscore

If roscore does not initialize and sends a message about lack of permissions, probably the ~/.ros folder is owned by root, change recursively the ownership of that folder with:

$ sudo chown -R <your_username> ~/.ros

rosnode

rosnode displays information about the ROS nodes that are currently running. The rosnode list command lists these active nodes:

$ rosnode list
/rosout

$ rosnode info /rosout
------------------------------------------------------------------------
Node [/rosout]
Publications:
 * /rosout_agg [rosgraph_msgs/Log]

Subscriptions:
 * /rosout [unknown type]

Services:
 * /rosout/get_loggers
 * /rosout/set_logger_level

contacting node http://machine_name:54614/ ...
Pid: 5092

rosrun

rosrun allows you to use the package name to directly run a node within a package (without having to know the package path).

$ rosrun [package_name] [node_name]
$ rosrun turtlesim turtlesim_node

use a Remapping Argument to change the node's name:
$ rosrun turtlesim turtlesim_node __name:=my_turtle

cleaning the rosnode list with: 
$ rosnode cleanup

Let's use another rosnode command, ping, to test that it's up:
$ rosnode ping my_turtle
rosnode: node is [/my_turtle]
pinging /my_turtle with a timeout of 3.0s
xmlrpc reply from http://aqy:42235/     time=1.1529
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值