ROS nodes
ROS nodes are a process that perform computation using ROS client libraries such as roscpp and rospy. One node can communicate with other nodes using ROS Topics, Services, and Parameters.
A robot might contain many nodes; for example, one node processes camera images, one node handles serial data from the robot, one node can be used to compute odometry, and so on.
Using nodes can make the system fault tolerant. Even if a node crashes, an entire robot system can still work. Nodes also reduce the complexity and increase debug-ability compared to monolithic code because each node is handling only a single function.
All running nodes should have a name assigned to identify them from the rest of the system. For example, /camera_node could be a name of a node that is broadcasting camera images.
There is a rosbash tool to introspect ROS nodes. The rosnode command can be used to get information about a ROS node. Here are the usages of rosnode:
- $ rosnode info [node_name]: This will print the information about the node
- $ rosnode kill [node_name]: This will kill a running node
- $ rosnode list: This will list the running nodes
- $ rosnode machine [machine_name]: This will list the nodes running on a particular machine or a list of machines
- $ rosnode ping: This will check the connectivity of a node
- $ rosnode cleanup: This will purge the registration of unreachable nodes
We will look at example nodes using the roscpp client and will discuss the working of ROS nodes that use functionalities such ROS Topics, Service, Messages, and actionlib.