Robotics StackExchange | Archived questions

Controlling a robotic arm in Gazebo using purely Torques/Forces

Hi,

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.


Edit:

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.

Asked by scchow on 2017-07-25 14:17:08 UTC

Comments

I'm interested to know how this ended up. I'm trying to the same thing - simulate a custom motor controller in Gazebo using a plugin.

I'm headed down the same path you are (were). Planning to apply forces - since that's better than velocities I think - in the plugin update function.

Asked by josephcoombe on 2017-09-27 11:56:50 UTC

Answers

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.

Asked by iche033 on 2017-08-01 20:19:20 UTC

Comments