Converting from ODE to Bullet

joshua
Posts: 2
Joined: Wed Mar 27, 2013 9:46 pm

Converting from ODE to Bullet

Post by joshua »

Hi,

I'm trying to adapt my simulation from ODE to Bullet. The two videos here demonstrate my problem:

http://videobin.org/+6hg/7hf.html
http://videobin.org/+6hf/7he.html

I tried different approaches to implement a HingeConstraint. The bullet video was done with the following code, that uses the 6DOF constraint:

http://pastebin.com/gQ59srfs

My best guess is that I messed up the constraint specification, but I just don't understand where. Any help is highly appreciated.
allsey87
Posts: 33
Joined: Fri Oct 26, 2012 1:50 pm

Re: Converting from ODE to Bullet

Post by allsey87 »

The best way to learn the code for working with constraints is to play around with the Demos to see how changes influence the outcome.

In general, I normally use the simple btHingeConstraint (not the one from 6DOF). This requires that you specify a point in each body and an axis to rotate about. For the axis I always use a unit vector, although I'm not sure if this is necessary. Lastly the axes and points that you specify must always be with respect to the internal coordinate system of the relevant rigid body, so forget about any rotation or translation that you have done, and remember that point A is a point in the coordinate system of rigid body A.
joshua
Posts: 2
Joined: Wed Mar 27, 2013 9:46 pm

Re: Converting from ODE to Bullet

Post by joshua »

Thanks for the reply. I tried it with the btHingeConstraint, and then found some doc that suggested to use the btSliderConstraint instead. I don't remember the reason. So I also tried that. Then I tried the 6DOF joint, which I favour, because I can then use different joint types (hinge, slider, 6dof) and use the same type of parameters for all of them. Needless to say, that in all three cases I had similar behaviour, and it should not really matter which joint type I use, as long as my code is correct, I suppose.

I looked at the constraint demo, I also have a toy world example with 2 boxes and a hinge joint (implemented by the same code) that works. As soon as it get's a bit more complicated, my implementation fails in the way the video demonstrates. The problem with the demo is, that the hinge examples are very simple.

I am not sure, if it is the solver, the friction or the joint implementation. my best guess is the latter.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Converting from ODE to Bullet

Post by Erwin Coumans »

Can you create a reproduction case by modifying the Bullet/Demos/ConstraintDemo and submit an issue in the tracked at http://bullet.googlecode.com
It will also help if you attach a working ODE test case, so we can compare the results.

Thanks,
Erwin