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 5. Creating Your First Robot Arm (in Simulation)

In this chapter, you will begin to understand the control of robot arms with ROS. We begin with a simple three-link, two-joint articulated robotic arm in simulation. The simulated robot arm, rrbot, has two revolute joints that will help you to understand, without the complexities of more joints. We will use the URDF elements described in Chapter 2, Creating Your First Two-Wheeled Robot (in Simulation) and incorporate the advantages of Xacro to make our code more modular and efficient. We will also include a mesh design for our gripper, and add control elements for the arm and gripper to our URDF. Next, we will show various ways to control the robot arm in Gazebo.

In this chapter, you will learn:

  • The advantages of using Xacro in a URDF

  • How to design a three-link, two-joint robotic arm using Xacro and mesh files

  • How to control the arm in Gazebo using ROS commands and rqt

We begin by expanding your 3D modeling skills in order to create a robot...

Features of Xacro


Xacro is the XML macro language for ROS. Xacro provides a set of macro operations to replace some repetitive statements with shorter, concise macros that will expand into full XML statements when processed. Xacro can be used with any XML document, but is most useful with long, complex URDF files. Xacro allows you to create shorter and more readable XML files for the robot URDF. Xacro provides advantages in many different areas:

  • Property and property blocks: If repeated information is used in a URDF/SDF file, the <property> tag can be used to specify these constant values in a central location. These are typically parameters that can be changed later. Properties are usually identified at the beginning of the file, but they can be found anywhere in the XML file at any level. It does not matter whether the property declaration is before or after its use.

    Here is an example of how to implement a property:

    • Define as <xacro:property name="my_name" value ="Robby" />

    • Use...

Building an articulated robot arm URDF using Xacro


In the next few sections, our rrbot URDF will be created and incrementally built to incorporate the advantages of each of the Xacro features we discussed for our robot.

Using the Xacro property tag

For the first iteration of our rrbot robot arm, we will build a URDF file that defines three links with the <visual>, <collision>, and <inertial> tags, and two joints with the <parent>, <child>, <origin>, and <axis> tags. This is a very similar format to the dd_robot URDF file that you are familiar with from Chapter 2, Creating Your First Two-Wheeled ROS Robot (in Simulation). The differences for the Xacro format are listed here and explained in more detail after the code is presented:

  • Addition of the XML namespace declaration on the second line

  • Use of the Xacro <property> tag to define constant values

  • Addition of property names instead of values within the <box> and <origin> tags

  • Simple math...

Controlling an articulated robot arm in Gazebo


The Modifications to the robot URDF section in Chapter 2, Creating Your First Two-Wheeled Robot (in Simulation) describes changes that need to be made to the URDF model so that Gazebo recognizes it as an SDF. The next section identifies the changes needed for our robot arm, rrbot.

Adding Gazebo-specific elements

Specific elements unique to the Gazebo simulation environment are grouped in the following areas:

  • The <material> tags are used to specify the Gazebo color or texture for each link

  • The <mu1> and <mu2> tags are used to define friction coefficients for the contact surfaces for four of the robot's links

  • Plugin to control the revolute joints of rrbot (included here but described in the Adding a Gazebo ROS control plugin section)

These specific Gazebo XML elements needed for simulation are split into a separate file, labeled rrbot.gazebo, and an Xacro <include> statement is used in the main rrbot4.xacro file:

<xacro:include...

Summary


This chapter developed an understanding of how robot arms are modeled and controlled. We created a URDF/SDF for a simple three-link, two-joint robot arm to be used in a Gazebo simulation. Xacro was used to make the URDF/SDF modular and efficient. Mesh files were incorporated into the gripper design to give it a more realistic look. Control plugins and transmission elements were added to the robot model code to enable control of the robot arm in simulation. Then, ROS commands were used via the command line and rqt tools to control the arm's position in Gazebo.

In Chapter 6, Wobbling Robot Arms Using Joint Controls, we will extend our control of robot arms to the 7-DOF dual-armed Baxter. We will learn multiple ways to command and control Baxter's arms using both forward kinematic and inverse kinematic methods.

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}