Home | Tutorials | Wiki | Issues
Ask Your Question

Controlling a robotic arm in Gazebo using purely Torques/Forces

asked 2017-07-25 14:17:08 -0500

scchow gravatar image

updated 2017-07-26 07:27:29 -0500


I currently have the UR3 robotic arm loaded in Gazebo using their provided URDF/Xacro. I would like to make the arm move by specifying how much torque a particular joint of the arm produces.

My initial intuition would be to create a Gazebo plugin. I have been looking at the Gazebo Physics Joint class, but I have to admit I am a bit lost as to what function to use. I have a basic plugin that can print out the links and joints of the arm, but I am having little luck moving the arm. Currently my update function of my plugin looks like this:

public: void OnUpdate(const common::UpdateInfo & /*_info*/)
         this->model->GetJoint("shoulder_lift_joint")->SetForce(1, 10000);

It seems to jiggle the arm slightly but doesn't have any other effect. I am also confused about the inputs of set force. What indices correspond to which axis, and what are the units of force?

The reason I am not using the built-in JointController class is because eventually I want to test out my own controllers for the arm; however, the default JointController already includes a PID controller implementation built-in and only takes in the goal joint position. I would like a lower-level method to make a joint provide some torque and let Gazebo simulate what applying this torque would do.


After submitting the question, I changed the axis to 2 and the force to 1000000 (SetForce(2,1000000)), which was enough to break the model. So it seems the function does affect the model, but I would still like some clarification about the input parameters and whether this is the correct approach.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-08-01 20:19:20 -0500

iche033 gravatar image

I think you're on the right track. Some joints have more than one axis, e.g. revolute2, so the index specifies which axis to to control. I think the ur3 robot only has revolute joints so the index should be 0. The SetForce call still works in your example because the ODE revolute joint implementation ignores the index value.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-07-25 14:17:08 -0500

Seen: 80 times

Last updated: Aug 01