Gazebo | Ignition | Community
Ask Your Question

Problem with prismatic joint and setForce function

asked 2017-05-23 04:46:42 -0500

lory18 gravatar image

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 flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-05-23 11:17:07 -0500

sloretz gravatar image

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:

edit flag offensive delete link 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.

lory18 gravatar imagelory18 ( 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.

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

eventually i found the right values, thanks!

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

Question Tools

1 follower


Asked: 2017-05-23 04:46:42 -0500

Seen: 894 times

Last updated: May 23 '17