- Code: Select all
if(m_motorOn)
{
dFloat relAngle;
relAngle = m_curJointAngle - m_motorAngle;
m_motorAngle += jointData->Torque *-.1 * 3.1416f / 180.0f;
NewtonUserJointAddAngularRow (m_joint, relAngle, &matrix0.m_front[0]);
NewtonUserJointSetRowStiffness (m_joint, 1.0f);
m_force = NewtonUserJointGetRowForce(m_joint,5);
}
I know that there should be a better way, but I just have not been able to figure it out. I've looked all over the google cache of these forums, and found that other people are doing something like this:
- Code: Select all
float actualOmega = NewtonHingeGetJointOmega (hinge);
float desiredOmega = 5.0f;
...
desc->m_accel = m_accelConst * (desiredOmega - actualOmega) / desc->m_timestep;
But, even if I switch to regular hinges, the gravity of the arm pieces always overcomes the acceleration on the joint.... I can get around this without simulating gravity, but I really need the weight of the arm to cause the robot to fall over at certain angles...
Anyone have any thoughts on this?