NewtonHingeGetJointForce implementation missing

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

NewtonHingeGetJointForce implementation missing

Postby Lax » Thu Mar 01, 2018 5:53 pm

Hi,

in the newest newton implementation the implementation for the function:

NEWTON_API void NewtonHingeGetJointForce (const NewtonJoint* const hinge, dFloat* const force);

is missing.

Regards
Lax
Please support SecondEarthTechnicBase built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd17-5ff5-40a0-ac6f-44b97b79be62
Image
Lax
 
Posts: 165
Joined: Sat Jan 08, 2011 8:24 am

Re: NewtonHingeGetJointForce implementation missing

Postby Julio Jerez » Fri Mar 02, 2018 1:50 am

why don't you use the dCustomHinge is much better.

also did you get the NewtonMesh or any other method to draw the collision, that you were asking on the other thread?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonHingeGetJointForce implementation missing

Postby Lax » Fri Mar 02, 2018 9:42 am

Hi,

ok, I will use that functions.

I could not answer the other threads yet, because of lack of time.
I try to answer it over the weekend.

Regards
Lax
Please support SecondEarthTechnicBase built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd17-5ff5-40a0-ac6f-44b97b79be62
Image
Lax
 
Posts: 165
Joined: Sat Jan 08, 2011 8:24 am

Re: NewtonHingeGetJointForce implementation missing

Postby Lax » Fri Mar 02, 2018 5:20 pm

Hi,

I looked into the code, there is no GetForce function for dCustomHinge. But there are joint force functions like:
NewtonSliderGetJointForce
NewtonBallGetJointForce

But only the NewtonHingeGetJointForce has no implementation.

Regards
Lax
Please support SecondEarthTechnicBase built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd17-5ff5-40a0-ac6f-44b97b79be62
Image
Lax
 
Posts: 165
Joined: Sat Jan 08, 2011 8:24 am

Re: NewtonHingeGetJointForce implementation missing

Postby Julio Jerez » Fri Mar 02, 2018 5:59 pm

the function that return the joint force is part of the custom user joint.
I have no added all the functionality but is easy to get it, if you look at file
../sdk\dCustomJoints\dCustomVehicleControllerManager.h line 174
there is an example of how to use it. it is what the engine use for vehicles.

Code: Select all
class dWheelJoint: public dCustomJoint
{
   public:
//...
//...

   dFloat GetTireLoad() const
   {
      return NewtonUserJointGetRowForce(m_joint, 4);
   }
// ...


baascially you cna subclass you joint form a hinge and you cna add tha function.
I am assuming you are doing this for destruction.
the reason I did not added that to the base class, is that the return value could be a force or a torque
base of on if the axis was a linra row of an angular row.

do you want such functionality as part of the base class. dCustomJoint ?
if so would you like it to return the magnitude or maybe the vector force and torque,
basically a six dimension vector that contain force and the torque.

please let me know. The engine has an enormous set of functionality and I can only do what make sense to me.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonHingeGetJointForce implementation missing

Postby Lax » Tue Mar 06, 2018 6:02 am

Hi,

thanks for the response.
do you want such functionality as part of the base class. dCustomJoint ?
if so would you like it to return the magnitude or maybe the vector force and torque,
basically a six dimension vector that contain force and the torque.


Two functions getForce(), getTorque() as vector would be great! That would be the most flexible way, as the The magnitude can be calculated out of the vectors.

Because, how do you know which row is the correct one? Is there a pattern, you wrote row 4 would be the force of a hinge, but is row 4 for ballAndSocket also its force?

Regards
Lax
Please support SecondEarthTechnicBase built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd17-5ff5-40a0-ac6f-44b97b79be62
Image
Lax
 
Posts: 165
Joined: Sat Jan 08, 2011 8:24 am

Re: NewtonHingeGetJointForce implementation missing

Postby Julio Jerez » Tue Mar 06, 2018 11:32 am

of they ate part of the dCustom joint
../newton-dynamics\sdk\dCustomJoints\dCustomJoint.h
Code: Select all
   const dVector& GetForce0() const {return m_force0;}
   const dVector& GetForce1() const {return m_force0;}
   const dVector& GetTorque0() const {return m_force0;}
   const dVector& GetTorque1() const {return m_force0;}


they are the force asserted on the tow bodies liken by the foint
in general force0 == - force1
but almost always torque0 != toqrue1

Later that will be an option, because is expensive to do it for all joints, It is already heavy on memory because if for vector to each joint even if the far is not needed, which is why getting the force row is more compact, but you are correct is hard to identify what of what. a force can be a torque, is just a scaler for the jacobian.

anyway tell me if this is ok? I did not tested.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonHingeGetJointForce implementation missing

Postby Julio Jerez » Tue Mar 06, 2018 4:33 pm

ok I now made optional,
when you make the joint you nee to call function joint0>SetJointForceCalculation(true);
to active that calculation in each update, otherwise it will be doing all that work that is never used.

Code: Select all
   CUSTOM_JOINTS_API void SetJointForceCalculation(bool mode);
   CUSTOM_JOINTS_API const dVector& GetForce0() const;
   CUSTOM_JOINTS_API const dVector& GetForce1() const;
   CUSTOM_JOINTS_API const dVector& GetTorque0() const;
   CUSTOM_JOINTS_API const dVector& GetTorque1() const;


the cool part is that all joints now has the funtionality available
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonHingeGetJointForce implementation missing

Postby Lax » Thu Mar 08, 2018 8:09 am

Hi Julio,

ok, thanks for your efford. I will try I out as soon when I'm no more sick.

Regards
Lax
Please support SecondEarthTechnicBase built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd17-5ff5-40a0-ac6f-44b97b79be62
Image
Lax
 
Posts: 165
Joined: Sat Jan 08, 2011 8:24 am

Re: NewtonHingeGetJointForce implementation missing

Postby Lax » Thu Mar 15, 2018 5:23 pm

Hi,

your new methods seem to work correctly! Thanks again.

Regards
Lax
Please support SecondEarthTechnicBase built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd17-5ff5-40a0-ac6f-44b97b79be62
Image
Lax
 
Posts: 165
Joined: Sat Jan 08, 2011 8:24 am


Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 6 guests

cron