btMultibody setup Joint Parameters

Post Reply
ghost_pickle
Posts: 6
Joined: Mon Jan 16, 2017 11:38 pm

btMultibody setup Joint Parameters

Post by ghost_pickle »

I'm trying to figure out the meaning of the input parameters for setupJoints methods for multibodies, specifically the ones like

Code: Select all

parentComToThisPivotOffset
( defined as vector from parent COM to joint axis, in PARENT frame),

Code: Select all

thisPivotToThisComOffset
( defined as vector from joint axis to my COM, in MY frame).

I know that COM means center of mass, but I'm not 100% sure how to get the center of mass from a given collision box (I'm guessing its the middle of the collision box?) and I'm not sure what "frame" means in this situation. I'm guessing it means frame of reference, refereeing to the local coordinates of the link's collision box compared to the "world frame". I've gone through the example code for the multibodies, and I see how they are calculated, but I have no idea why are calculated the way they are. Any help would be great! Thanks!
benelot
Posts: 350
Joined: Sat Jul 04, 2015 10:33 am
Location: Bern, Switzerland
Contact:

Re: btMultibody setup Joint Parameters

Post by benelot »

To set up the joint correctly, you need to define where the joint axis should be placed with reference to your links. Therefore you need to define those two vectors. Usually if is easier to define them in world frame or in a frame of reference of your choice, depending on where they are most intuitive. For example if you know your links are 4 units apart in X axis and you want your joint axis to be exactly between them, it might be most intuitive in the reference frames of the links, on the other hand, if you have a situation where world frame is easier, then you define those vectors and transform them into the frame of reference in which they have to be. The frame of reference helper I built for one of my examples might be helpful to understand the maths:

https://github.com/bulletphysics/bullet ... Helper.hpp

The same stuff is done in many examples, but usually just written in their explicit way without comment, so it can be hard to understand what is done and why. If you really want to understand why the multiplication of a point and the inverse of the center of mass transform leads to a reference frame switch, then you need to go into the vector mathematics of what is done. Maybe it helps already!
ghost_pickle
Posts: 6
Joined: Mon Jan 16, 2017 11:38 pm

Re: btMultibody setup Joint Parameters

Post by ghost_pickle »

Ah that makes much more sense. Going through some example code again, it makes more sense what they were doing. I think the issue was that the example code is able to make assumptions since for the most part, every link is the same size and are being linked one after another. Unlike rigidbodies and constraints, it looks like joints are created before the collision boxes of the connection, which was a main source of confusion for me, since their's no getCenterOfMassPosition call being made anywhere, since it looks like their calculating it themselves. I'm assuming the center of mass for a primitive object is always its center, which I am also assuming is its position, so in its local frame, that should be (0,0,0) and in the world frame it would be its position.
benelot
Posts: 350
Joined: Sat Jul 04, 2015 10:33 am
Location: Bern, Switzerland
Contact:

Re: btMultibody setup Joint Parameters

Post by benelot »

Yes, multibodies are totally independen tof the collision boxes. They are not even necessary for it to work. You build up a structure of joints by providing how they are positioned in the local space and so the positions of your links are defined. If you then add your link collider, their centers of mass will be placed where the multibody defines it to be from your provided vectors.
Post Reply