first commit

This commit is contained in:
2024-06-10 12:48:14 +03:00
commit d54c9805b3
1398 changed files with 739400 additions and 0 deletions

View File

@@ -0,0 +1,64 @@
1. REQUIREMENTS:
1. Python 2.4 or higher (http://www.python.org/)
- Tested with Python 2.7 (2.6 on earlier builds)
2. Cython 0.14.1** or higher (http://cython.org/)
- Tested with Cython 0.15 (0.14.1 on earlier builds)
3. ODE shared*** library (or static with -fPIC)
- See the notes on building ODE below.
4. pkg-config (http://www.freedesktop.org/wiki/Software/pkg-config)
- Windows executable (and GLib dependency) can be downloaded from
http://www.gtk.org/download/win32.php
- If you used premake to configure ODE, you may need to create an ode.pc file
in your PKG_CONFIG_PATH manually. See <ODE_DIR>/ode.pc.in
2. BUILDING ODE
On certain systems (*nix) there is a requirement that a shared library
(such as the python module) contains only position-independent code
(PIC). In those cases, ODE needs to be either compiled as a shared library
too (--enable-shared), or as a static library with PIC (-fPIC).
Once ODE is built and installed in your desired destination, proceed with
building the wrapper.
3a. BUILDING WITH Visual Studio (Windows)
python setup.py build_ext
3b. BUILDING WITH MINGW (Windows)
python setup.py build_ext -c mingw32
3c. BUILDING WITH GCC/G++ (Linux, OS X, etc.)
python setup.py build_ext
4. INSTALLATION
4a. For system-wide installation (needs administrator privileges):
python setup.py install
4b. For user installation:
python setup.py install --user
5. DEMOS and DOCUMENTATION
Try running the tutorials in the 'demos' directory. The tutorials were taken
from the PyODE website (http://pyode.sourceforge.net/).
For usage documentation, please refer to the PyODE API documentation at
http://pyode.sourceforge.net/api-1.2.0/index.html.

View File

@@ -0,0 +1,15 @@
CODE:
* (setup.py) add package information (version, authors, etc.)
* (setup.py) add 'install' action
* (setup.py) add configurable ODE DLL (currently hard-coded to default single precision)
* (ode.pxd) clean up, add more comments
* (ode.pyx) refactor for a more Pythonic implementation (e.g. replace getters and setters with
properties)?
* (?) Add option to build bindings in ODE's makefiles
DOCS:
* Update and include API docs from PyODE
* Adapt and include PyODE tutorials/demos
* Update license text in ode.pxd and ode.pyx

View File

@@ -0,0 +1,49 @@
#!/usr/bin/env python
# http://pyode.sourceforge.net/tutorials/tutorial1.html
# pyODE example 1: Getting started
# modified by Gideon Klompje (removed literals and using
# 'ode.Mass.setSphereTotal' instead of 'ode.Mass.setSphere')
import ode
# Simulation constants
GRAVITY = (0, -9.81, 0)
SPHERE_RADIUS = 0.05
SPHERE_MASS = 1.0
SPHERE_START_POS = (0, 2, 0)
SPHERE_FORCE = (0, 200, 0) # Initial force to apply to the sphere
TIME_STEP = 0.04
TIME_STOP = 2.0 # When to stop the simulation
# Create a world object
world = ode.World()
world.setGravity(GRAVITY)
# Create a spherical body inside the world
body = ode.Body(world)
mass = ode.Mass()
mass.setSphereTotal(SPHERE_MASS, SPHERE_RADIUS)
body.setMass(mass)
body.setPosition(SPHERE_START_POS)
body.addForce(SPHERE_FORCE)
# Do the simulation...
if __name__ == "__main__":
total_time = 0.0
while total_time < TIME_STOP:
# output the body's position and velocity
x, y, z = body.getPosition()
u, v, w = body.getLinearVel()
print "%1.2fsec: pos=(%6.3f, %6.3f, %6.3f) vel=(%6.3f, %6.3f, %6.3f)" % \
(total_time, x, y, z, u, v, w)
# advance the simulation
world.step(TIME_STEP)
total_time += TIME_STEP

View File

@@ -0,0 +1,135 @@
#!/usr/bin/env python
# http://pyode.sourceforge.net/tutorials/tutorial2.html
# pyODE example 2: Connecting bodies with joints
# modified by Gideon Klompje (removed literals and using
# 'ode.Mass.setSphereTotal' instead of 'ode.Mass.setSphere')
import ode
import pygame
from pygame.locals import QUIT, KEYDOWN
# Constants
WINDOW_RESOLUTION = (640, 480)
DRAW_SCALE = WINDOW_RESOLUTION[0] / 5
"""Factor to multiply physical coordinates by to obtain screen size in pixels"""
DRAW_OFFSET = (WINDOW_RESOLUTION[0] / 2, 50)
"""Screen coordinates (in pixels) that map to the physical origin (0, 0, 0)"""
BACKGROUND_COLOR = (255, 255, 255)
GRAVITY = (0, -9.81, 0)
SPHERE1_POSITION = (1, 0, 0)
SPHERE1_MASS = 1
SPHERE1_RADIUS = 0.15
SPHERE1_COLOR = (55, 0, 200)
SPHERE2_POSITION = (2, 0, 0)
SPHERE2_MASS = 1
SPHERE2_RADIUS = 0.15
SPHERE2_COLOR = (55, 0, 200)
JOINT1_ANCHOR = (0, 0, 0)
JOINT1_COLOR = (200, 0, 55)
JOINT1_WIDTH = 2
"""Width of the line (in pixels) representing the joint"""
JOINT2_ANCHOR = SPHERE1_POSITION
JOINT2_COLOR = (200, 0, 55)
JOINT2_WIDTH = 2
"""Width of the line (in pixels) representing the joint"""
TIME_STEP = 0.04
# Utility functions
def coord(x, y, integer=False):
"""
Convert world coordinates to pixel coordinates. Setting 'integer' to
True will return integer coordinates.
"""
xs = (DRAW_OFFSET[0] + DRAW_SCALE*x)
ys = (DRAW_OFFSET[1] - DRAW_SCALE*y)
if integer:
return int(round(xs)), int(round(ys))
else:
return xs, ys
# Initialize pygame
pygame.init()
# Open a display
screen = pygame.display.set_mode(WINDOW_RESOLUTION)
# Create a world object
world = ode.World()
world.setGravity(GRAVITY)
# Create two bodies
body1 = ode.Body(world)
M = ode.Mass()
M.setSphereTotal(SPHERE1_MASS, SPHERE1_RADIUS)
body1.setMass(M)
body1.setPosition(SPHERE1_POSITION)
body2 = ode.Body(world)
M = ode.Mass()
M.setSphereTotal(SPHERE2_MASS, SPHERE2_RADIUS)
body2.setMass(M)
body2.setPosition(SPHERE2_POSITION)
# Connect body1 with the static environment
j1 = ode.BallJoint(world)
j1.attach(body1, ode.environment)
j1.setAnchor(JOINT1_ANCHOR)
# Connect body2 with body1
j2 = ode.BallJoint(world)
j2.attach(body1, body2)
j2.setAnchor(JOINT2_ANCHOR)
# Simulation loop...
if __name__ == "__main__":
fps = 1.0 / TIME_STEP
clk = pygame.time.Clock()
sph1_rad = int(DRAW_SCALE * SPHERE1_RADIUS)
sph2_rad = int(DRAW_SCALE * SPHERE2_RADIUS)
loopFlag = True
while loopFlag:
for e in pygame.event.get():
if e.type==QUIT:
loopFlag=False
if e.type==KEYDOWN:
loopFlag=False
# Clear the screen
screen.fill(BACKGROUND_COLOR)
# Draw the two bodies and the lines representing the joints
x1, y1, z1 = body1.getPosition()
x2, y2, z2 = body2.getPosition()
xj1, yj1, zj1 = j1.getAnchor()
xj2, yj2, zj2 = j2.getAnchor()
pygame.draw.line(screen, JOINT1_COLOR, coord(xj1, yj1), coord(x1, y1), JOINT1_WIDTH)
pygame.draw.line(screen, JOINT2_COLOR, coord(xj2, yj2), coord(x2, y2), JOINT2_WIDTH)
pygame.draw.circle(screen, SPHERE1_COLOR, coord(x1, y1, integer=True), sph1_rad, 0)
pygame.draw.circle(screen, SPHERE2_COLOR, coord(x2, y2, integer=True), sph2_rad, 0)
pygame.display.flip()
# Next simulation step
world.step(TIME_STEP)
# Try to keep the specified framerate
clk.tick(fps)

View File

@@ -0,0 +1,284 @@
#!/usr/bin/env python
# http://pyode.sourceforge.net/tutorials/tutorial3.html
# pyODE example 3: Collision detection
# Originally by Matthias Baas.
# Updated by Pierre Gay to work without pygame or cgkit.
import sys, os, random, time
from math import *
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import ode
# geometric utility functions
def scalp (vec, scal):
vec[0] *= scal
vec[1] *= scal
vec[2] *= scal
def length (vec):
return sqrt (vec[0]**2 + vec[1]**2 + vec[2]**2)
# prepare_GL
def prepare_GL():
"""Prepare drawing.
"""
# Viewport
glViewport(0,0,640,480)
# Initialize
glClearColor(0.8,0.8,0.9,0)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST)
glDisable(GL_LIGHTING)
glEnable(GL_LIGHTING)
glEnable(GL_NORMALIZE)
glShadeModel(GL_FLAT)
# Projection
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
gluPerspective (45,1.3333,0.2,20)
# Initialize ModelView matrix
glMatrixMode(GL_MODELVIEW)
glLoadIdentity()
# Light source
glLightfv(GL_LIGHT0,GL_POSITION,[0,0,1,0])
glLightfv(GL_LIGHT0,GL_DIFFUSE,[1,1,1,1])
glLightfv(GL_LIGHT0,GL_SPECULAR,[1,1,1,1])
glEnable(GL_LIGHT0)
# View transformation
gluLookAt (2.4, 3.6, 4.8, 0.5, 0.5, 0, 0, 1, 0)
# draw_body
def draw_body(body):
"""Draw an ODE body.
"""
x,y,z = body.getPosition()
R = body.getRotation()
rot = [R[0], R[3], R[6], 0.,
R[1], R[4], R[7], 0.,
R[2], R[5], R[8], 0.,
x, y, z, 1.0]
glPushMatrix()
glMultMatrixd(rot)
if body.shape=="box":
sx,sy,sz = body.boxsize
glScalef(sx, sy, sz)
glutSolidCube(1)
glPopMatrix()
# create_box
def create_box(world, space, density, lx, ly, lz):
"""Create a box body and its corresponding geom."""
# Create body
body = ode.Body(world)
M = ode.Mass()
M.setBox(density, lx, ly, lz)
body.setMass(M)
# Set parameters for drawing the body
body.shape = "box"
body.boxsize = (lx, ly, lz)
# Create a box geom for collision detection
geom = ode.GeomBox(space, lengths=body.boxsize)
geom.setBody(body)
return body, geom
# drop_object
def drop_object():
"""Drop an object into the scene."""
global bodies, geom, counter, objcount
body, geom = create_box(world, space, 1000, 1.0,0.2,0.2)
body.setPosition( (random.gauss(0,0.1),3.0,random.gauss(0,0.1)) )
theta = random.uniform(0,2*pi)
ct = cos (theta)
st = sin (theta)
body.setRotation([ct, 0., -st, 0., 1., 0., st, 0., ct])
bodies.append(body)
geoms.append(geom)
counter=0
objcount+=1
# explosion
def explosion():
"""Simulate an explosion.
Every object is pushed away from the origin.
The force is dependent on the objects distance from the origin.
"""
global bodies
for b in bodies:
l=b.getPosition ()
d = length (l)
a = max(0, 40000*(1.0-0.2*d*d))
l = [l[0] / 4, l[1], l[2] /4]
scalp (l, a / length (l))
b.addForce(l)
# pull
def pull():
"""Pull the objects back to the origin.
Every object will be pulled back to the origin.
Every couple of frames there'll be a thrust upwards so that
the objects won't stick to the ground all the time.
"""
global bodies, counter
for b in bodies:
l=list (b.getPosition ())
scalp (l, -1000 / length (l))
b.addForce(l)
if counter%60==0:
b.addForce((0,10000,0))
# Collision callback
def near_callback(args, geom1, geom2):
"""Callback function for the collide() method.
This function checks if the given geoms do collide and
creates contact joints if they do.
"""
# Check if the objects do collide
contacts = ode.collide(geom1, geom2)
# Create contact joints
world,contactgroup = args
for c in contacts:
c.setBounce(0.2)
c.setMu(5000)
j = ode.ContactJoint(world, contactgroup, c)
j.attach(geom1.getBody(), geom2.getBody())
######################################################################
# Initialize Glut
glutInit ([])
# Open a window
glutInitDisplayMode (GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE)
x = 0
y = 0
width = 640
height = 480
glutInitWindowPosition (x, y);
glutInitWindowSize (width, height);
glutCreateWindow ("testode")
# Create a world object
world = ode.World()
world.setGravity( (0,-9.81,0) )
world.setERP(0.8)
world.setCFM(1E-5)
# Create a space object
space = ode.Space()
# Create a plane geom which prevent the objects from falling forever
floor = ode.GeomPlane(space, (0,1,0), 0)
# A list with ODE bodies
bodies = []
# The geoms for each of the bodies
geoms = []
# A joint group for the contact joints that are generated whenever
# two bodies collide
contactgroup = ode.JointGroup()
# Some variables used inside the simulation loop
fps = 50
dt = 1.0/fps
running = True
state = 0
counter = 0
objcount = 0
lasttime = time.time()
# keyboard callback
def _keyfunc (c, x, y):
sys.exit (0)
glutKeyboardFunc (_keyfunc)
# draw callback
def _drawfunc ():
# Draw the scene
prepare_GL()
for b in bodies:
draw_body(b)
glutSwapBuffers ()
glutDisplayFunc (_drawfunc)
# idle callback
def _idlefunc ():
global counter, state, lasttime
t = dt - (time.time() - lasttime)
if (t > 0):
time.sleep(t)
counter += 1
if state==0:
if counter==20:
drop_object()
if objcount==30:
state=1
counter=0
# State 1: Explosion and pulling back the objects
elif state==1:
if counter==100:
explosion()
if counter>300:
pull()
if counter==500:
counter=20
glutPostRedisplay ()
# Simulate
n = 4
for i in range(n):
# Detect collisions and create contact joints
space.collide((world,contactgroup), near_callback)
# Simulation step
world.step(dt/n)
# Remove all contact joints
contactgroup.empty()
lasttime = time.time()
glutIdleFunc (_idlefunc)
glutMainLoop ()

View File

@@ -0,0 +1,503 @@
######################################################################
# Python Open Dynamics Engine Wrapper
# Copyright (C) 2004 PyODE developers (see file AUTHORS)
# All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of EITHER:
# (1) The GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (at
# your option) any later version. The text of the GNU Lesser
# General Public License is included with this library in the
# file LICENSE.
# (2) The BSD-style license that is included with this library in
# the file LICENSE-BSD.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files
# LICENSE and LICENSE-BSD for more details.
######################################################################
cdef extern from "stdlib.h":
void* malloc(long)
void free(void*)
cdef extern from "stdio.h":
int printf(char*)
# Include the basic floating point type -> dReal (either float or double)
#include "_precision.pyx"
cdef extern from "ode/ode.h":
ctypedef double dReal
# Dummy structs
cdef struct dxWorld:
int _dummy
cdef struct dxSpace:
int _dummy
cdef struct dxBody:
int _dummy
cdef struct dxGeom:
int _dummy
cdef struct dxJoint:
int _dummy
cdef struct dxJointGroup:
int _dummy
cdef struct dxTriMeshData:
int _dummy
cdef struct dxHeightfieldData:
int _dummy
# Types
ctypedef dxWorld* dWorldID
ctypedef dxSpace* dSpaceID
ctypedef dxBody* dBodyID
ctypedef dxGeom* dGeomID
ctypedef dxJoint* dJointID
ctypedef dxJointGroup* dJointGroupID
ctypedef dxTriMeshData* dTriMeshDataID
ctypedef dxHeightfieldData* dHeightfieldDataID
ctypedef dReal dVector3[4]
ctypedef dReal dVector4[4]
ctypedef dReal dMatrix3[4*3]
ctypedef dReal dMatrix4[4*4]
ctypedef dReal dMatrix6[8*6]
ctypedef dReal dQuaternion[4]
cdef extern dReal dInfinity
cdef extern int dAMotorUser
cdef extern int dAMotorEuler
ctypedef struct dMass:
dReal mass
dVector4 c
dMatrix3 I
ctypedef struct dJointFeedback:
dVector3 f1
dVector3 t1
dVector3 f2
dVector3 t2
ctypedef void dNearCallback(void* data, dGeomID o1, dGeomID o2)
ctypedef dReal dHeightfieldGetHeight( void* p_user_data, int x, int z )
ctypedef struct dSurfaceParameters:
int mode
dReal mu
dReal mu2
dReal bounce
dReal bounce_vel
dReal soft_erp
dReal soft_cfm
dReal motion1,motion2
dReal slip1,slip2
ctypedef struct dContactGeom:
dVector3 pos
dVector3 normal
dReal depth
dGeomID g1,g2
ctypedef struct dContact:
dSurfaceParameters surface
dContactGeom geom
dVector3 fdir1
# World
dWorldID dWorldCreate()
void dWorldDestroy (dWorldID)
void dCloseODE()
void dInitODE()
void dWorldSetGravity (dWorldID, dReal x, dReal y, dReal z)
void dWorldGetGravity (dWorldID, dVector3 gravity)
void dWorldSetERP (dWorldID, dReal erp)
dReal dWorldGetERP (dWorldID)
void dWorldSetCFM (dWorldID, dReal cfm)
dReal dWorldGetCFM (dWorldID)
void dWorldStep (dWorldID, dReal stepsize)
void dWorldQuickStep (dWorldID, dReal stepsize)
void dWorldSetQuickStepNumIterations (dWorldID, int num)
int dWorldGetQuickStepNumIterations (dWorldID)
void dWorldSetContactMaxCorrectingVel (dWorldID, dReal vel)
dReal dWorldGetContactMaxCorrectingVel (dWorldID)
void dWorldSetContactSurfaceLayer (dWorldID, dReal depth)
dReal dWorldGetContactSurfaceLayer (dWorldID)
void dWorldSetAutoDisableFlag (dWorldID, int do_auto_disable)
int dWorldGetAutoDisableFlag (dWorldID)
void dWorldSetAutoDisableLinearThreshold (dWorldID, dReal linear_threshold)
dReal dWorldGetAutoDisableLinearThreshold (dWorldID)
void dWorldSetAutoDisableAngularThreshold (dWorldID, dReal angular_threshold)
dReal dWorldGetAutoDisableAngularThreshold (dWorldID)
void dWorldSetAutoDisableSteps (dWorldID, int steps)
int dWorldGetAutoDisableSteps (dWorldID)
void dWorldSetAutoDisableTime (dWorldID, dReal time)
dReal dWorldGetAutoDisableTime (dWorldID)
dReal dWorldGetLinearDamping (dWorldID)
void dWorldSetLinearDamping (dWorldID, dReal scale)
dReal dWorldGetAngularDamping (dWorldID)
void dWorldSetAngularDamping (dWorldID, dReal scale)
void dWorldImpulseToForce (dWorldID, dReal stepsize,
dReal ix, dReal iy, dReal iz, dVector3 force)
# Body
dBodyID dBodyCreate (dWorldID)
void dBodyDestroy (dBodyID)
void dBodySetData (dBodyID, void *data)
void *dBodyGetData (dBodyID)
void dBodySetPosition (dBodyID, dReal x, dReal y, dReal z)
void dBodySetRotation (dBodyID, dMatrix3 R)
void dBodySetQuaternion (dBodyID, dQuaternion q)
void dBodySetLinearVel (dBodyID, dReal x, dReal y, dReal z)
void dBodySetAngularVel (dBodyID, dReal x, dReal y, dReal z)
dReal * dBodyGetPosition (dBodyID)
dReal * dBodyGetRotation (dBodyID)
dReal * dBodyGetQuaternion (dBodyID)
dReal * dBodyGetLinearVel (dBodyID)
dReal * dBodyGetAngularVel (dBodyID)
void dBodySetMass (dBodyID, dMass *mass)
void dBodyGetMass (dBodyID, dMass *mass)
void dBodyAddForce (dBodyID, dReal fx, dReal fy, dReal fz)
void dBodyAddTorque (dBodyID, dReal fx, dReal fy, dReal fz)
void dBodyAddRelForce (dBodyID, dReal fx, dReal fy, dReal fz)
void dBodyAddRelTorque (dBodyID, dReal fx, dReal fy, dReal fz)
void dBodyAddForceAtPos (dBodyID, dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz)
void dBodyAddForceAtRelPos (dBodyID, dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz)
void dBodyAddRelForceAtPos (dBodyID, dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz)
void dBodyAddRelForceAtRelPos (dBodyID, dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz)
dReal * dBodyGetForce (dBodyID)
dReal * dBodyGetTorque (dBodyID)
void dBodySetForce(dBodyID, dReal x, dReal y, dReal z)
void dBodySetTorque(dBodyID, dReal x, dReal y, dReal z)
void dBodyGetRelPointPos (dBodyID, dReal px, dReal py, dReal pz, dVector3 result)
void dBodyGetRelPointVel (dBodyID, dReal px, dReal py, dReal pz, dVector3 result)
void dBodyGetPointVel (dBodyID, dReal px, dReal py, dReal pz,
dVector3 result)
void dBodyGetPosRelPoint (dBodyID, dReal px, dReal py, dReal pz,
dVector3 result)
void dBodyVectorToWorld (dBodyID, dReal px, dReal py, dReal pz,
dVector3 result)
void dBodyVectorFromWorld (dBodyID, dReal px, dReal py, dReal pz,
dVector3 result)
void dBodySetFiniteRotationMode (dBodyID, int mode)
void dBodySetFiniteRotationAxis (dBodyID, dReal x, dReal y, dReal z)
int dBodyGetFiniteRotationMode (dBodyID)
void dBodyGetFiniteRotationAxis (dBodyID, dVector3 result)
int dBodyGetNumJoints (dBodyID b)
dJointID dBodyGetJoint (dBodyID, int index)
void dBodyEnable (dBodyID)
void dBodyDisable (dBodyID)
int dBodyIsEnabled (dBodyID)
void dBodySetGravityMode (dBodyID b, int mode)
int dBodyGetGravityMode (dBodyID b)
void dBodySetDynamic (dBodyID)
void dBodySetKinematic (dBodyID)
int dBodyIsKinematic (dBodyID)
void dBodySetMaxAngularSpeed (dBodyID, dReal max_speed)
# Joints
dJointID dJointCreateBall (dWorldID, dJointGroupID)
dJointID dJointCreateHinge (dWorldID, dJointGroupID)
dJointID dJointCreateSlider (dWorldID, dJointGroupID)
dJointID dJointCreateContact (dWorldID, dJointGroupID, dContact *)
dJointID dJointCreateUniversal (dWorldID, dJointGroupID)
dJointID dJointCreatePR (dWorldID, dJointGroupID)
dJointID dJointCreateHinge2 (dWorldID, dJointGroupID)
dJointID dJointCreateFixed (dWorldID, dJointGroupID)
dJointID dJointCreateNull (dWorldID, dJointGroupID)
dJointID dJointCreateAMotor (dWorldID, dJointGroupID)
dJointID dJointCreateLMotor (dWorldID, dJointGroupID)
dJointID dJointCreatePlane2D (dWorldID, dJointGroupID)
void dJointDestroy (dJointID)
void dJointEnable (dJointID)
void dJointDisable (dJointID)
int dJointIsEnabled (dJointID)
dJointGroupID dJointGroupCreate (int max_size)
void dJointGroupDestroy (dJointGroupID)
void dJointGroupEmpty (dJointGroupID)
void dJointAttach (dJointID, dBodyID body1, dBodyID body2)
void dJointSetData (dJointID, void *data)
void *dJointGetData (dJointID)
int dJointGetType (dJointID)
dBodyID dJointGetBody (dJointID, int index)
void dJointSetBallAnchor (dJointID, dReal x, dReal y, dReal z)
void dJointSetHingeAnchor (dJointID, dReal x, dReal y, dReal z)
void dJointSetHingeAxis (dJointID, dReal x, dReal y, dReal z)
void dJointSetHingeParam (dJointID, int parameter, dReal value)
void dJointAddHingeTorque(dJointID joint, dReal torque)
void dJointSetSliderAxis (dJointID, dReal x, dReal y, dReal z)
void dJointSetSliderParam (dJointID, int parameter, dReal value)
void dJointAddSliderForce(dJointID joint, dReal force)
void dJointSetHinge2Anchor (dJointID, dReal x, dReal y, dReal z)
void dJointSetHinge2Axis1 (dJointID, dReal x, dReal y, dReal z)
void dJointSetHinge2Axis2 (dJointID, dReal x, dReal y, dReal z)
void dJointSetHinge2Param (dJointID, int parameter, dReal value)
void dJointAddHinge2Torques(dJointID joint, dReal torque1, dReal torque2)
void dJointSetUniversalAnchor (dJointID, dReal x, dReal y, dReal z)
void dJointSetUniversalAxis1 (dJointID, dReal x, dReal y, dReal z)
void dJointSetUniversalAxis2 (dJointID, dReal x, dReal y, dReal z)
void dJointSetUniversalParam (dJointID, int parameter, dReal value)
void dJointAddUniversalTorques(dJointID joint, dReal torque1, dReal torque2)
void dJointSetFixed (dJointID)
void dJointSetAMotorNumAxes (dJointID, int num)
void dJointSetAMotorAxis (dJointID, int anum, int rel, dReal x, dReal y, dReal z)
void dJointSetAMotorAngle (dJointID, int anum, dReal angle)
void dJointSetAMotorParam (dJointID, int parameter, dReal value)
void dJointSetAMotorMode (dJointID, int mode)
void dJointAddAMotorTorques (dJointID, dReal torque1, dReal torque2, dReal torque3)
void dJointSetLMotorAxis (dJointID, int anum, int rel, dReal x, dReal y, dReal z)
void dJointSetLMotorNumAxes (dJointID, int num)
void dJointSetLMotorParam (dJointID, int parameter, dReal value)
void dJointGetBallAnchor (dJointID, dVector3 result)
void dJointGetBallAnchor2 (dJointID, dVector3 result)
void dJointGetHingeAnchor (dJointID, dVector3 result)
void dJointGetHingeAnchor2 (dJointID, dVector3 result)
void dJointGetHingeAxis (dJointID, dVector3 result)
dReal dJointGetHingeParam (dJointID, int parameter)
dReal dJointGetHingeAngle (dJointID)
dReal dJointGetHingeAngleRate (dJointID)
dReal dJointGetSliderPosition (dJointID)
dReal dJointGetSliderPositionRate (dJointID)
void dJointGetSliderAxis (dJointID, dVector3 result)
dReal dJointGetSliderParam (dJointID, int parameter)
void dJointGetHinge2Anchor (dJointID, dVector3 result)
void dJointGetHinge2Anchor2 (dJointID, dVector3 result)
void dJointGetHinge2Axis1 (dJointID, dVector3 result)
void dJointGetHinge2Axis2 (dJointID, dVector3 result)
dReal dJointGetHinge2Param (dJointID, int parameter)
dReal dJointGetHinge2Angle1 (dJointID)
dReal dJointGetHinge2Angle1Rate (dJointID)
dReal dJointGetHinge2Angle2Rate (dJointID)
void dJointGetUniversalAnchor (dJointID, dVector3 result)
void dJointGetUniversalAnchor2 (dJointID, dVector3 result)
void dJointGetUniversalAxis1 (dJointID, dVector3 result)
void dJointGetUniversalAxis2 (dJointID, dVector3 result)
dReal dJointGetUniversalParam (dJointID, int parameter)
dReal dJointGetUniversalAngle1 (dJointID)
dReal dJointGetUniversalAngle2 (dJointID)
dReal dJointGetUniversalAngle1Rate (dJointID)
dReal dJointGetUniversalAngle2Rate (dJointID)
int dJointGetAMotorNumAxes (dJointID)
void dJointGetAMotorAxis (dJointID, int anum, dVector3 result)
int dJointGetAMotorAxisRel (dJointID, int anum)
dReal dJointGetAMotorAngle (dJointID, int anum)
dReal dJointGetAMotorAngleRate (dJointID, int anum)
dReal dJointGetAMotorParam (dJointID, int parameter)
int dJointGetAMotorMode (dJointID)
int dJointGetLMotorNumAxes (dJointID)
void dJointGetLMotorAxis (dJointID, int anum, dVector3 result)
dReal dJointGetLMotorParam (dJointID, int parameter)
void dJointSetPlane2DXParam (dJointID, int parameter, dReal value)
void dJointSetPlane2DYParam (dJointID, int parameter, dReal value)
void dJointSetPlane2DAngleParam (dJointID, int parameter, dReal value)
dReal dJointGetPRPosition (dJointID j)
void dJointSetPRAnchor (dJointID j, dReal x, dReal y, dReal z)
void dJointSetPRAxis1 (dJointID j, dReal x, dReal y, dReal z)
void dJointSetPRAxis2 (dJointID j, dReal x, dReal y, dReal z)
void dJointGetPRAnchor (dJointID j, dVector3 result)
void dJointGetPRAxis1 (dJointID j, dVector3 result)
void dJointGetPRAxis2 (dJointID j, dVector3 result)
void dJointSetFeedback (dJointID, dJointFeedback *)
dJointFeedback *dJointGetFeedback (dJointID)
int dAreConnected (dBodyID, dBodyID)
# Mass
void dMassSetZero (dMass *)
void dMassSetParameters (dMass *, dReal themass,
dReal cgx, dReal cgy, dReal cgz,
dReal I11, dReal I22, dReal I33,
dReal I12, dReal I13, dReal I23)
void dMassSetSphere (dMass *, dReal density, dReal radius)
void dMassSetSphereTotal (dMass *, dReal total_mass, dReal radius)
void dMassSetCapsule (dMass *, dReal density, int direction, dReal radius, dReal length)
void dMassSetCapsuleTotal (dMass *, dReal total_mass, int direction, dReal radius, dReal length)
void dMassSetCylinder (dMass *, dReal density, int direction,
dReal radius, dReal length)
void dMassSetCylinderTotal (dMass *, dReal total_mass, int direction,
dReal radius, dReal length)
void dMassSetBox (dMass *, dReal density,
dReal lx, dReal ly, dReal lz)
void dMassSetBoxTotal (dMass *, dReal total_mass,
dReal lx, dReal ly, dReal lz)
void dMassAdjust (dMass *, dReal newmass)
void dMassTranslate (dMass *, dReal x, dReal y, dReal z)
void dMassRotate (dMass *, dMatrix3 R)
void dMassAdd (dMass *a, dMass *b)
# Space
# dSpaceID dSimpleSpaceCreate(int space)
# dSpaceID dHashSpaceCreate(int space)
dSpaceID dSimpleSpaceCreate(dSpaceID space)
dSpaceID dHashSpaceCreate(dSpaceID space)
dSpaceID dQuadTreeSpaceCreate (dSpaceID space, dVector3 Center,
dVector3 Extents, int Depth)
void dSpaceDestroy (dSpaceID)
void dSpaceAdd (dSpaceID, dGeomID)
void dSpaceRemove (dSpaceID, dGeomID)
int dSpaceQuery (dSpaceID, dGeomID)
void dSpaceCollide (dSpaceID space, void *data, dNearCallback *callback)
void dSpaceCollide2 (dGeomID o1, dGeomID o2, void *data, dNearCallback *callback)
void dHashSpaceSetLevels (dSpaceID space, int minlevel, int maxlevel)
void dHashSpaceGetLevels (dSpaceID space, int *minlevel, int *maxlevel)
void dSpaceSetCleanup (dSpaceID space, int mode)
int dSpaceGetCleanup (dSpaceID space)
int dSpaceGetNumGeoms (dSpaceID)
dGeomID dSpaceGetGeom (dSpaceID, int i)
# Geom
dGeomID dCreateSphere (dSpaceID space, dReal radius)
dGeomID dCreateBox (dSpaceID space, dReal lx, dReal ly, dReal lz)
dGeomID dCreatePlane (dSpaceID space, dReal a, dReal b, dReal c, dReal d)
dGeomID dCreateCapsule (dSpaceID space, dReal radius, dReal length)
dGeomID dCreateCylinder (dSpaceID space, dReal radius, dReal length)
dGeomID dCreateGeomGroup (dSpaceID space)
void dGeomSphereSetRadius (dGeomID sphere, dReal radius)
void dGeomBoxSetLengths (dGeomID box, dReal lx, dReal ly, dReal lz)
void dGeomPlaneSetParams (dGeomID plane, dReal a, dReal b, dReal c, dReal d)
void dGeomCapsuleSetParams (dGeomID ccylinder, dReal radius, dReal length)
void dGeomCylinderSetParams (dGeomID ccylinder, dReal radius, dReal length)
dReal dGeomSphereGetRadius (dGeomID sphere)
void dGeomBoxGetLengths (dGeomID box, dVector3 result)
void dGeomPlaneGetParams (dGeomID plane, dVector4 result)
void dGeomCapsuleGetParams (dGeomID ccylinder, dReal *radius, dReal *length)
void dGeomCylinderGetParams (dGeomID ccylinder, dReal *radius, dReal *length)
dReal dGeomSpherePointDepth (dGeomID sphere, dReal x, dReal y, dReal z)
dReal dGeomBoxPointDepth (dGeomID box, dReal x, dReal y, dReal z)
dReal dGeomPlanePointDepth (dGeomID plane, dReal x, dReal y, dReal z)
dReal dGeomCapsulePointDepth (dGeomID ccylinder, dReal x, dReal y, dReal z)
dGeomID dCreateRay (dSpaceID space, dReal length)
void dGeomRaySetLength (dGeomID ray, dReal length)
dReal dGeomRayGetLength (dGeomID ray)
void dGeomRaySet (dGeomID ray, dReal px, dReal py, dReal pz,
dReal dx, dReal dy, dReal dz)
void dGeomRayGet (dGeomID ray, dVector3 start, dVector3 dir)
void dGeomSetData (dGeomID, void *)
void *dGeomGetData (dGeomID)
void dGeomSetBody (dGeomID, dBodyID)
dBodyID dGeomGetBody (dGeomID)
void dGeomSetPosition (dGeomID, dReal x, dReal y, dReal z)
void dGeomSetRotation (dGeomID, dMatrix3 R)
void dGeomSetQuaternion (dGeomID, dQuaternion)
dReal * dGeomGetPosition (dGeomID)
dReal * dGeomGetRotation (dGeomID)
void dGeomGetQuaternion (dGeomID, dQuaternion result)
void dGeomSetOffsetPosition (dGeomID, dReal x, dReal y, dReal z)
void dGeomSetOffsetRotation (dGeomID, dMatrix3 R)
void dGeomClearOffset (dGeomID)
dReal * dGeomGetOffsetPosition (dGeomID)
dReal * dGeomGetOffsetRotation (dGeomID)
void dGeomDestroy (dGeomID)
void dGeomGetAABB (dGeomID, dReal aabb[6])
dReal *dGeomGetSpaceAABB (dGeomID)
int dGeomIsSpace (dGeomID)
dSpaceID dGeomGetSpace (dGeomID)
int dGeomGetClass (dGeomID)
void dGeomSetCategoryBits(dGeomID, unsigned long bits)
void dGeomSetCollideBits(dGeomID, unsigned long bits)
unsigned long dGeomGetCategoryBits(dGeomID)
unsigned long dGeomGetCollideBits(dGeomID)
void dGeomEnable (dGeomID)
void dGeomDisable (dGeomID)
int dGeomIsEnabled (dGeomID)
void dGeomGroupAdd (dGeomID group, dGeomID x)
void dGeomGroupRemove (dGeomID group, dGeomID x)
int dGeomGroupGetNumGeoms (dGeomID group)
dGeomID dGeomGroupGetGeom (dGeomID group, int i)
dGeomID dCreateGeomTransform (dSpaceID space)
void dGeomTransformSetGeom (dGeomID g, dGeomID obj)
dGeomID dGeomTransformGetGeom (dGeomID g)
void dGeomTransformSetCleanup (dGeomID g, int mode)
int dGeomTransformGetCleanup (dGeomID g)
void dGeomTransformSetInfo (dGeomID g, int mode)
int dGeomTransformGetInfo (dGeomID g)
int dCollide (dGeomID o1, dGeomID o2, int flags, dContactGeom *contact, int skip)
# Trimesh
dTriMeshDataID dGeomTriMeshDataCreate()
void dGeomTriMeshDataDestroy(dTriMeshDataID g)
void dGeomTriMeshDataBuildSingle1 (dTriMeshDataID g, void* Vertices,
int VertexStride, int VertexCount,
void* Indices, int IndexCount,
int TriStride, void* Normals)
void dGeomTriMeshDataBuildSimple(dTriMeshDataID g,
dReal* Vertices, int VertexCount,
int* Indices, int IndexCount)
dGeomID dCreateTriMesh (dSpaceID space, dTriMeshDataID Data,
void* Callback,
void* ArrayCallback,
void* RayCallback)
void dGeomTriMeshSetData (dGeomID g, dTriMeshDataID Data)
void dGeomTriMeshClearTCCache (dGeomID g)
void dGeomTriMeshGetTriangle (dGeomID g, int Index, dVector3 *v0,
dVector3 *v1, dVector3 *v2)
int dGeomTriMeshGetTriangleCount (dGeomID g)
void dGeomTriMeshGetPoint (dGeomID g, int Index, dReal u, dReal v,
dVector3 Out)
void dGeomTriMeshEnableTC(dGeomID g, int geomClass, int enable)
int dGeomTriMeshIsTCEnabled(dGeomID g, int geomClass)
# Heightfield
dHeightfieldDataID dGeomHeightfieldDataCreate()
void dGeomHeightfieldDataDestroy(dHeightfieldDataID g)
void dGeomHeightfieldDataBuildCallback(dHeightfieldDataID d,
void* pUserData,
dHeightfieldGetHeight* pCallback,
dReal width, dReal depth,
int widthSamples, int depthSamples,
dReal scale, dReal offset,
dReal thickness, int bWrap)
dGeomID dCreateHeightfield (dSpaceID space, dHeightfieldDataID data,
int bPlaceable)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,48 @@
#! /usr/bin/env python
from distutils.core import setup
from distutils.extension import Extension
from subprocess import Popen, PIPE, CalledProcessError
try:
from Cython.Distutils import build_ext
except ImportError:
raise SystemExit("Requires Cython (http://cython.org/)")
try:
ode_cflags = Popen(
["pkg-config", "--cflags", "ode"],
stdout=PIPE).stdout.read().decode('ascii').split()
ode_libs = Popen(
["pkg-config", "--libs", "ode"],
stdout=PIPE).stdout.read().decode('ascii').split()
except (OSError, CalledProcessError):
raise SystemExit("Failed to find ODE with 'pkg-config'. Please make sure "
"that it is installed and available on your system path.")
ode_ext = Extension("ode", ["ode.pyx"],
extra_compile_args=ode_cflags,
extra_link_args=ode_libs)
if __name__ == "__main__":
setup(
name="Open Dynamics Engine",
version="0.12",
author="Gideon Klompje",
# author_email="",
# maintainer="",
# maintainer_email="",
url="http://www.ode.org",
description="Bindings for the Open Dynamics Engine",
long_description=(
"A free, industrial quality library for simulating articulated "
"rigid body dynamics - for example ground vehicles, legged "
"creatures, and moving objects in VR environments. It's fast, "
"flexible & robust. Built-in collision detection."),
# download_url="https://opende.svn.sourceforge.net/svnroot/opende",
# classifiers=[],
# platforms=[],
license="BSD License, GNU Lesser General Public License (LGPL)",
cmdclass={"build_ext": build_ext},
ext_modules=[ode_ext]
)