Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
ROS Robotics Projects

You're reading from  ROS Robotics Projects

Product type Book
Published in Mar 2017
Publisher Packt
ISBN-13 9781783554713
Pages 452 pages
Edition 1st Edition
Languages
Concepts

Table of Contents (20) Chapters

ROS Robotics Projects
Credits
About the Author
Acknowledgements
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
Getting Started with ROS Robotics Application Development Face Detection and Tracking Using ROS, OpenCV and Dynamixel Servos Building a Siri-Like Chatbot in ROS Controlling Embedded Boards Using ROS Teleoperate a Robot Using Hand Gestures Object Detection and Recognition Deep Learning Using ROS and TensorFlow ROS on MATLAB and Android Building an Autonomous Mobile Robot Creating a Self-Driving Car Using ROS Teleoperating a Robot Using a VR Headset and Leap Motion Controlling Your Robots over the Web

Chapter 9. Building an Autonomous Mobile Robot

An autonomous mobile robot can move from its current position to the goal position autonomously with the help of mapping and localizing algorithms. ROS provides some powerful packages to prototype an autonomous mobile robot from scratch. Some of the packages used in an autonomous robot are the ROS navigation stack, gmapping, and amcl. Combining these packages, we can build our own autonomous mobile robot. In this chapter, we will see a DIY autonomous mobile robot platform that works using ROS. This project is actually the updated version of the work mentioned in my first book, Learning Robotics Using Python, Packt Publishing (http://learn-robotics.com). In this chapter, we will mainly go through designing and building the simulation of a robot, then the hardware of robot, and finally the software framework. The chapter will be an abstract of all these things, since explaining everything in a single chapter will be a tedious task.

The following...

Robot specification and design overview


Here are the main specifications of the robot we are going to design in this chapter:

  • A maximum payload of 2 kg

  • Body weight of 3 kg

  • A maximum speed of 0.35 m/s

  • Ground clearance of 3 cm

  • Two hours of continuous operation

  • Differential drive configuration

  • Circular base footprint

  • Autonomous navigation and obstacle avoidance

  • Low-cost platform

We are going to design a robot that satisfies all these specifications.

Designing and selecting the motors and wheels for the robot


The robot we are going to design should have a differential drive configuration, and from the preceding specification, we can first determine the motor torque values. From the payload value and robot body weight, we can easily compute the motor torque.

Computing motor torque

Let's calculate the torque required to move this robot.

The number of wheels is four, including two caster wheels. The number of wheels undergoing actuation is only two. We can assume the coefficient of friction is 0.6 and of wheel radius is 4.5 cm. We can use the following formula:

Total weight of robot = Weight of robot + Payload

Weight of the robot: 3 x 9.8 ≈ 30 N (W = mg)

Payload: 2 x 9.8 ≈ 20 N

Total weight: 30 + 20 = 50 N

This total weight should be split among the four wheels of the robot, so we can write it as W = 2 x N1 + 2 x N2, where N1 is the weight acting on each robot wheel and N2 is the weight acting on each caster wheels. The configuration of wheels...

Building 2D and 3D models of the robot body


Chassis design is the next step in designing the robot. We can create the 2D drawing of the robot and then draw a 3D model of it. The only specification need to satisfy is that the robot's base footprint should be circular. Here, we are discussing a drawing that is satisfying this condition. If your requirements are different, you may need to modify your design accordingly. Now let's look at some illustrations of the robot's footprint.

The base plate

Following figure shows the base footprint of our robot:

Figure 1: Base plate of the robot

The preceding figure shows the base footprint of our robot. You can see that it is circular and there are two slots on the left and right for attaching motors and wheels. M1 and M2 are the positions of the motor body, and the shaft will be in the slots. The motors can be put on the top of the plate or on the bottom. Here, we are attaching the motors to the bottom of this plate. The wheels should be inside these...

Simulating the robot model in Gazebo


After modeling the robot, the next stage that we have to do is simulation. The simulation is mainly for mimicking the behavior of designed robot. For the simulation, normally we are putting ideal parameters to the simulated model. When we do the actual robot, there can be some changes from the simulated parameters. We can simulate the robot using Gazebo. Before simulating the robot, it will be good if you understand the mathematical model of a differential robot. The mathematical representation will give you more insight about the working of robot. We are not going to implement the robot controllers from scratch. Instead of that, we are using existing one.

Mathematical model of a differential drive robot


As you may know, robot kinematics is the study of motion without considering the forces that affect the motion, and robot dynamics is the study of the forces acting on a robot. In this section, we will discuss the kinematics of a differential robot.

Typically, a mobile robot or vehicle can have six degrees of freedom (DOF), which are represented as x, y, z, roll, pitch, and yaw. The x, y, and z degrees are translation, and roll, pitch, and yaw are rotation values. The roll movement of robot is sideways rotation, pitch is forward and backward rotation, and yaw is the heading and orientation of the robot. A differential robot moves along a 2D plane, so we can say it will have only three DOF, such as x, y, and theta, where theta is the heading of the robot and points along the forward direction of the robot.

The following figure shows the coordinate system of a differential-drive robot:

Figure 8: The coordinate system representation of a differential...

Designing and building actual robot hardware


Let's build the actual hardware of this robot. We need components that satisfy our design values and additional vision sensors to perform SLAM and AMCL. Here is the list::

Let's discuss the use of each hardware...

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...

Gmapping and localization in Chefbot


After launching the ROS driver, we can teleop the robot using keyboard teleop. We can use the following command to start keyboard teleoperation:

$ roslaunch chefbot_bringup keyboard_teleop.launch

If we want to map the robot environment, we can start the gmapping launch file like we did in the simulation:

$ roslaunch chefbot_bringup gmapping_demo.launch

You can visualize the map building in Rviz using the following command:

$ roslaunch chefbot_bringup view_navigation.launch

You can build the map by teleoperating the robot around the room. After mapping, save the map as we did in the simulation:

$ rosrun map_server map_saver -f ~/test_map

After getting the map, launch AMCL nodes to perform final navigation. You have to restart all the launch files and start again.

Let's look at the commands to launch the AMCL nodes.

First, start the ROS driver nodes using the following command:

$ roslaunch chefbot_bringup robot_standalone.launch

Now start the AMCL nodes:

...

Questions


  • How to convert encoder data to estimate the robot's position?

  • What is the role of SLAM in robot navigation?

  • What is AMCL and why is it used?

  • What is the importance of the ROS navigation stack?

Summary


In this chapter, we designed and built an autonomous mobile robot from scratch. The design of the robot started with its specification. From the specification, we designed various parameters of the robot, such as motor torque and speed. After finding out each parameter, we modeled the robot chassis and simulated it using ROS and Gazebo. After simulation, we saw how to create the actual hardware. We selected the components and interconnected the sensors and actuators to the embedded board. We wrote the firmware of the embedded board. The board can communicate with the PC on which the ROS is running. The ROS driver node receives the data from the robot and interfaces with the gmapping and AMCL packages to perform autonomous navigation.

In the next chapter, we will see how to create a self-driving car and interface to Robot Operating System.

lock icon The rest of the chapter is locked
You have been reading a chapter from
ROS Robotics Projects
Published in: Mar 2017 Publisher: Packt ISBN-13: 9781783554713
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}