Reader small image

You're reading from  Mastering ROS for Robotics Programming

Product typeBook
Published inDec 2015
Reading LevelIntermediate
PublisherPackt
ISBN-139781783551798
Edition1st Edition
Languages
Concepts
Right arrow
Author (1)
Lentin Joseph
Lentin Joseph
author image
Lentin Joseph

Lentin Joseph is an author and robotics entrepreneur from India. He runs a robotics software company called Qbotics Labs in India. He has 7 years of experience in the robotics domain primarily in ROS, OpenCV, and PCL. He has authored four books in ROS, namely, Learning Robotics using Python, Mastering ROS for Robotics Programming, ROS Robotics Projects, and Robot Operating System for Absolute Beginners. He is currently pursuing his master's in Robotics from India and is also doing research at Robotics Institute, CMU, USA.
Read more about Lentin Joseph

Right arrow

Chapter 4. Using the ROS MoveIt! and Navigation Stack

In the previous chapters, we have been discussing about the designing and simulation of a robotic arm and mobile robot. We controlled each joint of the robotic arm in Gazebo using the ROS controller and moved the mobile robot inside Gazebo using the teleop node.

In this chapter, we are going to interface out of the box functionalities, such as robot manipulation and autonomous navigation using the ROS MoveIt! and Navigation stack.

