Is CustomHingeActuator now merged into CustomHinge?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Is CustomHingeActuator now merged into CustomHinge?

Postby JoshKlint » Sat Mar 02, 2019 6:11 pm

It appears the custom hinge and slider now have motor behavior built into the base class. Are the hinge and slider actuator classes now redundant?

Code: Select all
   if (m_options.m_option2) {
      // the joint is motor
      dFloat accel = (m_motorSpeed - m_jointOmega) / timestep;
      NewtonUserJointAddAngularRow(m_joint, 0.0f, &matrix0.m_front[0]);
      NewtonUserJointSetRowAcceleration(m_joint, accel);
      NewtonUserJointSetRowStiffness(m_joint, m_stiffness);
      NewtonUserJointSetRowMinimumFriction(m_joint, -m_friction);
      NewtonUserJointSetRowMaximumFriction(m_joint, m_friction);
   } else {
      // the joint is not motor
      if (m_options.m_option0) {
         if (m_options.m_option1) {
            SubmitConstraintLimitSpringDamper(matrix0, matrix1, timestep);
         } else {
            SubmitConstraintLimits(matrix0, matrix1, timestep);
         }
      } else if (m_options.m_option1) {
         SubmitConstraintSpringDamper(matrix0, matrix1, timestep);
      } else if (m_friction != 0.0f) {
         NewtonUserJointAddAngularRow(m_joint, 0, &matrix0.m_front[0]);
         NewtonUserJointSetRowStiffness(m_joint, m_stiffness);
         NewtonUserJointSetRowAcceleration(m_joint, -m_jointOmega / timestep);
         NewtonUserJointSetRowMinimumFriction(m_joint, -m_friction);
         NewtonUserJointSetRowMaximumFriction(m_joint, m_friction);
      }
   }
JoshKlint
 
Posts: 74
Joined: Sun Dec 10, 2017 8:03 pm

Re: Is CustomHingeActuator now merged into CustomHinge?

Postby Julio Jerez » Sun Mar 03, 2019 7:02 am

Those are two different thing.
A hinge motor is simply a mother that rotate at a constant angular velocity, like a fan, or a blender etc.
A hinge actuator is a him he that use a motor to reach a desire position at a constant velocity and stop.

At least that is the idea.

I wan in the last demo that you were using hinge actuator and seeing the as motor, and that was a mistake because add a redundant did.

It should produce an assert, but have the commented out, it worked because the last two is ignored but if it happens that was the last joint it would crack with a memory overrun.

I hinge actuator, override the base class hinge options because it does almost all combined
Julio Jerez
Moderator
Moderator
 
Posts: 10954
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Is CustomHingeActuator now merged into CustomHinge?

Postby JoshKlint » Sun Mar 03, 2019 1:29 pm

Okay, for my own notes, here are my changes:

dCustomHingeActuator.cpp
Code: Select all
void dCustomHingeActuator::SubmitAngularRow(const dMatrix& matrix0, const dMatrix& matrix1, const dVector& eulers, dFloat timestep)
{
   if (m_maxTorque <= 0.0f) return dCustomHinge::SubmitAngularRow(matrix0, matrix1, eulers, timestep); // add this line


dCustomSliderActuator.cpp
Code: Select all
void dCustomSliderActuator::SubmitAngularRow(const dMatrix& matrix0, const dMatrix& matrix1, dFloat timestep)
{
   dCustomSlider::SubmitAngularRow(matrix0, matrix1, timestep);
   if (m_maxForce <= 0.0f) return; // add this line


I know you recommend adding another joint class, but this is easier for me.
JoshKlint
 
Posts: 74
Joined: Sun Dec 10, 2017 8:03 pm


Return to General Discussion

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 4 guests