Getting started btMultiBody

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

Getting started btMultiBody

Post by ghost_pickle »

Hi! I'm trying to get a start using btMultiBody, however I can't find any good resources/examples on to effectively use them. The bullet examples are rather similar, just creating chains or pendulums. The API pages are not very useful either, with many functions and classes not having even a single sentence description. The Manuel references that documentation would be added soon, but it seems its been a while. (Is there a rough draft for this, even that would be useful). I've messed around with some of the examples, getting a feel of how they work, but there seems to be a lot of undocumented features that I don't fully understand. Does anyone have any more advanced examples of multibodies? If you've worked on them before, maybe you could share how you started using them yourself. Any help would be great!
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Getting started btMultiBody

Post by Erwin Coumans »

Try using pybullet, it has excellent support for btMultiBody through URDF, SDF and MJCF import, and it is documented here:
https://docs.google.com/document/d/10sX ... hxVUA/edit

The conversion from URDF to btMultiBody is around
https://github.com/erwincoumans/bullet3 ... t.cpp#L174
That conversion code also lets you compare the construction of a btMultiBody versus btRigidBody+btTypedConstraint.
ghost_pickle
Posts: 6
Joined: Mon Jan 16, 2017 11:38 pm

Re: Getting started btMultiBody

Post by ghost_pickle »

Thanks! Because my final goal is to use a genetic algorithm, I'm stuck using C++ for maximum speed. I've been going through the examples more, and I've began get a better understanding. Right now I'm trying to replicate the RagDoll example using btMultiBody. Some thing I still don't fully understand the Spherical link creation setup. The fields I don't understand are the parentComToThisPivotOffset,thisPivotToThisComOffset. I have no idea what Com is referring to, nor what these vectors are used for. Could you perhaps expand on what these terms should be? I am very clueless to the term "Com".


setupSpherical (int linkIndex, btScalar mass, const btVector3 &inertia, int parent, const btQuaternion &rotParentToThis, const btVector3 &parentComToThisPivotOffset, const btVector3 &thisPivotToThisComOffset, bool disableParentCollision=false)
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Getting started btMultiBody

Post by Erwin Coumans »

pybullet is written on top of a new C-API, which is the way forward for Bullet: there will be a GPU backend behind the same API (either through C++ or python), and a lot of our deep learning for robotics is using this API. It has URDF and SDF loading, so you don't need to worry about the nitty gritty details.

parentComToThisPivotOffset is the pivot (translation) from parent body center of mass (COM) to the constraint frame.
thisPivotToThisComOffset is the pivot from child center of mass to the constraint frame.

There are a lot of complicated concepts in btMultiBody that are much easier when you first get the things to work in pybullet using URDF, SDF or MJCF files. You can also save .bullet from that API, which can be read from C++.
So I suggest you still consider reading the pybullet manual and see how the underlying pybullet.c calls that shared memory API.
benelot
Posts: 350
Joined: Sat Jul 04, 2015 10:33 am
Location: Bern, Switzerland
Contact:

Re: Getting started btMultiBody

Post by benelot »

The main problem will be with pybullet in case he wants to evolve the morphology of the physical objects. Since pybullet can not yet programmatically create physics objects as the Bullet 2.x can, such an experiment can not be setup in pybullet. I faced the same problem when experimenting with pybullet for another evolutionary algorithms example in the Bullet Browser.
ghost_pickle
Posts: 6
Joined: Mon Jan 16, 2017 11:38 pm

Re: Getting started btMultiBody

Post by ghost_pickle »

Correct! I need to create Multibodies directly programmatically. But using the URDF to btMultiBody to understand is a good idea. Outside of loops, is there anything that cannot be described as a MultiBody that can be described as a Rigid-bodies and constraints? 6DOF Constraints can be used to describe all sorts of joints, but I don't see a equivalent for btMultiBody.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Getting started btMultiBody

Post by Erwin Coumans »

pybullet can not yet programmatically create physics objects
I'll add this soon. Until then, you should be able to save URDF file of evolved creations to disk, and load them in pybullet.
cannot be described as a MultiBody that can be described as a Rigid-bodies and constraints
There are some constraints for btMultiBody and btMultiBodyFixedConstraint lets you connect btMultiBody links to btRigidBody (or another btMultiBody). This lets you apply the btGeneric6DofSpringConstraint between the rigid bodies.
Sida
Posts: 1
Joined: Tue Aug 11, 2020 6:36 pm

Re: Getting started btMultiBody

Post by Sida »

Looking forward to it!
Erwin Coumans wrote: Thu Jan 26, 2017 4:15 pm
pybullet can not yet programmatically create physics objects
I'll add this soon. Until then, you should be able to save URDF file of evolved creations to disk, and load them in pybullet.
Post Reply