Skip to content

Controlling Arm in Gazebo

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

To move the robot in Gazebo we need to assign a ROS controller to each joint. ROS controllers are provided by the package called ros_control. A controller is responsible for taking commands to move the joint and for publishing the joint state.

In order to actuate the robot using ROS controllers, we should define the transmission element in the URDF file to link actuators to joints. The macro used in the URDF for transmission is as follows:

alt text

Here, the joint_name is the joint to which we attach the controller. The hardwareInterface is the type of hardware interface to load (position, velocity, or effort interfaces). The hardware interface is loaded by the gazebo_ros_control plugin. The above code will specify the hardware interface type as Position Joint Interface for the joint. The following code in URDF is used to specify the hardware interface type of each revolute joint in the arm:

alt text

After specifying the hardware interface type of the joint, we need to attach a ROS controller that is compatible with the hardware interface mentioned inside the transmission tags. To do this we need to create a configuration file. You can find the configuration file robotic_arm_control.yaml in /final_gazebo/config/. Here is the configuration file definition:

alt text

All the controllers are inside the namespace robotic_arm and the first lines represents the joint state controller, which will publish the joint state of the robot at the rate of 50 Hz. The remaining controllers are joint position controllers.

Now we need to create a launch file which starts all the controllers along with the Gazebo simulation. The launch file arm_test_gazebo.launch is located in /final_gazebo/launch. Here is some part of the launch file:

alt text

The launch files start the Gazebo simulation of the arm, load the controller configuration, load the joint state controller and joint position controllers and runs the robot state publisher, which publishes the joint states and TF.