How to Build a Simulated Mobile Manipulator Using ROS

In this tutorial, we will create a mobile manipulator using a wheeled robot base and a robotic arm. All we need to do is to connect the arm_base link of the robot arm to the base_link of the robot.

mobile-manipulator-gif

This tutorial would not have been possible without Ramkumar Gandhinathan and Lentin Joseph’s awesome book ROS Robotics Projects Second Edition (Disclosure: As an Amazon Associate I earn from qualifying purchases). I highly recommend it if you want to learn ROS 1. Many of the files (URDF, configuration, and STL files), come from their book’s public GitHub page.

Real-World Applications

This project has a number of real-world applications: 

  • Indoor Delivery Robots
  • Order Fulfillment
  • Factories
  • Warehouses
  • Space Exploration
  • Power Plants

Let’s get started!

Prerequisites

  • You have completed this tutorial where you learned how to create a mobile robot base.
  • You have completed this tutorial where you learned how to create a robotic arm.

Build the Mobile Manipulator

Open a new terminal window.

Move to the urdf folder of your package.

roscd mobile_manipulator_body/urdf/

Now create a file named mobile_manipulator.urdf.

gedit mobile_manipulator.urdf

Add the mobile_manipulator.urdf code inside there.

Save and close the file.

Test the Mobile Manipulator

Now, let’s launch RViz to see what our robot looks like so far.

roscd mobile_manipulator_body/urdf/
roslaunch urdf_tutorial display.launch model:=mobile_manipulator.urdf
1-rviz-mobile-manipulator

A GUI will appear that will enable you to move the joints.

2-gui-will-appear

Launch the Mobile Manipulator

Now let’s launch the mobile manipulator.

Open a new terminal window, and go to the package.

roscd mobile_manipulator_body/launch/

Create a new launch file.

gedit mobile_manipulator_gazebo.launch

Add the mobile_manipulator_gazebo.launch code inside there.

Save and close the file.

Now let’s launch the robot in Gazebo.

Move to your catkin workspace.

cd ~/catkin_ws/
roslaunch mobile_manipulator_body mobile_manipulator_gazebo.launch

Here is how the robot looks.

3-gazebo-mobile-manipulator

Here are the active ROS topics.

rostopic list
4-ros-active-topics

Open a new terminal, and type this command to move the robot arm a little bit:

rostopic pub /arm_controller/command trajectory_msgs/JointTrajectory '{joint_names: ["arm_base_joint","shoulder_joint", "bottom_wrist_joint", "elbow_joint","top_wrist_joint"], points: [{positions: [-0.1, 0.5, 0.02, 0, 0], time_from_start: [1,0]}]}' -1


Type this command to bring the robot back to the home position.

rostopic pub /arm_controller/command trajectory_msgs/JointTrajectory '{joint_names: ["arm_base_joint","shoulder_joint", "bottom_wrist_joint", "elbow_joint","top_wrist_joint"], points: [{positions: [0, 0, 0, 0, 0], time_from_start: [1,0]}]}' -1
3b-gazebo-mobile-manipulator

You can steer the robot by opening a new window and typing:

rosrun rqt_robot_steering rqt_robot_steering

You will need to change the topic inside the GUI to:

/robot_base_velocity_controller/cmd_vel

To see the velocity messages, open a new window and type:

rostopic echo /robot_base_velocity_controller/cmd_vel

References

ROS Robotics Projects Second Edition

How to Build a Simulated Robot Arm Using ROS

In the previous tutorial, we built a simulated mobile robot base from scratch. Now I want to create a robotic arm that I will eventually attach to this base so that I have a complete mobile manipulator. Here is what we will build:

robot-arm-gif

This tutorial would not have been possible without Ramkumar Gandhinathan and Lentin Joseph’s awesome book ROS Robotics Projects Second Edition (Disclosure: As an Amazon Associate I earn from qualifying purchases). I highly recommend it if you want to learn ROS 1. Many of the files (URDF, configuration, and STL files), come from their book’s public GitHub page.

Real-World Applications

This project has a number of real-world applications: 

  • Indoor Delivery Robots
  • Order Fulfillment
  • Factories
  • Warehouses
  • Space Exploration
  • Power Plants

Let’s get started!

Prerequisites

  • You have completed this tutorial where you learned how to create a mobile robot base.

Build the Robot Arm

Open a new terminal window.

Move to the urdf folder of your package.

roscd mobile_manipulator_body/urdf/

Now create a file named robot_arm.urdf.

gedit robot_arm.urdf

Add the robot_arm.urdf code inside there.

Save and close the file.

Test the Robot Arm

Now let’s launch the robot arm.

Open a new terminal window, and go to the package.

roscd mobile_manipulator_body/urdf/
roslaunch urdf_tutorial display.launch model:=robot_arm.urdf

Change the Fixed Frame to world.

Here is how the robot looks.

1-robot-arm-launch-test-1

Move the arm using the sliders. 

2-sliders

Here are the active ROS topics.

rostopic list
1a-rostopic-list

Press CTRL + C in all open terminal windows to close everything down.

Now, let’s set up the configuration parameters for the controllers.

Open a new terminal window.

Go to the config file of your package.

roscd mobile_manipulator_body/config/

Now create a file named arm_control.yaml.

gedit arm_control.yaml

Add the arm_control.yaml code inside there.

