joint friction?

User avatar
ejtttje
Posts: 96
Joined: Mon Nov 03, 2008 9:57 pm

joint friction?

Post by ejtttje »

I'm trying to model a servo which has a lot of gear friction. So the joint is fairly stiff, you have to apply some minimal force before it will move, and then it will seize quickly when you stop.

If I model the servo simply by doing my PID loop and testing to see if it exceeds the minimal torque to produce motion, this is only half the battle, because as far as the external world is concerned the joint moves freely, so if the link hits anything else (or is subject to gravity) then this will move the joint without respecting any kind of friction.

Is there a better way to do this? (Currently using btGeneric6DOFConstraint and calling applyTorqueImpulse() to each of its bodies)

Thanks
-Ethan
David20321
Posts: 17
Joined: Sat Mar 13, 2010 10:08 pm

Re: joint friction?

Post by David20321 »

One way to do this might be to add a btGeneric6DOFConstraint just for friction, with all the limits constantly set to their current state. Then you can control the friction by changing the paramaters of the btTranslationalLimitMotor and btRotationalLimitMotor. I haven't tried this myself, but I'm planning to soon.
User avatar
ejtttje
Posts: 96
Joined: Mon Nov 03, 2008 9:57 pm

Re: joint friction?

Post by ejtttje »

Ahh, it hadn't occurred to me to use two coincident constraints. Although in my case, since I am calling applyTorqueImpulse() directly instead of using a motor to set the velocity, I think I only need one. And also there is m_maxLimitForce (recently introduced?) so you might not need to use the motor. (actually, looks like that overrides m_maxMotorForce)

One issue is when to reset the limits to the current position. I think this should only be done when the motor is hitting its maximum force. Otherwise you will see slow drifts from small forces as it resets to the error position instead of holding the static position until friction is exceeded.

I'm not sure how to obtain the applied motor force in order to detect when to update the limit positions, might need to modify the contraint to cache the value somewhere.

I'm curious if anyone has tried implementing a servo by simply moving limit positions around and allowing the ERP to do all the dirty work... for my purposes I do want to have some more control over the joint motion to better simulate the servo, but this might be handy for a quick hack...?
User avatar
ejtttje
Posts: 96
Joined: Mon Nov 03, 2008 9:57 pm

Re: joint friction?

Post by ejtttje »

For future reference to others, building a robot out of servos which are moved via repeatedly setting their limit positions works fairly well, as long as you boost the m_numIterations (i.e. dynamicsWorld->getSolverInfo().m_numIterations), in my case to 200... perhaps boost m_erp as well (i'm using 0.5 now).

If m_numIterations and/or m_erp aren't high enough, the symptom is "weak" servos where it will "break" under load (e.g. hinges popping out of place). As far as I can tell, the trade off between iterations vs. erp is more computation with iterations vs. more jitter/instability with higher erp. (documentation would be nice :))