simple actuator?

Post Reply
dikobraz
Posts: 8
Joined: Thu Feb 19, 2009 3:01 pm

simple actuator?

Post by dikobraz »

Hi everyone!

I use btRotationalLimitMotor for simulating simple actuator exerting specified torque on attached bodies.

Code: Select all

void BulletRotationalServoMotor::setTargetForce(float targetForce_) 
{
    targetForce             = targetForce_;
    motor->m_maxMotorForce  = fabs(targetForce);
    motor->m_enableMotor    = motor->m_maxMotorForce > 0.01f;
    if (motor->m_enableMotor) {
        motor->m_targetVelocity = targetForce / motor->m_maxMotorForce * btScalar(BT_LARGE_FLOAT);
    }
}
I tried to implement gravity compensation using Jacobian Transpose method, but noticed that exerting torques are too large. E.g. in the following scene setting target force for motor between cones to "T = m * cross(motor->getAxis(), upperCone->getCOMPosition() - constraint->getPosition())" leads to oscillation around equilibrium configuration. Even when I decrease torque 10 times behaviour is the same.

Image

Is there a better way to implement servo motor? Does the btRotationalLimitMotor use units other than N·m?
dikobraz
Posts: 8
Joined: Thu Feb 19, 2009 3:01 pm

Re: simple actuator?

Post by dikobraz »

Anyway, this solution helped me to implement actuator which applies exact torque(or almost exact):

Code: Select all

btVector3 torque = constraint->getAxis(axis) * targetTorque;
constraint->getRigidBodyA().applyTorque( torque);
constraint->getRigidBodyB().applyTorque(-torque);
Post Reply