Skip to content

Interfacing MoveIt! with Gazebo

Aditya Gaddipati edited this page Jul 5, 2017 · 7 revisions

For interfacing the arm in MoveIt! to Gazebo, we need to attach to each planning group a joint trajectory controller which has the FollowJointTrajectoryAction interface.

Step 1 - Attaching JointTrajectoryController to robot in Gazebo

We have to create a controller configuration file in which we will specify the controller type as JointTrajectoryController and also specify the joints under the controller. The configuration file trajectory_control.yaml is located in /final_gazebo/config/ folder. Here is the definition of the file:

alt text

We have created a position_controllers/JointTrajectoryController which has an action interface of FollowJointTrajectory.

Now we need to load the controller along with the Gazebo simulation. To do this we will create a launch file robotic_arm_bringup_gazebo.launch. This file is located in /final_gazebo/launch/ folder. Here is the definition of the launch file:

alt text

This launch file spawns the robot model in Gazebo, publishes the joint states and attaches the trajectory controller. To launch the file type the following command in the terminal:

roslaunch final_gazebo robotic_arm_bringup_gazebo.launch

The list of topics generated is as follows:

alt text

We can see that an action server is started under the controller's name with the namespace of follow_joint_trajectory. MoveIt! will talk to this action server whenever it needs to execute a trajectory on the real robot or Gazebo.

Step 2 - Configuring moveit_simple_controller_manager

Now we need to do control the arm in Gazebo using MoveIt!. To do this, first we need to create a configuration file for talking with the trajectory controller in Gazebo from MoveIt!. Configuration file controllers.yaml is located in /final_config/config/. Here is the definition of the file:

alt text

In this configuration file we tell MoveIt! the name of the Action Server that was created in the previous step. We specify the name of the controller that was created in previous step i.e. robotic_arm/robotic_arm_controller and specify the action namespace as follow_joint_trajectory. This is how MoveIt! will know which controller it has to talk to.

Now we need to create a launch file to load this configuration file. The definition of robotic_arm_moveit_controller_manager.launch, located in /final_config/launch/, is as follows:

alt text

This launch file starts the MoveItSimpleControllerManager and loads the joint trajectory controller interface defined inside controllers.yaml.

Inside /final_config/launch/ create moveit_planning_execution.launch. Definition is as follows:

alt text

Inside /final_config/launch/ create robotic_arm_bringup_rviz.launch. Definition is as follows:

alt text

Start Gazebo using the following command:

roslaunch final_gazebo robotic_arm_bringup_gazebo.launch

Start motion planning of arm in Gazebo from MoveIt! RViz GUI using the following command:

roslaunch final_gazebo robotic_arm_bringup_rviz.launch
Clone this wiki locally