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.

To test the arm in gazebo type the following command in the terminal:

roslaunch final_gazebo arm_test_gazebo.launch

The topics generated from the controllers when we run this launch file are as follows:

alt text

To move a robot joint in Gazebo, we have to publish a joint value with a message type std_msgs/Float64 to the joint position controller command topics.

rostopic pub /robotic_arm/joint1_controller/command s_msgs/Float64 1.57

To view the joint states type the following:

rostopic echo /robotic_arm/joint_states