Save and close the file.

Now create a file named joint_state_controller.yaml.

gedit joint_state_controller.yaml

Add the joint_state_controller.yaml code inside there.

Save and close the file.

Launch the Robot Arm

Now let’s launch the robot arm.

Open a new terminal window, and go to the package.

roscd mobile_manipulator_body/launch/

Create a new launch file.

gedit arm_gazebo_control.launch

Add the arm_gazebo_control.launch code inside there.

Save and close the file.

Now let’s launch the robot in Gazebo.

Open a new terminal window.

Move to your catkin workspace.

cd ~/catkin_ws/
roslaunch mobile_manipulator_body arm_gazebo_control.launch

Here is how the robot arm looks.

4-robot-arm-gazebo

Here are the active ROS topics.

rostopic list
5-ros-topic-list

Open a new terminal, and type this command to move the robot arm a little bit:

rostopic pub /arm_controller/command trajectory_msgs/JointTrajectory '{joint_names: ["arm_base_joint","shoulder_joint", "bottom_wrist_joint", "elbow_joint","top_wrist_joint"], points: [{positions: [-0.1, 0.5, 0.02, 0, 0], time_from_start: [1,0]}]}' -1
6-after-publishing-command

Type this command to bring the robot back to the home position.

rostopic pub /arm_controller/command trajectory_msgs/JointTrajectory '{joint_names: ["arm_base_joint","shoulder_joint", "bottom_wrist_joint", "elbow_joint","top_wrist_joint"], points: [{positions: [0, 0, 0, 0, 0], time_from_start: [1,0]}]}' -1

References

ROS Robotics Projects Second Edition


How to Build a Simulated Mobile Robot Base Using ROS

In this tutorial, we will build a mobile robot base from scratch using ROS. In a future post, I will add a robotic arm to this base so that we have a complete mobile manipulator. By the end of this post, you will have a robot that looks like this:

6-robot-base-gif

This tutorial would not have been possible without Ramkumar Gandhinathan and Lentin Joseph’s awesome book ROS Robotics Projects Second Edition (Disclosure: As an Amazon Associate I earn from qualifying purchases). I highly recommend it if you want to learn ROS 1. Many of the files (URDF, configuration, and STL files), come from their book’s public GitHub page.

Real-World Applications

This project has a number of real-world applications: 

  • Indoor Delivery Robots
  • Order Fulfillment
  • Factories
  • Warehouses
  • Space Exploration
  • Power Plants

Let’s get started!

Prerequisites

Install ROS Packages

Let’s begin by installing some packages that we will need to accomplish our objective.

sudo apt-get install ros-noetic-ros-control
sudo apt-get install ros-noetic-ros-controllers
sudo apt-get install ros-noetic-gazebo-ros-control

Create a ROS Package

Create a ROS package.

In a new terminal window, move to the src (source) folder of your workspace.

cd ~/catkin_ws/src

Now create the package.

catkin_create_pkg mobile_manipulator_body std_msgs roscpp rospy
cd ~/catkin_ws/
catkin_make --only-pkg-with-deps mobile_manipulator_body

Create Folders

Open a new terminal window.

Move to your package.

roscd mobile_manipulator_body

Create these four folders.

mkdir config launch meshes urdf

Build the Base of the Robot

Now move to your meshes folder.

cd meshes

Go to this link, and download all the mesh files. 

Put the mesh files into your meshes folder inside your mobile_manipulator_body package.

Check to see all the files are in there.

dir
1-dir-mesh-files

Move to the urdf folder.

cd ..
cd urdf

Create a file named robot_base.urdf. In this file, we will define the four wheels of the robot and the base (i.e. five different “links”. Links are the rigid parts of the robot).

gedit robot_base.urdf

Copy this code for robot_base.urdf into that file. 

Save and close the file.

Now, let’s launch RViz to see what our robot looks like so far.

roscd mobile_manipulator_body/urdf/
roslaunch urdf_tutorial display.launch model:=robot_base.urdf
2-robot-base

Move the wheels using the sliders. 

3-gui

Press CTRL + C in all open terminal windows to close everything down.

Now, let’s set up the configuration parameters for the controllers.

Open a new terminal window.

Go to the config file of your package.

roscd mobile_manipulator_body/config/

Now create a file named control.yaml.

gedit control.yaml

Add the control.yaml code inside there.

Save and close the file.

Launch the Base of the Robot

Now let’s launch the base of the robot.

Open a new terminal window, and go to the package.

roscd mobile_manipulator_body/launch/

Create a new launch file.

gedit base_gazebo_control.launch

Add the code for base_gazebo_control.launch inside there.

Save and close the file.

Now let’s launch the robot in Gazebo.

Open a new terminal window.

Move to your catkin workspace.

cd ~/catkin_ws/
roslaunch mobile_manipulator_body base_gazebo_control.launch

Here is how the robot looks.

4-robot-base

Here are the active ROS topics.

rostopic list

You can steer the robot by opening a new window and typing:

rosrun rqt_robot_steering rqt_robot_steering

You will need to change the topic inside the GUI to:

/robot_base_velocity_controller/cmd_vel

6-rqt-steering

To see the velocity messages, open a new window and type:

rostopic echo /robot_base_velocity_controller/cmd_vel
7-ros-topic-list-velocity-cmd

References

ROS Robotics Projects Second Edition