NewtonBallGetJointAngle - how is this done?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

NewtonBallGetJointAngle - how is this done?

Postby mandy » Mon Feb 06, 2012 6:54 pm

Hey all,

I noticed this function (NewtonBallGetJointAngle) in the api, and I would like to do something exactly the same with my custom ball and socket joint. Would anyone care to show how to implement something like this?
mandy
 
Posts: 7
Joined: Sun Feb 05, 2012 10:26 pm

Re: NewtonBallGetJointAngle - how is this done?

Postby Julio Jerez » Tue Feb 07, 2012 12:27 am

what are you doing?
Julio Jerez
Moderator
Moderator
 
Posts: 12452
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonBallGetJointAngle - how is this done?

Postby mandy » Tue Feb 07, 2012 5:08 am

Hi,

I am trying to figure out the current angles of a joint on each axis.
mandy
 
Posts: 7
Joined: Sun Feb 05, 2012 10:26 pm

Re: NewtonBallGetJointAngle - how is this done?

Postby Julio Jerez » Tue Feb 07, 2012 7:29 am

The angule of a joint can be determine by projecting the definition axis,
for example on a hinge the angle is calcultether liek this

form teh code
Code: Select all
   // the joint angle can be determine by getting the angle between any two non parallel vectors
   dFloat angle;
   dFloat sinAngle;
   dFloat cosAngle;
   sinAngle = (matrix0.m_up * matrix1.m_up) % matrix0.m_front;
   cosAngle = matrix0.m_up % matrix1.m_up;
   angle = m_curJointAngle.CalculateJointAngle (cosAngle, sinAngle);



su if you wna to control a hinge all you need to do is subclass tha hinge and oveload the submitcontraol function.
the after you call eh base call funtion you can adda noteh angular row to control the joint angle.
you can do the same fo universal,

Ball and socke are more difficult because teh thre euler angle are no indenedent, but you can calculate the angle that aligne teh tow matroces and usin that as one row.
follow but tow perpedicul roiw for stability.
look at the CustomKinematicController.cpp code to see how you can make a joint aligne to a desired oriention, also teh raddoll jpoin des this.
Julio Jerez
Moderator
Moderator
 
Posts: 12452
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 118 guests

cron