Manual (Install and Use)

From ODE Wiki

Jump to: navigation, search
image:ODETutorial.png
This article is part
of the ODE Manual
Chapters ...

Introduction
Installing and Using ODE
Concepts
Data Types and Conventions
World
Rigid Body Functions
Joint Types and Functions
StepFast
Support Functions
Collision Detection

Contents

Getting Started

The latest "stable" release is available at the SourceForge.net file list. At the time of this writing, two packages are available: a build-it-yourself source code package and a prebuilt Windows binary package. For developers, a Subversion repository provides access to the development version of the library.

The prebuilt Windows binary package uses single-precision math and includes support for trimesh collision shapes. This package also includes the header files and linker import libraries -- everything you need to get started right away. If you choose to use these prebuilt binaries you can jump ahead to "Using ODE", below.

If you have any questions, there is a very helpful mailing list. If you plan on using ODE you should definitely sign up. The list is fairly low traffic, high signal-to-noise, and extremely useful.

Getting the Source Code (Subversion)

If you downloaded the source code package from SourceForge, you can skip ahead to the next section.

The latest development version of the source code is stored in a Subversion repository on SourceForge. The usual disclaimers for in-development code apply.

If you are unfamiliar with Subversion you can get up to speed by reading the OpenDE Subversion page. Once you have your Subversion client installed and ready to go you can get the latest version of ODE from the https://svn.sourceforge.net/svnroot/opende/trunk url. In summary, it comes down to executing the svn command:

  $ svn co https://opende.svn.sourceforge.net/svnroot/opende/trunk opende

This command will create a directory called opende in your current working directory. To update it at a later time, simply execute this command in the opende/ directory:

  $ svn update

If you use TortoiseSVN, create an opende/ directory, go there, right-click and select 'SVN Checkout'. Then use this URL and click OK:

  $ https://opende.svn.sourceforge.net/svnroot/opende/trunk

Building ODE

Before you start, you should know that there are two parts to ODE. There is "ODE", which is the physics and collision detection library. Then there is "DrawStuff", a simple wrapper over Win32/X11 and OpenGL which is used for the demo applications. This often causes confusion: DrawStuff is a simple library written only to display the ODE demos and is not intended to be used in your own projects. DrawStuff requires OpenGL, ODE does not. You do not have to build DrawStuff or the demo applications in order to use ODE.


How To Build ODE With Visual Studio (2002 and up)

If you downloaded the source code from Subversion, copy the default configuration file `ode/build/config-default.h` to `ode/include/ode/config.h`. If you are using the stable source code package, this step has already been done for you.

The directory `ode/build` contains project files for all recent versions of Visual Studio. Locate the correct directory for your version of Visual Studio, open, and build. By default, the project files will use single-precision math. To switch to double-precision, edit `ode/include/ode/config.h` and replace `#define dSINGLE 1` with `#define dDOUBLE 1` and rebuild.

