[ODE] outputting objects

Nate W coding at natew.com
Mon Feb 3 18:12:02 2003


On Mon, 3 Feb 2003, w Wei wrote:

>    Thanks to Martin and Nate, I figured out how to create objects in
> ODE.  Now I have another question:  How difficult would it be to
> output these objects (dworld, dspace, dbody, dgeom...) and maintain
> the connection between them?  Perhaps to a file?  And read them back
> through another program to simulate it?  

No more (and no less) difficult than writing out any data structure.  
This ties in with the file format discussion that comes and goes here
periodically.  (Which reminds me, I kinda dropped the ball on that.)

Once you decide on a file format, writing stuff out is pretty trivial.  
Reading stuff in is less trivial, but still not rocket science.  If you've
written code for other projects that loads and saves files, there's
nothing particularly special about ODE.  If you haven't done file IO
before, you have a learning curve ahead of you that has nothing to do with
ODE.

The trickiest thing (IMO) is making sure that the right bodies are
connected by the right joints after you load a file.  In Juice, I assign
each object a unique ID as you write things to disk (I just used the
"this" pointer), and have the joints write out the IDs of the objects they
connect.  As a joint gets reloaded, traverse the list of bodies, look for
the ones that had the IDs the joint refers to, and make the necessary ODE
call to connect them.

> Thus creating an "client/server" architechture.  The hope is to
> distribute a "simulator" program on multiple machines that take in
> objects/models.  Any suggestions would be great

Collision detection can be an issue with distributed simulation.  How will
you test for contacts between objects that exist in the same virtual
environment but on different "simulation servers?"

-- 

Nate Waddoups
Redmond WA USA
http://www.natew.com