# Problem with prismatic joint and setForce function

I have 2 primastic joints that have to raise a ramp, but whenever i try to setForce() the joints i get the ramp raised for a split second and the joints go back to the original position. How do i make the force costant?

I was also reading about PID controllers but if i'm not mistaken there's no implementation to set force through them, is setVelocityTarget the right function to call for a prismatic joint? Thanks for the answers

edit retag close merge delete

Sort by ยป oldest newest most voted

SetForce() sets the force for one time step only. It must be called every time step to keep applying a force. The PID class does the math for a PID controller, but doesn't call any methods to set forces. You'll need to calculate the error each time step and use the output of the Update method as the force.

If you want to control the velocity of joints there will soon be a tutorial about the different ways to do it: https://bitbucket.org/osrf/gazebo_tut...

more

Edit: i followed the tutorial and implemented two PID and setting the velocity target, it worked great thanks! now i just have one question, those PID will always try to set a force big enough to move anything on the ramp (given no limit in the sdf definition of the joints) or i have to set something else? Thanks for your time. edit2: to be more specific, the ramp raises if i place a simple box of 1 kg but does not move if i set it to 200kg. Raising the P(ID) makes everything unstable.

( 2017-05-23 11:43:34 -0500 )edit

Unfortunately PID tuning is a bit of an art. I would try increasing IMax and I gain to allow a force to ramp up until it can lift the 200kg box.

( 2017-05-30 09:57:19 -0500 )edit

eventually i found the right values, thanks!

( 2017-05-30 10:56:16 -0500 )edit