Note that Visual Studio 6 is no longer supported; please upgrade to Visual Studio 2005 C++ Express (it's free!).

How To Build ODE With Code::Blocks

Because Code::Blocks supports so many different platforms, we do not provide workspaces. Instead, use Premake to create a workspace tailored for your platform and project.

Download Premake and place it on your system path (or anywhere convenient). Then create a workspace like so:

  $ cd ode/build
  $ premake --with-tests --target cb-gcc

To see a complete list of options:

  $ cd ode/build
  $ premake --help

How To Build ODE With MingW and MSYS

First, make sure the ODE source tree is visible to MSYS (Generally, this means putting it in the "C:\MSYS\1.0\home" directory). If you intend to put the sources inside of your username directory and it is more than eight characters long, it will break the build! In my case "C:\MSYS\1.0\home\Caleb Gray\ode-0.9" did not work, I had to do the following:

Inside of MSYS:

 $ cd /home/CalebG~1/ode-0.9

For those of you that used DOS, this will make sense right away. For those that haven't, DOS was limited to eight character long filenames so what I've done is truncate "Caleb Gray" to eight characters with the "CalebG~1" ... Should you have two usernames that are similar and you want to keep both of them, you may have to use "CalebG~2" or "CalebG~3" depending. I hope this makes sense and helps someone.

Once inside of the ODE sources, execute the following commands:

 $ sh autogen.sh
 $ ./configure --enable-shared
 $ make

If, after executing autogen.sh, you receive an error about aclocal (and/or other tools) it likely means you haven't installed msysDTK.

On build, you may receive the error (this is currently a bug created during the autogen stage):

 make[2]: Entering directory `/C/ode-svn/ode/src'
 Makefile:51: *** commands commence before first target.  Stop.
 make[2]: Leaving directory `/C/ode-svn/ode/src'
 make[1]: *** [all-recursive] Error 1

Correct this by opening the ode\src\Makefile and scrolling down about a page to these lines (am__append_17 may be a different number depending on the work that's been done to ODE):

 am__append_17 = collision_trimesh_trimesh.cpp 
 			collision_trimesh_sphere.cpp 
 			collision_trimesh_ray.cpp 
 			collision_trimesh.cpp 
 			collision_trimesh_box.cpp 
 			collision_trimesh_ccylinder.cpp 
 			collision_trimesh_distance.cpp 
 			collision_trimesh_internal.h 
                         collision_cylinder_trimesh.cpp 
                         collision_trimesh_plane.cpp

And adding a backslash (\) at the end of every line except the last one, like this:

 am__append_17 = collision_trimesh_trimesh.cpp \
 			collision_trimesh_sphere.cpp \
 			collision_trimesh_ray.cpp \
 			collision_trimesh.cpp \
 			collision_trimesh_box.cpp \
 			collision_trimesh_ccylinder.cpp \
 			collision_trimesh_distance.cpp \
 			collision_trimesh_internal.h \
                         collision_cylinder_trimesh.cpp \
                         collision_trimesh_plane.cpp

Execute the standard build command again and it should work this time:

 $ make

This information is thanks to User:Jagot and was reformatted to help those on Google searching for the terms MingW, MSYS, and ODE.

How To Build ODE Just About Everywhere Else

If you downloaded the source code from Subversion, bootstrap autotools by running the command:

 $ sh autogen.sh

Note that you need to have a recent autotools (version 1.8.x or newer). You may see some "underquoted definition" warnings depending on your platform, these are (for now) harmless warnings regarding scripts from other m4 installed packages.

Configure the build by running the command:

 $ ./configure

By default this will build ODE with as a static library with single precision math, with trimesh support, and debug symbols enabled. You can modify this default configuration by supplying options to configure. Type the command

 $ ./configure --help

...for a full list of available options. Here are a few of the more important ones:

  • `--enable-double-precision` enables double precision math
  • `--with-trimesh=opcode` use OPCODE trimesh support
  • `--with-trimesh=gimpact` use GIMPACT trimesh support
  • `--with-trimesh=none` disable trimesh support
  • `--enable-release` creates a release build
  • `--enable-shared` creates a shared library

In addition, the options `--with-arch=` allows a particular CPU architecture to be supplied. See this page for a complete list of possible values.

Once configure has run successfully, you can build ODE with:

 $ make
 $ make install

The latter command will also create an `ode-config` script which you can use to pass cflags and ldflags to your projects. Run `ode-config` from a command prompt to find out how it works.

Building and Running ODE Tests on MacOS X

The latest revision of trunk in svn now contains native support for MacOS X, so the following is a bit outdated. So don't be scared by references to X11, chances are you don't need to worry about it.

ODE uses XWindows and OpenGL to render the scene being simulated. In order to build the example you will need to install Apple X11 server and the X11SDK (as well as the normal developer tools).

These are available from Apple. As of writing this can be found at: http://www.apple.com/macosx/x11. NOTE: there is a tiny link at the bottom right of the page for the SDK

Once the software is installed follow the normal build instructions.

Since ODE uses X11 you need to run the X11 server (which you should have installed, it's in the Applications Folder).

If you run the test app in the XTerm that the X11 server opens by default then they should run fine. If however you run them from a MacOS X Terminal then you need to define the environment variable DISPLAY. If DISPLAY is not defined then you will get a message saying: "cannot open X11 display".

For example to run the boxstack test you would type cd ode/test DISPLAY=:0.0 ./test_boxstack.exe You can define this environment variable in your shell startup scripts (for example in ~/.bashrc if you are using bash)

Using ODE

The best way to understand how to use ODE is to look at the test/example programs that come with it. Note the following things:

  • Source files that use ODE only need to include a single header file: #include <ode/ode.h> The ode directory in this statement is actually the include/ode directory of the ODE distribution. This header file will include others in the ode directory, so you need to set the include path of your compiler, e.g. in linux
     gcc -c -I /home/username/ode/include myprogram.cpp


  • When ODE is used with the dWorldStep function, heavy use is made of the stack for storing temporary values. For very large systems several megabytes of stack can be used. If you experience unexplained out-of-memory errors or data corruption, especially on Windows, try increasing the stack size, or switching to dWorldQuickStep.
Personal tools
Navigation