Home | Tutorials | Wiki | Issues
Ask Your Question

JointController: Does the PID calculate torque to apply to joint?

asked 2016-04-13 12:44:06 -0500

pcdangio gravatar image

What exactly is does a gazebo::physics::JointController do to control the joint position/velocity?

I can see from the API documentation that you can set up a PID controller within the JointController, and you can ultimately specify P/I/D gains and min/max control effort. However, I'm not sure what the "control effort" is that is calculated by the PID controller inside of the JointController. Is it the force/torque applied to the joint?

On another note, I see no way in the documentation to specify which axis of the joint you want to control using a JointController. What happens if you are using a revolute2 joint with two axes?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2016-04-14 03:08:05 -0500

In my experience, the control effort is equal to the force applied. I haven't validated this, but that what I've always assumed it to be. It also seems you're correct about JointController only handling one axis. Of course implementing PID is very easy, and you can do it yourself. This means you can call SetForce(axis, force) and specify which axis you want to control. The JointController probably defaults to the first axis specified in sdf.

edit flag offensive delete link more

answered 2016-04-29 07:53:04 -0500

debz gravatar image

If you have a doubt because the documentation isn't precise enough, just check the code directly on Bitbucket:


For position PIDs, here is how it uses the common::PID class and the SetForce() function:

double cmd = this->dataPtr->posPids[iter->first].Update(this->dataPtr->joints[iter->first]->GetAngle(0).Radian() -  iter->second, stepTime);
this->dataPtr->joints[iter->first]->SetForce(0, cmd);
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2016-04-13 12:44:06 -0500

Seen: 1,308 times

Last updated: Apr 29 '16