Chapter 10. Integration of ChefBot Hardware and Interfacing it into ROS, Using Python
In Chapter 2, Mechanical Design of a Service Robot, we saw the ChefBot chassis design and now we have got the manufactured parts of this robot. In this chapter, we will see how to assemble this robot using these parts and also the final interfacing of sensors and other electronics components of this robot to Tiva C LaunchPad. We have already discussed interfacing of individual robot components and sensors with Launchpad. In this chapter, we will try to interface the necessary robotic components and sensors of ChefBot and program it in such a way that it will receive the values from all sensors and control the information from the PC. Launchpad will send all sensor values via a serial port to the PC and also receive control information (such as reset command, speed, and so on) from the PC.
After receiving sensor values from the PC, a ROS Python node will receive the serial values and convert it to ROS Topics...
Building ChefBot hardware
The first section of the robot that needs to be configured is the base plate. The base plate consists of two motors and its wheels, caster wheels, and base plate supports. The following image shows the top and bottom view of the base plate:
The base plate has a radius of 15cm and motors with wheels are mounted on the opposite sides of the plate by cutting a section from the base plate. A rubber caster wheel is mounted on the opposite side of the base plate to give the robot good balance and support for the robot. We can either choose ball caster wheels or rubber caster wheels. The wires of the two motors are taken to the top of the base plate through a hole in the center of the base plate. To extend the layers of the robot, we will put base plate supports to connect the next layers. Now, we can see the next layer with the middle plate and connecting tubes. There are hollow tubes, which connect the base plate and the...
Configuring ChefBot PC and setting ChefBot ROS packages
In ChefBot, we are using Intel's NUC PC to handle the robot sensor data and its processing. After procuring the NUC PC, we have to install Ubuntu 14.04.2 or the latest updates of 14.04 LTS. After the installation of Ubuntu, install complete ROS and its packages we mentioned in the previous chapters. We can configure this PC separately, and after the completion of all the settings, we can put this in to the robot. The following are the procedures to install ChefBot packages on the NUC PC.
Clone ChefBot's software packages from GitHub using the following command:
We can clone the code in our laptop and copy the chefbot
folder to Intel's NUC PC. The chefbot
folder consists of the ROS packages of ChefBot. In the NUC PC, create a ROS catkin workspace, copy the chefbot
folder and move it inside the src
directory of the catkin workspace.
Build and install the source code of ChefBot...
Interfacing ChefBot sensors with Tiva C LaunchPad
We have discussed interfacing of individual sensors that we are going to use in ChefBot. In this section, we will discuss how to integrate sensors into the Launchpad board. The Energia code to program Tiva C LaunchPad is available on the cloned files at GitHub. The connection diagram of Tiva C LaunchPad with sensors is as follows. From this figure, we get to know how the sensors are interconnected with Launchpad:
M1 and M2 are two differential drive motors that we are using in this robot. The motors we are going to use here is DC Geared motor with an encoder from Pololu. The motor terminals are connected to the VNH2SP30 motor driver from Pololu. One of the motors is connected in reverse polarity because in differential steering, one motor rotates opposite to the other. If we send the same control signal to both the motors, each motor will rotate in the opposite direction. To avoid this condition, we will...
Writing a ROS Python driver for ChefBot
After uploading the embedded code to Launchpad, the next step is to handle the serial data from Launchpad and convert it to ROS Topics for further processing. The launchpad_node.py
ROS Python driver node interfaces Tiva C LaunchPad to ROS. The launchpad_node.py
file is on the script
folder, which is inside the chefbot_bringup
package. The following is the explanation of launchpad_node.py
in important code sections:
The launchpad_node.py
file imports the preceding modules. The main modules we can see is SerialDataGateway
. This is a custom module written to receive serial...
Understanding ChefBot ROS launch files
We will discuss the functions of each launch files of the chefbot_bringup
package.
robot_standalone.launch
: The main function of this launch file is to start nodes such as launchpad_node
, pid_velocity
, diff_tf,
and twist_to_motor
to get sensor values from the robot and to send command velocity to the robot.
keyboard_teleop.launch
: This launch file will start the teleoperation by using the keyboard. This launch starts the chefbot_keyboard_teleop.py
node to perform the keyboard teleoperation.
3dsensor.launch
: This file will launch Kinect OpenNI drivers and start publishing RGB and depth stream. It will also start the depth stream to laser scanner node, which will convert point cloud to laser scan data.
gmapping_demo.launch
: This launch file will start SLAM gmapping nodes to map the area surrounding the robot.
amcl_demo.launch
: Using AMCL, the robot can localize and predict where it stands on the map. After localizing on the map, we can command the robot...
Working with ChefBot Python nodes and launch files
We already set ChefBot ROS packages in Intel's NUC PC and uploaded the embedded code to the Launchpad board. The next step is to put the NUC PC on the robot, configure remote connection from the laptop to the robot, testing each nodes, and working with ChefBot Launch files to perform autonomous navigation.
The main device we should have before working with ChefBot is a good wireless router. The robot and the remote laptop have to connect on the same network. If the robot PC and remote laptop are on the same network, the user can connect from the remote laptop to the robot PC through SSH using its IP. Before putting the robot PC in the robot, we should connect the robot PC in the wireless network, so once it's connected to the wireless network, it will remember the connection details. When the robot powers, the PC should automatically connect to the wireless network. Once the robot PC is connected to the wireless network, we can put it in...
This chapter was about assembling the hardware of ChefBot and integrating the embedded and ROS code into the robot to perform autonomous navigation. We saw the robot hardware parts that were manufactured using the design from Chapter 5, Working with Robotic Actuators and Wheel Encoders. We assembled individual sections of the robot and connected the prototype PCB that we designed for the robot. This consists of the Launchpad board, motor driver, left shifter, ultrasonic, and IMU. The Launchpad board was flashed with the new embedded code, which can interface all sensors in the robot and can send or receive data from the PC. After discussing the embedded code, we wrote the ROS Python driver node to interface the serial data from the Launchpad board. After interfacing the Launchpad board, we computed the odometry data and differential drive controlling using nodes from the differential_drive
package that existed in the ROS repository. We interfaced the robot to ROS navigation stack...