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

You're reading from  ROS Robotics By Example

Product type Book
Published in Jun 2016
Publisher Packt
ISBN-13 9781782175193
Pages 428 pages
Edition 1st Edition
Languages
Concepts

Table of Contents (17) Chapters

ROS Robotics By Example
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Preface
Getting Started with ROS Creating Your First Two-Wheeled ROS Robot (in Simulation) Driving Around with TurtleBot Navigating the World with TurtleBot Creating Your First Robot Arm (in Simulation) Wobbling Robot Arms Using Joint Control Making a Robot Fly Controlling Your Robots with External Devices Flying a Mission with Crazyflie Extending Your ROS Abilities Index

Chapter 2. Creating Your First Two-Wheeled ROS Robot (in Simulation)

Your first robot will be created in simulation so that even if you do not have a robot to learn ROS on, you will be able to follow along and do the exercises in this book. We will build a simple two-wheeled robot named dd_robot (dd is short for a differential drive). We will build a Unified Robot Description Format (URDF) file for the robot that will describe the main components of our robot and enable it to be visualized and controlled by ROS tools, such as rviz and Gazebo. Rviz is a visualization tool in which we will view our dd_robot URDF file as we build it in increments. When the visual model is complete, we will modify the URDF file for use in the Gazebo simulator. In Gazebo, we can view the effects of physics on our model as we move our model around the 3D environment.

In this chapter, we will cover the following topics:

  • An introduction to rviz, installation instructions, and instructions for use

  • How to create and...

Rviz


Rviz, abbreviation for ROS visualization, is a powerful 3D visualization tool for ROS. It allows the user to view the simulated robot model, log sensor information from the robot's sensors, and replay the logged sensor information. By visualizing what the robot is seeing, thinking, and doing, the user can debug a robot application from sensor inputs to planned (or unplanned) actions.

Rviz displays 3D sensor data from stereo cameras, lasers, Kinects, and other 3D devices in the form of point clouds or depth images. 2D sensor data from webcams, RGB cameras, and 2D laser rangefinders can be viewed in rviz as image data.

If an actual robot is communicating with a workstation that is running rviz, rviz will display the robot's current configuration on the virtual robot model. ROS topics will be displayed as live representations based on the sensor data published by any cameras, infrared sensors, and laser scanners that are part of the robot's system. This can be useful to develop and debug...

Creating and building a ROS package


Before we begin to design and build our robot model in simulation, we should create our first ROS package. In Chapter 1, Getting Started with ROS, we created a ROS catkin workspace under /home/<username>/catkin_ws. The structure of a catkin workspace looks like this:

catkin_ws/                     -- WORKSPACE
   build/                          -- BUILD SPACE
   devel/                          -- DEVEL SPACE
   src/                               -- SOURCE SPACE
   CMakeLists.txt          -- 'Toplevel' CMake file, provided by catkin

Tip

Make sure that you have source ~/catkin_ws/devel/setup.bash in your .bashrc file, or this command is entered at the terminal window prompt.

We begin by moving to your catkin workspace source directory:

$ cd ~/catkin_ws/src

Now, let's create our first ROS package, ros_robotics:

$ catkin_create_pkg ros_robotics

This command will create a /ros_robotics directory under the ~/catkin_ws/src directory. The /ros_robotics directory...

Building a differential drive robot URDF


URDF is an XML format specifically defined to represent robot models down to their component level. These URDF files can become long and cumbersome on complex robot systems. Xacro (XML Macros) is an XML macro language created to make these robot description files easier to read and maintain. Xacro helps you reduce the duplication of information within the file.

For our first robot model, we will build a URDF file for a two-wheeled differential drive robot. The model will be created incrementally, and we will view the results at each step in rviz. When our simple two-wheeled robot is complete, we will add Gazebo formatting and view the model in Gazebo. In Chapter 5, Creating Your First Robot Arm (in Simulation), we will expand our knowledge of URDF files and build a simple robot arm model using the Xacro notation.

Note

Downloading the ros_robotics code

You can download the example code files and other support material for this book from www.PacktPub.com...

Gazebo


Gazebo is a free and open source robot simulation environment developed by Willow Garage. As a multifunctional tool for ROS robot developers, Gazebo supports the following:

  • Designing of robot models

  • Rapid prototyping and testing of algorithms

  • Regression testing using realistic scenarios

  • Simulation of indoor and outdoor environments

  • Simulation of sensor data for laser range finders, 2D/3D cameras, kinect-style sensors, contact sensors, force-torque, and more

  • Advanced 3D objects and environments utilizing Object-Oriented Graphics Rendering Engine (OGRE)

  • Several high-performance physics engines (Open Dynamics Engine (ODE), Bullet, Simbody, and Dynamic Animation and Robotics Toolkit (DART)) to model the real-world dynamics

In this section, we will load our two-wheeled robot URDF into Gazebo to visualize it in a 3D environment. Gazebo allows you to take control of some aspects of our model without an external control program. In the later chapters, we will be using simulated versions of robots...

Summary


Your first robot design has been a simple two-wheeled differential drive model defined in URDF. There are many other properties that can be defined in the URDF file, and you are free to extend the dd_robot model. This introductory exercise was provided so that the elements of simulation can be understood by the reader. In Chapter 3, Driving Around with TurtleBot, we will use a simulated and a real TurtleBot to explore a variety of ROS control methods for mobile robot navigation. The rqt toolset will be introduced and used to monitor and control the TurtleBot's movements.

In Chapter 5, Creating Your First Robot Arm (in Simulation), we will extend our understanding of URDF by learning more about Xacro. We will build a Xacro file to define a robot model for a robot arm.

lock icon The rest of the chapter is locked
You have been reading a chapter from
ROS Robotics By Example
Published in: Jun 2016 Publisher: Packt ISBN-13: 9781782175193
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}