Interfacing robot hardware with ROS

In this section, we will see how we can interface a robot's embedded controller with ROS. The embedded controller can send speed commands to the motors and obtain speed commands from robot controller nodes. The ROS robot controller nodes receive linear and angular Twist command from the ROS navigation stack. The Twist command will be subscribed to by the robot controller node and converted into equivalent motor velocity, that is Vl and Vr.

The robot controller nodes also receive encoder ticks from the embedded controller and calculate the distance traveled by each wheel. Let's take a look at the robot controller nodes.

The Chefbot robot controller nodes are placed in chefbot_bringup/scripts. You can check out each node; they're all written in Python.

  • launchpad_node.py: This is the ROS driver node for handling Launchpad boards. This node will receive serial data from Launchpad and also send data to the board. After running this node, we will get serial data from the board as topics, and we can send data to the board through topics too.
  • SerialDataGateway.py: This Python module is used to handle serial receive or transmit data in a thread. The launchpad_node.py node uses this module to send or receive data to or from the board.
  • Twist_to_motors.py: This node will subscribe to Twist messages from the ROS navigation stack or teleop node and convert them into wheel target velocities.
  • pid_velocity.py: This is a node that implements the PID controller, which subscribes to the wheel target velocity and converts it into equivalent motor velocity.
  • diff_tf.py: This node basically subscribes to the encoder data and calculates the distance traversed by the robot. It then publishes as the odometry and transformation (TF) topic.

Here is the graph showing the communication between the nodes:

Figure 19: Communication among ROS driver nodes

Here is the list of ROS launch files that we need in order to work with the actual robot. All launch files are placed in the chefbot_bringup/launch folder:

  • robot_standalone.launch: This will launch the ROS driver nodes of Chefbot.
  • model_robot.launch: This launch file loads the URDF file of Chefbot.
  • view_robot.launch: This will display the robot model on Rviz.
  • keyboard_teleop.launch: This will start the keyboard teleop node, which can drive the robot using a keyboard.
  • 3dsensor.launch: This will launch OpenNI to enable depth camera drivers. There may changes to this launch file according to the sensor.
  • gmapping_demo.launch: This will launch the gmapping nodes, which will help us map the robot environment.
  • amcl_demo.launch: This will launch the AMCL nodes, which help us localize the robot on the map.
  • view_navigation.launch: This will visualize the map and robot, which helps us command the robot to move to the destination on the map.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.72.74