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


521

被折叠的 条评论
为什么被折叠?



