Hinge actuator tweak for disabled limits

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Hinge actuator tweak for disabled limits

Postby pHySiQuE » Sat Sep 07, 2013 2:22 pm

This will give a little better consistency. It just ignores the max angles if limits aren't enabled:
Code: Select all
void CustomHingeActuator::SetTargetAngle(dFloat angle)
{
   if (m_limitsOn)
   {
      m_angle = dClamp (angle, m_minAngle, m_maxAngle);
   }
   else
   {
      m_angle = angle;
   }
}
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Hinge actuator tweak for disabled limits

Postby Julio Jerez » Sat Sep 07, 2013 2:37 pm

no that would not be right, you can not set limits to an actuator, because the same row the control the limit also control eh joint angle.
the actuator is subclasses for a joint, but they disable the limit.
if the is a bug that would be that the function set limit should be overloaded by the actuator so that the limit can no be enable on the hinge base class

if you set limit on a hinge and the hinge is an actuator, change are that when one wing touch the limit hard, it will explode in release mode.
it will assert in debug because it will pass the max number of \restricted Degree of freedom.

limitsOn should always be false for an actuator
and the code should just do
m_angle = dClamp (angle, m_minAngle, m_maxAngle);

I believe you can play with m_minAngle, m_maxAngle to set limits.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Hinge actuator tweak for disabled limits

Postby pHySiQuE » Sat Sep 07, 2013 6:02 pm

Yes, I found that out the hard way.

You also want the joint to be able to not use limits, so I got rid of the internal clamp and added my own in my Joint class.
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron