There is quite a noticeable amount of shaking/instability in the CustomHingeActuator joint, when trying to hold a target angle against gravity.
This can be seen quite easily in your sandbox demos when running the articulated joints demo.
View the tracked vehicle from the side and you will see the crane lift boom going up and down intermittently.
I played around a little with the CustomHingeActuator::SubmitConstraintsFreeDof function and believe I improved the stability.
I suspect similar changes might be needed for the other joints like slider actuator etc. as they have the same implementation for solving the actuator, although I haven't come across an obvious case where the other joints show the same behaviour.
Below is the diff for the changes I needed to make, if you are interested. (I can't see an obvious place to submit the patch). But obviously you might know how better to fix it.
Regards
James
- Code: Select all
packages/dCustomJoints/CustomHingeActuator.cpp | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/packages/dCustomJoints/CustomHingeActuator.cpp b/packages/dCustomJoints/CustomHingeActuator.cpp
index 7a141e6..6c08750 100644
--- a/packages/dCustomJoints/CustomHingeActuator.cpp
+++ b/packages/dCustomJoints/CustomHingeActuator.cpp
@@ -135,9 +135,10 @@ void CustomHingeActuator::SubmitConstraintsFreeDof (dFloat timestep, const dMatr
dFloat relAngle = jointangle - m_angle;
NewtonUserJointAddAngularRow (m_joint, relAngle, &matrix0.m_front[0]);
- dFloat step = m_angularRate * timestep;
- if (dAbs (relAngle) > 2.0f * dAbs (step)) {
- dFloat desiredSpeed = -dSign(relAngle) * m_angularRate;
+ {
+ //dFloat desiredSpeed = -dSign(relAngle) * m_angularRate;
+ dFloat errorFactor = 0.2f;
+ dFloat desiredSpeed = -dSign(relAngle) * dMin(m_angularRate,errorFactor*dAbs(relAngle)/timestep);
dFloat currentSpeed = GetJointOmega ();
dFloat accel = (desiredSpeed - currentSpeed) / timestep;
NewtonUserJointSetRowAcceleration (m_joint, accel);