MoveIt! is a set of packages and tools for doing mobile manipulation in ROS. The official web page (http://moveit.ros.org/) contains the documentations, the list of robots using MoveIt!, and various examples to demonstrate pick and place, grasping, simple motion planning using inverse kinematics, and so on.

MoveIt! contains state of the art software for motion planning, manipulation, 3D perception, kinematics, collision checking, control, and navigation. Apart from the command line interface, MoveIt! has some...

Installing MoveIt!


Let's start with installing MoveIt!. The installation procedure is very simple and is just a single command.

Installing MoveIt! on ROS Indigo can be done using the following command. Here we are installing MoveIt! binary packages.

$ sudo apt-get install ros-indigo-moveit-full

In ROS Jade, we can install MoveIt! using the following command:

$ sudo apt-get install ros-jade-moveit-ros ros-jade-moveit-plugins ros-jade-moveit-planners

MoveIt! architecture

Let's start with MoveIt! and its architecture. Understanding the architecture of MoveIt! helps to program and interface the robot to MoveIt!. We will quickly go through the architecture and the important concepts of MoveIt!, and start interfacing and programming our robots.

Here is the MoveIt! architecture, included in their official web page at http://moveit.ros.org/documentation/concepts:

Figure 1: MoveIt! architecture diagram

The move_group node

We can say that move_group is the heart of MoveIt! as this node acts as an integrator...

Generating MoveIt! configuration package using Setup Assistant tool


The MoveIt! Setup Assistant is a graphical user interface for configuring any robot to MoveIt!. Basically, this tool generates SRDF, configuration files, launch files, and scripts generating from the robot URDF model, which is required to configure the move_group node.

The SRDF file contains details about the arm joints, end effector joints, virtual joints, and also the collision link pairs which are configured during the MoveIt! configuration process using the Setup Assistant tool.

The configuration file contains details about the kinematic solvers, joint limits, controllers, and so on, which are also configured and saved during the configuration process.

Using the generated configuration package of the robot, we can work with motion planning in RViz without the presence of a real robot or simulation interface.

Let's start the configuration wizard, and we can see the step by step procedure to build the configuration package...

Step 1 – Launching the Setup Assistant tool


  • To start the MoveIt! Setup Assistant tool, we can use the following command:

    $ roslaunch moveit_setup_assistant setup_assistant.launch
    
  • This will bring up a window with two choices: Create New MoveIt! Configuration Package or Edit Existing MoveIt! Configuration Package. Here we are creating a new package, so we need that option. If we have a MoveIt! package already, then we can select the second option.

  • Click on the button Create New MoveIt! Configuration Package, which will bring a new screen, as shown next:

    Figure 4 : MoveIt Setup Assistant

  • In this step, the wizard asks for the URDF model of the new robot. To give the URDF file, click on the Browse button and navigate to mastering_ros_robot_description_pkg/urdf/ seven_dof_arm.xacro. Choose this file and press the Load button to load the URDF. We can either give the robot model as pure URDF or xacro, if we give xacro, the tool will convert to URDF internally.

  • If the robot model is successfully parsed...

Motion planning of robot in RViz using MoveIt! configuration package


MoveIt! provides a plugin for RViz which allows it to create new planning scenes where robot works, generate motion plans, add new objects, visualize the planning output and can directly interact with the visualized robot.

The MoveIt! configuration package consists of configuration files and launch files to start motion planning in RViz. There is a demo launch file in the package to explore all the functionalities of this package.

Following is the command to invoke the demo launch file:

$ roslaunch seven_dof_arm_config demo.launch

If everything works fine, we will get the following screen of RViz being loaded with the MotionPlanning plugin provided by MoveIt!:

Figure 11 : MoveIt! - RViz motion planning interface

Using the RViz MotionPlanning plugin

From the preceding Figure 11, we can see that the RViz-Motion Planning plugin is loaded on the left side of the screen. There are several tabs on the Motion Planning window, such...

Understanding ROS Navigation stack


The main aim of the ROS navigation package is to move a robot from the start position to the goal position, without making any collision with the environment. The ROS Navigation package comes with an implementation of several navigation related algorithms which can easily help implement autonomous navigation in the mobile robots.

The user only needs to feed the goal position of the robot and the robot odometry data from sensors such as wheel encoders, IMU, and GPS, along with other sensor data streams such as laser scanner data or 3D point cloud from sensors like Kinect. The output of the Navigation package will be the velocity commands which will drive the robot to the given goal position.

The Navigation stack contains implementation of the standard algorithms, such as SLAM, A *(star), Dijkstra, AMCL, and so on, which can directly be used in our application.

ROS Navigation hardware requirements

The ROS navigation stack is designed as generic. There are some...

Building a map using SLAM


The ROS Gmapping package is a wrapper of open source implementation of SLAM called OpenSLAM (https://www.openslam.org/gmapping.html). The package contains a node called slam_gmapping, which is the implementation of SLAM which helps to create a 2D occupancy grid map from the laser scan data and the mobile robot pose.

The basic hardware requirement for doing SLAM is a laser scanner which is horizontally mounted on the top of the robot, and the robot odometry data. In this robot, we have already satisfied these requirements. We can generate the 2D map of the environment using the gmapping package through the following procedure.

Creating a launch file for gmapping

The main task while creating a launch file for the gmapping process is to set the parameters for the slam_gmapping node and the move_base node. The slam_gmapping node is the core node inside the ROS gmapping package. The slam_gmapping node subscribes the laser data (sensor_msgs/LaserScan) and the tf data, and...

Questions


  1. What is the main purpose of MoveIt! packages?

  2. What is the importance of the move_group node in MoveIt!?

  3. What is the purpose of the move_base node in the Navigation stack?

  4. What are the functions of the SLAM and AMCL packages?

Summary


This chapter offered a brief overview of MoveIt! and the Navigation stack of ROS and demonstrated its capabilities using Gazebo simulation of a robotic arm mobile base. The chapter started with a MoveIt! overview and discussed detailed concepts about MoveIt!. After discussing MoveIt!, we interfaced MoveIt! and Gazebo. After interfacing, we executed the trajectory from MoveIt! on Gazebo.

The next section was about the ROS Navigation stack. We discussed its concepts and workings as well. After discussing the concepts, we tried to interface our robot in Gazebo to the Navigation stack and build a map using SLAM. After doing SLAM, we performed autonomous navigation using AMCL and the static map.

In the next chapter, we will discuss pluginlib, nodelets, and controllers.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Mastering ROS for Robotics Programming
Published in: Dec 2015Publisher: PacktISBN-13: 9781783551798
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.
undefined
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

Author (1)

author image
Lentin Joseph

Lentin Joseph is an author and robotics entrepreneur from India. He runs a robotics software company called Qbotics Labs in India. He has 7 years of experience in the robotics domain primarily in ROS, OpenCV, and PCL. He has authored four books in ROS, namely, Learning Robotics using Python, Mastering ROS for Robotics Programming, ROS Robotics Projects, and Robot Operating System for Absolute Beginners. He is currently pursuing his master's in Robotics from India and is also doing research at Robotics Institute, CMU, USA.
Read more about Lentin Joseph