Question about NewtonUserJointSetRowAcceleration

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Question about NewtonUserJointSetRowAcceleration

Postby rchadwic » Tue Sep 09, 2008 5:46 pm

So, I'm simulating a robot with an arm made of 6 joints. I'm using the custom hinge to force those joints to a particular angle to simulate the motors. The problem is that the motors sort of have infinite force, which makes sense, since the engine is driving the joint to that angle with a row. It looks like this

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?
rchadwic
 
Posts: 1
Joined: Wed May 24, 2006 3:18 pm

Re: Question about NewtonUserJointSetRowAcceleration

Postby DarthGak » Tue Sep 09, 2008 10:32 pm

Add a call to

NewtonUserJointSetRowSpringDamperAcceleration(m_joint,springStiff,springDamp);

after the call to set row stiffness. Depending on the size of the objects values like 30 stiff and 20 damp will make a strong slow motor. Higher damp to make it go slower. Higher stiff to make it stronger.
DarthGak
 
Posts: 25
Joined: Sat Nov 25, 2006 4:55 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 18 guests

cron