raAFrame,rbBFrame in btHingeConstraint ?

Post Reply
Kirity
Posts: 7
Joined: Wed May 13, 2015 10:57 am

raAFrame,rbBFrame in btHingeConstraint ?

Post by Kirity »

Hello,
I am not able to understand how does parameters in raAFrame,rbBFrame are used in creating the btHingeConstraint.
btHingeConstraint(btRigidBody& rbA,
btRigidBody& rbB,
const btTransform& rbAFrame,
const btTransform& rbBFrame,
bool useReferenceFrameA = false)

Especially I am struck with understanding of "raAFrame.getBasis().setEulerZYX(XX , XX, XX) "

Also the name is showing as "setEulerZYX()" but the actual code is taking it as "X Y Z" parameters - This is also confusing.

What does setting the Euler's angles means in the context of rigidBody,btTransform and btHingeConstraint ??

To be precise I am refering to ForkLiftDemo example.

Any help is much appreciated.
Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

Re: raAFrame,rbBFrame in btHingeConstraint ?

Post by Basroil »

Constraints are defined by local axis locations rather than world definitions when using those frames, so a pair with world coordinates of 0,0,0 and 2,0,0 and joint directly in the center will have local coordinates of 1,0,0 and -1,0,0. Since a hinge is defined with rotation in positive Z axis direction, the joint orientation needs to also match that. Changing frames lets you make joints with initial angle values if you define a rotation about Z for one of the two. Take a look at ODE's documentation for a bit more in-depth explanation on the subject of joint constraints.

As for EulerZYX taking X,Y,Z, yes, it's confusing as hell and the source of plenty of bugs! :(
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: raAFrame,rbBFrame in btHingeConstraint ?

Post by Erwin Coumans »

A btTypedConstraint attaches two bodies, body A and body B. The attachment frame is expressed in local coordinate of each body, hence the name rbAframe and rbBframe.
Basroil wrote: As for EulerZYX taking X,Y,Z, yes, it's confusing as hell and the source of plenty of bugs! :(
It is best to avoid any Euler APIs in Bullet, just use a btQuaternion or a btMatrix3x3 directly.

If your application uses Euler angles, convert them yourself to a quaternion or 3x3 matrix and pass that to Bullet.

I should never have introduced or accepted patches to add the option for Euler angle conversion in Bullet,
it is better to only use quaternion and matrices. It is probably best to remove all Euler parts from the API in a future update.
Kirity
Posts: 7
Joined: Wed May 13, 2015 10:57 am

Re: raAFrame,rbBFrame in btHingeConstraint ?

Post by Kirity »

Thanks much for your explanation and reply !!!!

Now i am struct at a problem. I did success in simulating a sliderConstraint by reading values from another application.

Now the situation is - I will get slider joint movements in terms of distance moved, i.e. in millimeters.

Am not able find a solution.

Can you give your thoughts and possible solutions for do this.

Best Regards
Post Reply