You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(33) |
Aug
(9) |
Sep
(2) |
Oct
(4) |
Nov
(13) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
(2) |
Jun
(7) |
Jul
(2) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
(3) |
2006 |
Jan
(2) |
Feb
|
Mar
|
Apr
(3) |
May
(2) |
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
(8) |
Dec
|
2007 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(13) |
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(8) |
2009 |
Jan
|
Feb
(2) |
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Matthias B. <mb...@us...> - 2007-06-05 09:03:10
|
Update of /cvsroot/pyode/pyode/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23333/src Modified Files: declarations.pyx ode.pyx Added Files: heightfield.pyx heightfielddata.pyx Log Message: Applied the heightfield patch Index: ode.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/ode.pyx,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** ode.pyx 5 Jun 2007 08:42:17 -0000 1.18 --- ode.pyx 5 Jun 2007 09:03:10 -0000 1.19 *************** *** 184,187 **** --- 184,189 ---- include "_trimesh_switch.pyx" + include "heightfielddata.pyx" + include "heightfield.pyx" def collide(geom1, geom2): --- NEW FILE: heightfield.pyx --- ###################################################################### # 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 class GeomHeightfield(GeomObject): """Heightfield object. To construct the heightfield geom, you need a HeightfieldData object that stores the heightfield data. This object has to be passed as the first argument to the constructor. Constructor:: GeomHeightfield(data, space=None) """ cdef HeightfieldData data def __new__(self, HeightfieldData data not None, placeable=True, space=None): cdef SpaceBase sp cdef dSpaceID sid self.data = data sid=NULL if space!=None: sp = space sid = sp.sid self.gid = dCreateHeightfield(sid, data.hfdid, <int>placeable) _geom_c2py_lut[<long>self.gid] = self def __init__(self, HeightfieldData data not None, space=None): self.space = space self.body = None def placeable(self): return True def _id(self): cdef long id id = <long>self.gid return id --- NEW FILE: heightfielddata.pyx --- ###################################################################### # 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 class HeightfieldData: """This class is used to store heightfield data. """ cdef dHeightfieldDataID hfdid def __new__(self): self.hfdid = dGeomHeightfieldDataCreate() def __dealloc__(self): if self.hfdid!=NULL: dGeomHeightfieldDataDestroy(self.hfdid) def build_callback(self, userdata, callback, width, depth, wsamp, dsamp, scale, offset, thickness, bwrap): cdef object tup cdef void* data tup = (callback, arg) data = <void*>tup dGeomHeightfieldDataBuildCallback(self.hfdid, data, get_height, width, depth, wsamp, dsamp, scale, offset, thickness, bwrap) cdef dReal get_height(void *data, int x, int z): cdef object tup tup = <object>data callback, arg = tup return callback(arg, x, z) Index: declarations.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/declarations.pyx,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** declarations.pyx 5 Jun 2007 08:42:17 -0000 1.20 --- declarations.pyx 5 Jun 2007 09:03:10 -0000 1.21 *************** *** 50,53 **** --- 50,55 ---- cdef struct dxTriMeshData: int _dummy + cdef struct dxHeightfieldData: + int _dummy # Types *************** *** 59,62 **** --- 61,65 ---- ctypedef dxJointGroup* dJointGroupID ctypedef dxTriMeshData* dTriMeshDataID + ctypedef dxHeightfieldData* dHeightfieldDataID ctypedef dReal dVector3[4] ctypedef dReal dVector4[4] *************** *** 82,85 **** --- 85,89 ---- ctypedef void dNearCallback(void* data, dGeomID o1, dGeomID o2) + ctypedef dReal dHeightfieldGetHeight( void* p_user_data, int x, int z ) ctypedef struct dSurfaceParameters: *************** *** 458,459 **** --- 462,477 ---- 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) + |
From: Matthias B. <mb...@us...> - 2007-06-05 08:42:19
|
Update of /cvsroot/pyode/pyode/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15787/src Modified Files: declarations.pyx geomobject.pyx geoms.pyx joints.pyx ode.pyx trimesh.pyx Log Message: Applied a couiple of patches posted by Ethan Glasser-Camp (GeomRay doc strings, angle methods on UniversalJoint, GeomObject.__delattr__, weak refs, triangle count) Index: joints.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/joints.pyx,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** joints.pyx 10 Nov 2006 10:43:23 -0000 1.12 --- joints.pyx 5 Jun 2007 08:42:17 -0000 1.13 *************** *** 685,688 **** --- 685,700 ---- dJointAddUniversalTorques(self.jid, torque1, torque2) + def getAngle1(self): + return dJointGetUniversalAngle1(self.jid) + + def getAngle2(self): + return dJointGetUniversalAngle2(self.jid) + + def getAngle1Rate(self): + return dJointGetUniversalAngle1Rate(self.jid) + + def getAngle2Rate(self): + return dJointGetUniversalAngle2Rate(self.jid) + # setParam def setParam(self, param, value): *************** *** 691,695 **** # getParam def getParam(self, param): ! return dJointGetUniversalParam(self.jid, param) --- 703,707 ---- # getParam def getParam(self, param): ! return dJointGetUniversalParam(self.jid, param) Index: declarations.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/declarations.pyx,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** declarations.pyx 10 Nov 2006 10:53:40 -0000 1.19 --- declarations.pyx 5 Jun 2007 08:42:17 -0000 1.20 *************** *** 282,285 **** --- 282,289 ---- 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) *************** *** 447,450 **** --- 451,456 ---- dVector3 *v1, dVector3 *v2) + int dGeomTriMeshGetTriangleCount (dGeomID g) + void dGeomTriMeshGetPoint (dGeomID g, int Index, dReal u, dReal v, dVector3 Out) Index: trimesh.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/trimesh.pyx,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** trimesh.pyx 15 Nov 2004 20:16:03 -0000 1.4 --- trimesh.pyx 5 Jun 2007 08:42:17 -0000 1.5 *************** *** 92,94 **** --- 92,100 ---- return ((v0[0],v0[1],v0[2]), (v1[0],v1[1],v1[2]), (v2[0],v2[1],v2[2])) + def getTriangleCount(self): + """getTriangleCount() -> n + + Returns the number of triangles in the TriMesh.""" + + return dGeomTriMeshGetTriangleCount(self.gid) Index: ode.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/ode.pyx,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** ode.pyx 10 Nov 2006 10:53:40 -0000 1.17 --- ode.pyx 5 Jun 2007 08:42:17 -0000 1.18 *************** *** 152,156 **** # Lookup table for geom objects: C ptr -> Python object ! _geom_c2py_lut = {} # Mass --- 152,157 ---- # Lookup table for geom objects: C ptr -> Python object ! import weakref ! _geom_c2py_lut = weakref.WeakValueDictionary() # Mass Index: geomobject.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/geomobject.pyx,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** geomobject.pyx 17 Jan 2006 09:07:54 -0000 1.4 --- geomobject.pyx 5 Jun 2007 08:42:17 -0000 1.5 *************** *** 53,56 **** --- 53,58 ---- cdef object attribs + cdef object __weakref__ + def __new__(self, *a, **kw): self.gid = NULL *************** *** 76,79 **** --- 78,87 ---- self.attribs[name]=val + def __delattr__(self, name): + if name in self.attribs: + del self.attribs[name] + else: + raise AttributeError, "geom has no attribute '%s'."%name + def _id(self): """_id() -> int Index: geoms.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/geoms.pyx,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** geoms.pyx 10 Nov 2006 10:53:40 -0000 1.13 --- geoms.pyx 5 Jun 2007 08:42:17 -0000 1.14 *************** *** 363,375 **** --- 363,400 ---- def setLength(self, rlen): + '''setLength(rlen) + + Set length of the ray. + + @param rlen: length of the ray + @type rlen: float''' dGeomRaySetLength(self.gid, rlen) def getLength(self): + '''getLength() -> length + + Get the length of the ray. + + @returns: length of the ray (float)''' return dGeomRayGetLength(self.gid) def set(self, p, u): + '''set(p, u) + + Set the position and rotation of a ray. + + @param p: position + @type p: 3-sequence of floats + @param u: rotation + @type u: 3-sequence of floats''' dGeomRaySet(self.gid, p[0],p[1],p[2], u[0],u[1],u[2]) def get(self): + '''get() -> ((p[0], p[1], p[2]), (u[0], u[1], u[2])) + + Return the position and rotation as a pair of + tuples. + + @returns: position and rotation''' cdef dVector3 start cdef dVector3 dir |
From: Matthias B. <mb...@us...> - 2007-06-05 08:42:19
|
Update of /cvsroot/pyode/pyode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15787 Modified Files: ChangeLog Log Message: Applied a couiple of patches posted by Ethan Glasser-Camp (GeomRay doc strings, angle methods on UniversalJoint, GeomObject.__delattr__, weak refs, triangle count) Index: ChangeLog =================================================================== RCS file: /cvsroot/pyode/pyode/ChangeLog,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** ChangeLog 28 Nov 2006 16:33:29 -0000 1.15 --- ChangeLog 5 Jun 2007 08:42:17 -0000 1.16 *************** *** 1,7 **** ! 2006-11-28 Matthias Baas <ba...@ir...> * setup.py: Modified the setup script to upgrade to ODE 0.7. ! 2006-11-10 Matthias Baas <ba...@ir...> * joints.pyx, geoms.pyx: Applied some more patches by --- 1,14 ---- ! 2007-06-05 Matthias Baas <mb...@us...> ! ! * Applied a couple of patches posted by Ethan Glasser-Camp to the ! mailing list (doc strings for GeomRay, __delattr__ on ! GeomObject, UniversalJoint angle updates, storing ! Geoms with weak references, triangle count) ! ! 2006-11-28 Matthias Baas <mb...@us...> * setup.py: Modified the setup script to upgrade to ODE 0.7. ! 2006-11-10 Matthias Baas <mb...@us...> * joints.pyx, geoms.pyx: Applied some more patches by *************** *** 12,16 **** GeomCylinder (the uncapped one)). ! 2006-11-09 Matthias Baas <ba...@ir...> * joints.pyx: Applied a patch from the mailing list that adds support --- 19,23 ---- GeomCylinder (the uncapped one)). ! 2006-11-09 Matthias Baas <mb...@us...> * joints.pyx: Applied a patch from the mailing list that adds support *************** *** 22,26 **** (I've switched to v0.7 now). ! 2006-08-15 Matthias Baas <ba...@ir...> * joints.pyx: The JointGroup.__dealloc__() method now notifies --- 29,33 ---- (I've switched to v0.7 now). ! 2006-08-15 Matthias Baas <mb...@us...> * joints.pyx: The JointGroup.__dealloc__() method now notifies *************** *** 28,32 **** (i.e. _destroyed() is called). ! 2006-05-30 Matthias Baas <ba...@ir...> * mass.pyx: Applied Chris Bainbridge's patch that adds the --- 35,39 ---- (i.e. _destroyed() is called). ! 2006-05-30 Matthias Baas <mb...@us...> * mass.pyx: Applied Chris Bainbridge's patch that adds the *************** *** 34,38 **** the other set*Total() methods, too. ! 2006-04-13 Matthias Baas <ba...@ir...> * space.pyx, joints.pyx: Fixed some doc strings that generated --- 41,45 ---- the other set*Total() methods, too. ! 2006-04-13 Matthias Baas <mb...@us...> * space.pyx, joints.pyx: Fixed some doc strings that generated *************** *** 41,45 **** strings). ! 2006-01-17 Matthias Baas <ba...@ir...> * geomobject.pyx: Added the getQuaternion()/setQuaternion() methods --- 48,52 ---- strings). ! 2006-01-17 Matthias Baas <mb...@us...> * geomobject.pyx: Added the getQuaternion()/setQuaternion() methods *************** *** 53,61 **** equality. ! 2005-09-20 Matthias Baas <ba...@ir...> * ode.pyx: Added the ParamX3 parameter names and the ParamGroup definition ! 2005-06-24 Matthias Baas <ba...@ir...> * Modified the base joint class so that its possible to store --- 60,68 ---- equality. ! 2005-09-20 Matthias Baas <mb...@us...> * ode.pyx: Added the ParamX3 parameter names and the ParamGroup definition ! 2005-06-24 Matthias Baas <mb...@us...> * Modified the base joint class so that its possible to store *************** *** 63,67 **** This was suggested in "bug" 1121141. ! 2005-06-06 Matthias Baas <ba...@ir...> * Creating a Body now requires a World object. Empty Bodies are not --- 70,74 ---- This was suggested in "bug" 1121141. ! 2005-06-06 Matthias Baas <mb...@us...> * Creating a Body now requires a World object. Empty Bodies are not *************** *** 71,80 **** * Added an iterator to iterate over the geoms inside a Space. ! 2005-05-05 Matthias Baas <ba...@ir...> * src\joints.pyx (Joints): Added methods to set joint forces/torques directly (section 7.6 in the ODE manual). ! 2005-03-03 Matthias Baas <ba...@ir...> * src\geomobject.pyx (setCollideBits, setCategoryBits): Bits can now also be passed as int. --- 78,87 ---- * Added an iterator to iterate over the geoms inside a Space. ! 2005-05-05 Matthias Baas <mb...@us...> * src\joints.pyx (Joints): Added methods to set joint forces/torques directly (section 7.6 in the ODE manual). ! 2005-03-03 Matthias Baas <mb...@us...> * src\geomobject.pyx (setCollideBits, setCategoryBits): Bits can now also be passed as int. |
From: Matthias B. <mb...@us...> - 2007-01-11 16:37:44
|
Update of /cvsroot/pyode/pyode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16846 Modified Files: setup.py Log Message: Added /opt/local to the search paths on non-Windows systems (i.e. for OSX MacPorts). Index: setup.py =================================================================== RCS file: /cvsroot/pyode/pyode/setup.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** setup.py 28 Nov 2006 16:33:29 -0000 1.11 --- setup.py 11 Jan 2007 16:37:39 -0000 1.12 *************** *** 41,45 **** else: ! for base in ["/usr", "/usr/local"]: INC_DIRS += [os.path.join(base, "include")] LIB_DIRS += [os.path.join(base, "lib")] --- 41,45 ---- else: ! for base in ["/usr", "/usr/local", "/opt/local"]: INC_DIRS += [os.path.join(base, "include")] LIB_DIRS += [os.path.join(base, "lib")] |
From: Matthias B. <mb...@us...> - 2007-01-10 15:40:57
|
Update of /cvsroot/pyode/pyode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29750 Modified Files: INSTALL Log Message: Updated the INSTALL text. Index: INSTALL =================================================================== RCS file: /cvsroot/pyode/pyode/INSTALL,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** INSTALL 16 Dec 2005 17:06:48 -0000 1.5 --- INSTALL 10 Jan 2007 15:40:54 -0000 1.6 *************** *** 8,12 **** http://www.python.org/ ! - ODE 0.5 http://ode.org/ --- 8,12 ---- http://www.python.org/ ! - ODE 0.7 http://ode.org/ *************** *** 36,48 **** somewhere on your system. The setup script will try to find the ODE installation on your system by trying several common locations. However, if the ! installation can not be found, you will have to modify the variables ODE_BASE ! and/or USER_SETTINGS at the top of the setup.py script to point to the ! installation. - ODE can either be compiled with or without trimesh support. The setup script - checks your ODE user-settings file to determine whether is is supported. If - trimesh support disabled, PyODE's TriMeshData and GeomTriMesh classes will - still be there but they will raise a NotImplementedError exception in their - constructor. If you want to force PyODE to install with trimesh support - regardless of your ODE user-settings, uncomment the variable - TRIMESH_SUPPORT_OVERRIDE in setup.py. \ No newline at end of file --- 36,40 ---- somewhere on your system. The setup script will try to find the ODE installation on your system by trying several common locations. However, if the ! installation can not be found, you will have to modify the setup.py script and ! add the appropriate paths. |
From: Timothy S. <pe...@us...> - 2006-11-29 12:38:10
|
Update of /cvsroot/pyode/pyode/xode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13600/xode Modified Files: body.py Log Message: Changed the mass parser to use a default mass shape until the actual one is read. This is to prevent the assertion error produced by ODE. Index: body.py =================================================================== RCS file: /cvsroot/pyode/pyode/xode/body.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** body.py 16 Nov 2004 06:19:49 -0000 1.4 --- body.py 29 Nov 2006 12:36:16 -0000 1.5 *************** *** 144,147 **** --- 144,148 ---- mass = ode.Mass() + mass.setSphere(1.0, 1.0) self.setODEObject(mass) |
From: Timothy S. <pe...@us...> - 2006-11-29 12:37:41
|
Update of /cvsroot/pyode/pyode/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13956/tests Modified Files: test_xode.py Log Message: Added a testcase for the changes to the mass parser. Index: test_xode.py =================================================================== RCS file: /cvsroot/pyode/pyode/tests/test_xode.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_xode.py 16 Dec 2005 17:06:48 -0000 1.7 --- test_xode.py 29 Nov 2006 12:37:24 -0000 1.8 *************** *** 39,42 **** --- 39,47 ---- <space name="space1"> + + <body name="body0"> + <mass name="mass0" /> + </body> + <body name="body1" enabled="false" gravitymode="0"> *************** *** 450,456 **** --- 455,465 ---- def setUp(self): TestParser.setUp(self) + self.mass0 = self.root.namedChild('mass0').getODEObject() self.mass1 = self.root.namedChild('mass1').getODEObject() self.mass2 = self.root.namedChild('mass2').getODEObject() + self.ref1 = ode.Mass() + self.ref1.setSphere(1.0, 1.0) + self.ref2 = ode.Mass() self.ref2.setSphere(2.0, 10.0) *************** *** 460,463 **** --- 469,477 ---- self.assert_(isinstance(self.mass1, ode.Mass)) + def testDefault(self): + self.assertEqual(self.mass0.c, self.ref1.c) + self.assertEqual(self.mass0.I, self.ref1.I) + self.assertEqual(self.mass0.mass, self.ref1.mass) + def testTotal(self): self.assertEqual(self.mass2.mass, 4.0) |
From: Matthias B. <mb...@us...> - 2006-11-28 16:33:37
|
Update of /cvsroot/pyode/pyode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8245 Modified Files: setup.py ChangeLog Log Message: Modified the setup script to upgrade to ODE 0.7 Index: setup.py =================================================================== RCS file: /cvsroot/pyode/pyode/setup.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** setup.py 16 Dec 2005 17:06:48 -0000 1.10 --- setup.py 28 Nov 2006 16:33:29 -0000 1.11 *************** *** 3,19 **** ###################################################################### - # Note: ODE itself must already be compiled - - # Set to the base of your ODE installation. - #ODE_BASE = '../ode' - - # Set to the location of your ODE user-settings file. - #USER_SETTINGS = '../ode/config/user-settings' - - # Set to True or False to force trimesh support to be enabled or disabled. - #TRIMESH_SUPPORT_OVERRIDE = True - - ###################################################################### - from distutils.core import setup, Extension import distutils.sysconfig --- 3,6 ---- *************** *** 21,242 **** from stat import * ! base = [] ! # Windows? if sys.platform=="win32": ! try: ! base = [ODE_BASE] ! except NameError: ! base = [] ! base.append("../ode_single_trimesh") ! base.append("../ode_double_notrimesh") ! LIBS = ["ode", "user32"] # user32 because of the MessageBox() call ! CC_ARGS = ["/ML"] ! # Linux (and other) else: ! try: ! base = [ODE_BASE] ! except NameError: ! base = [] ! base.append("/usr") ! base.append("/usr/local") ! base.append("../ode") ! ! LIBS = ["ode", "stdc++"] ! CC_ARGS = [] ! ! ! # Look for an ODE user-settings file. ! def findODEConfig(prefix): ! try: ! suffix = [USER_SETTINGS] ! prefix = '' ! except NameError: ! suffix = [os.path.join('config', 'user-settings'), ! os.path.join('include', 'ode', 'config', 'user-settings'), ! os.path.join('share', 'ode-0.5', 'config', 'user-settings')] ! ! for s in suffix: ! path = os.path.normpath(os.path.join(prefix, s)) ! if (os.path.exists(path)): ! return path ! ! return None ! ! # Find an ODE installation. ! ODE_BASE = None ! for path in base: ! if (not os.path.exists(path)): ! continue ! ! c = findODEConfig(path) ! if (c is None): ! continue ! ! if (not os.path.exists(os.path.join(path, 'include'))): ! continue ! ! if (not os.path.exists(os.path.join(path, 'lib'))): ! continue ! ! ODE_BASE = path ! break ! ! ! if (ODE_BASE is None): ! print ! print "Error: ODE installation not found." ! print ! print "The following installation bases were checked:" ! for path in base: ! print " -", path ! print ! print 'This Python ODE wrapper assumes that you have a compiled version of' ! print 'the ODE library already somewhere on your system. The path to the' ! print 'ODE installation has to be set in the setup script via the variable' ! print 'ODE_BASE and the path to the user-settings file has to be set via' ! print 'the variable USER_SETTINGS. Please change these variables so that' ! print 'they point to the actual location of your ODE installation.' ! sys.exit(1) ! ! ! print 'Using "%s" as base of ODE installation.' % ODE_BASE - INC_DIRS = [os.path.join(ODE_BASE, "include")] - LIB_DIRS = [os.path.join(ODE_BASE, "lib")] ###################################################################### ! ! def readODEConfig(): ! config = {} ! ! filename = findODEConfig(ODE_BASE) ! print 'Reading ODE user-settings from "%s".' % filename ! ! try: ! f = file(filename) ! except IOError, e: ! print "ERROR:", e ! raise RuntimeError ! ! for line in f.readlines(): ! s = line.strip() ! ! # remove comments ! i = s.find('#') ! if (i != -1): ! s = s[:i] ! ! if (s == ''): ! continue ! ! s = s.upper() ! ! a = s.split('=') ! if (len(a) == 2): ! k, v = a ! config[k] = v ! ! return config ! ###################################################################### ! # Determine the precision setting (SINGLE or DOUBLE?) ! #try: ! # precisionfile = "_precision.pyx" ! # precision = determinePrecision() ! # print "Precision:",precision ! # print 'Creating file "%s"...'%precisionfile ! # f = file(precisionfile, "wt") ! # f.write("# This file was automatically generated by the setup script\n\n") ! # f.write('cdef extern from "ode/ode.h":\n') ! # f.write(' # Define the basic floating point type used in ODE\n') ! # f.write(' ctypedef %s dReal\n'%{"SINGLE":"float", "DOUBLE":"double"}[precision]) ! # f.close() ! #except RuntimeError: ! # print "Aborting!" ! # sys.exit() ! # Generate the C source file (if necessary) def generate(name, trimesh_support): ! # Generate the trimesh_switch file ! f = file("_trimesh_switch.pyx", "wt") ! print >>f, '# This file was generated by the setup script and is included in ode.pyx.\n' ! if (trimesh_support): ! print >>f, 'include "trimeshdata.pyx"' ! print >>f, 'include "trimesh.pyx"' ! else: ! print >>f, 'include "trimesh_dummy.pyx"' ! f.close() ! cmd = "pyrexc -o %s -I. -Isrc src/ode.pyx" % name ! pyrex_out = name ! # Check if the pyrex output is still up to date or if it has to be generated ! # (ode.c will be updated if any of the *.pyx files in the directory "src" ! # is newer than ode.c) ! if os.access(pyrex_out, os.F_OK): ! ctime = os.stat(pyrex_out)[ST_MTIME] ! for pyx in glob.glob("src/*.pyx"): ! pytime = os.stat(pyx)[ST_MTIME] ! if pytime>ctime: ! print "Updating",pyrex_out ! print cmd ! err = os.system(cmd) ! break ! else: ! print pyrex_out,"is up to date" ! err = 0 ! else: ! print "Creating",pyrex_out ! print cmd ! err = os.system(cmd) ! # Check if calling pyrex produced an error ! if err!=0: ! print "An error occured while generating the C source file." ! sys.exit(err) ! config = readODEConfig() generate('ode_trimesh.c', True) generate('ode_notrimesh.c', False) ! try: ! wrap_trimesh = TRIMESH_SUPPORT_OVERRIDE ! except NameError, e: ! wrap_trimesh = config.get('OPCODE_DIRECTORY', '') ! ! if (wrap_trimesh): ! print "Installing with trimesh support." ! install = 'ode_trimesh.c' else: ! print "Installing without trimesh support." ! install = 'ode_notrimesh.c' # Compile the module setup(name = "PyODE", ! version = "1.1.0", ! description = "Python wrapper for the Open Dynamics Engine", ! author = "see file AUTHORS", ! author_email = "ti...@st...", ! license = "BSD or LGPL", ! url = "http://pyode.sourceforge.net/", ! packages = ["xode"], ! ext_modules = [Extension("ode", [install] ! ,libraries=LIBS ! ,include_dirs=INC_DIRS ! ,library_dirs=LIB_DIRS ! ,extra_compile_args=CC_ARGS) ! ]) --- 8,156 ---- from stat import * + # Include directories + INC_DIRS = [] + # Library directories + LIB_DIRS = [] + # Libraries to link with + LIBS = [] + # Additional compiler arguments + CC_ARGS = [] + # Additional linker arguments + LINK_ARGS = [] ! # If your version of ODE was compiled with OPCODE (trimesh support) enabled, ! # this should be set to True. ! TRIMESH_ENABLE = True ! ###################################################################### ! # Windows specific settings ! ###################################################################### if sys.platform=="win32": ! ODE_BASE = r"insert_your_path_here" ! INC_DIRS += [os.path.join(ODE_BASE, "include")] ! LIB_DIRS += [os.path.join(ODE_BASE, "lib", "releaselib")] ! LIBS += ["ode", "user32"] # user32 because of the MessageBox() call ! CC_ARGS += ["/ML"] ! LINK_ARGS += ["/NODEFAULTLIB:LIBCMT"] ! ###################################################################### ! # Linux (and other) specific settings ! ###################################################################### else: ! for base in ["/usr", "/usr/local"]: ! INC_DIRS += [os.path.join(base, "include")] ! LIB_DIRS += [os.path.join(base, "lib")] + LIBS += ["ode", "stdc++"] ###################################################################### ! ###################################################################### ###################################################################### ! def info(msg): ! """Output an info message. ! """ ! print "INFO:",msg + def warning(msg): + """Output a warning message. + """ + print "WARNING:",msg + def error(msg, errorcode=1): + """Output an error message and abort. + """ + print "ERROR:",msg + sys.exit(errorcode) # Generate the C source file (if necessary) def generate(name, trimesh_support): ! """Run Pyrex to generate the extension module source code. ! """ ! # Generate the trimesh_switch file ! f = file("_trimesh_switch.pyx", "wt") ! print >>f, '# This file was generated by the setup script and is included in ode.pyx.\n' ! if (trimesh_support): ! print >>f, 'include "trimeshdata.pyx"' ! print >>f, 'include "trimesh.pyx"' ! else: ! print >>f, 'include "trimesh_dummy.pyx"' ! f.close() ! cmd = "pyrexc -o %s -I. -Isrc src/ode.pyx" % name ! pyrex_out = name ! # Check if the pyrex output is still up to date or if it has to be generated ! # (ode.c will be updated if any of the *.pyx files in the directory "src" ! # is newer than ode.c) ! if os.access(pyrex_out, os.F_OK): ! ctime = os.stat(pyrex_out)[ST_MTIME] ! for pyx in glob.glob("src/*.pyx"): ! pytime = os.stat(pyx)[ST_MTIME] ! if pytime>ctime: ! info("Updating %s"%pyrex_out) ! print cmd ! err = os.system(cmd) ! break ! else: ! info("%s is up to date"%pyrex_out) ! err = 0 ! else: ! info("Creating %s"%pyrex_out) ! print cmd ! err = os.system(cmd) ! # Check if calling pyrex produced an error ! if err!=0: ! error("An error occured while generating the C source file.", err) + ###################################################################### ! # Check if ode.h can be found ! # (if it is not found it might not be an error because it may be located ! # in any of the include paths that are built into the compiler) ! num = 0 ! for path in INC_DIRS: ! ode_h = os.path.join(path, "ode", "ode.h") ! if os.path.exists(ode_h): ! info("<ode/ode.h> found in %s"%path) ! num += 1 + if num==0: + warning("<ode/ode.h> not found. You may have to adjust INC_DIRS.") + elif num>1: + warning("ode.h was found more than once. Make sure the header and lib matches.") + + # Generate all possible source code versions so that they can be + # packaged with the source archive and a user doesn't require Pyrex generate('ode_trimesh.c', True) generate('ode_notrimesh.c', False) ! if (TRIMESH_ENABLE): ! info("Installing with trimesh support.") ! install = 'ode_trimesh.c' else: ! info("INFO: Installing without trimesh support.") ! install = 'ode_notrimesh.c' # Compile the module setup(name = "PyODE", ! version = "1.2.0", ! description = "Python wrapper for the Open Dynamics Engine", ! author = "see file AUTHORS", ! author_email = "ti...@st...", ! license = "BSD or LGPL", ! url = "http://pyode.sourceforge.net/", ! packages = ["xode"], ! ext_modules = [Extension("ode", [install] ! ,libraries=LIBS ! ,include_dirs=INC_DIRS ! ,library_dirs=LIB_DIRS ! ,extra_compile_args=CC_ARGS ! ,extra_link_args=LINK_ARGS) ! ]) Index: ChangeLog =================================================================== RCS file: /cvsroot/pyode/pyode/ChangeLog,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ChangeLog 10 Nov 2006 10:56:27 -0000 1.14 --- ChangeLog 28 Nov 2006 16:33:29 -0000 1.15 *************** *** 1,2 **** --- 1,6 ---- + 2006-11-28 Matthias Baas <ba...@ir...> + + * setup.py: Modified the setup script to upgrade to ODE 0.7. + 2006-11-10 Matthias Baas <ba...@ir...> |
From: Matthias B. <mb...@us...> - 2006-11-10 10:56:29
|
Update of /cvsroot/pyode/pyode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24874 Modified Files: ChangeLog Log Message: Update Index: ChangeLog =================================================================== RCS file: /cvsroot/pyode/pyode/ChangeLog,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ChangeLog 9 Nov 2006 13:09:24 -0000 1.13 --- ChangeLog 10 Nov 2006 10:56:27 -0000 1.14 *************** *** 1,2 **** --- 1,11 ---- + 2006-11-10 Matthias Baas <ba...@ir...> + + * joints.pyx, geoms.pyx: Applied some more patches by + Ethan Glasser-Camp (switched from the ccylinder functions to + the capsule functions and renamed the GeomCCylinder to GeomCapsule. + For backwards compatibility, the name GeomCCylinder is still + available and is an alias for GeomCapsule. Added support for + GeomCylinder (the uncapped one)). + 2006-11-09 Matthias Baas <ba...@ir...> |
From: Matthias B. <mb...@us...> - 2006-11-10 10:53:42
|
Update of /cvsroot/pyode/pyode/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23804/src Modified Files: declarations.pyx geoms.pyx ode.pyx Log Message: Applied another patch that adds support for the GeomCylinder class. Index: ode.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/ode.pyx,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** ode.pyx 10 Nov 2006 10:43:23 -0000 1.16 --- ode.pyx 10 Nov 2006 10:53:40 -0000 1.17 *************** *** 65,68 **** --- 65,69 ---- - GeomPlane - GeomCapsule + - GeomCylinder - GeomRay - GeomTransform Index: geoms.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/geoms.pyx,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** geoms.pyx 10 Nov 2006 10:43:23 -0000 1.12 --- geoms.pyx 10 Nov 2006 10:53:40 -0000 1.13 *************** *** 274,277 **** --- 274,326 ---- + # GeomCylinder + cdef class GeomCylinder(GeomObject): + """Plain cylinder geometry. + + This class represents an uncapped cylinder aligned along the local Z axis + and centered at the origin. + + Constructor:: + + GeomCylinder(space=None, radius=0.5, length=1.0) + """ + + def __new__(self, space=None, radius=0.5, length=1.0): + cdef SpaceBase sp + cdef dSpaceID sid + + sid=NULL + if space!=None: + sp = space + sid = sp.sid + self.gid = dCreateCylinder(sid, radius, length) + # if space!=None: + # space._addgeom(self) + + _geom_c2py_lut[<long>self.gid]=self + + def __init__(self, space=None, radius=0.5, length=1.0): + self.space = space + self.body = None + + def placeable(self): + return True + + def _id(self): + cdef long id + id = <long>self.gid + return id + + def setParams(self, radius, length): + dGeomCylinderSetParams(self.gid, radius, length) + + def getParams(self): + cdef dReal radius, length + dGeomCylinderGetParams(self.gid, &radius, &length) + return (radius, length) + + ## dGeomCylinderPointDepth not implemented upstream in ODE 0.7 + + # GeomRay cdef class GeomRay(GeomObject): Index: declarations.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/declarations.pyx,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** declarations.pyx 10 Nov 2006 10:43:23 -0000 1.18 --- declarations.pyx 10 Nov 2006 10:53:40 -0000 1.19 *************** *** 355,358 **** --- 355,359 ---- 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) *************** *** 361,364 **** --- 362,366 ---- 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) *************** *** 366,369 **** --- 368,372 ---- 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) |
From: Matthias B. <mb...@us...> - 2006-11-10 10:43:28
|
Update of /cvsroot/pyode/pyode/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20097/src Modified Files: declarations.pyx geoms.pyx joints.pyx ode.pyx Log Message: Applied some more patches from Ethan Glasser-Camp (GeomCCylinder was replaced by GeomCapsule. The old name is still available and is an alias for GeomCapsule). Index: ode.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/ode.pyx,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** ode.pyx 9 Nov 2006 13:09:24 -0000 1.15 --- ode.pyx 10 Nov 2006 10:43:23 -0000 1.16 *************** *** 56,59 **** --- 56,60 ---- - ContactJoint - AMotor + - LMotor - Plane2DJoint *************** *** 63,67 **** - GeomBox - GeomPlane ! - GeomCCylinder - GeomRay - GeomTransform --- 64,68 ---- - GeomBox - GeomPlane ! - GeomCapsule - GeomRay - GeomTransform Index: geoms.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/geoms.pyx,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** geoms.pyx 15 Nov 2004 20:16:03 -0000 1.11 --- geoms.pyx 10 Nov 2006 10:43:23 -0000 1.12 *************** *** 210,215 **** ! # GeomCCylinder ! cdef class GeomCCylinder(GeomObject): """Capped cylinder geometry. --- 210,215 ---- ! # GeomCapsule ! cdef class GeomCapsule(GeomObject): """Capped cylinder geometry. *************** *** 219,223 **** Constructor:: ! GeomCCylinder(space=None, radius=0.5, length=1.0) The length parameter does not include the caps. --- 219,223 ---- Constructor:: ! GeomCapsule(space=None, radius=0.5, length=1.0) The length parameter does not include the caps. *************** *** 232,236 **** sp = space sid = sp.sid ! self.gid = dCreateCCylinder(sid, radius, length) # if space!=None: # space._addgeom(self) --- 232,236 ---- sp = space sid = sp.sid ! self.gid = dCreateCapsule(sid, radius, length) # if space!=None: # space._addgeom(self) *************** *** 251,259 **** def setParams(self, radius, length): ! dGeomCCylinderSetParams(self.gid, radius, length) def getParams(self): cdef dReal radius, length ! dGeomCCylinderGetParams(self.gid, &radius, &length) return (radius, length) --- 251,259 ---- def setParams(self, radius, length): ! dGeomCapsuleSetParams(self.gid, radius, length) def getParams(self): cdef dReal radius, length ! dGeomCapsuleGetParams(self.gid, &radius, &length) return (radius, length) *************** *** 269,273 **** @type p: 3-sequence of floats """ ! return dGeomCCylinderPointDepth(self.gid, p[0], p[1], p[2]) --- 269,275 ---- @type p: 3-sequence of floats """ ! return dGeomCapsulePointDepth(self.gid, p[0], p[1], p[2]) ! ! GeomCCylinder = GeomCapsule # backwards compatibility Index: joints.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/joints.pyx,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** joints.pyx 9 Nov 2006 13:09:24 -0000 1.11 --- joints.pyx 10 Nov 2006 10:43:23 -0000 1.12 *************** *** 1132,1137 **** The anum argument selects the axis to change (0,1 or 2). ! rel is (in ODE 0.7) ignored for LMotors. @param anum: Axis number --- 1132,1141 ---- The anum argument selects the axis to change (0,1 or 2). + Each axis can have one of three "relative orientation" modes, + selected by rel: ! 0: The axis is anchored to the global frame. ! 1: The axis is anchored to the first body. ! 2: The axis is anchored to the second body. @param anum: Axis number Index: declarations.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/declarations.pyx,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** declarations.pyx 9 Nov 2006 13:09:24 -0000 1.17 --- declarations.pyx 10 Nov 2006 10:43:23 -0000 1.18 *************** *** 354,358 **** dGeomID dCreateBox (dSpaceID space, dReal lx, dReal ly, dReal lz) dGeomID dCreatePlane (dSpaceID space, dReal a, dReal b, dReal c, dReal d) ! dGeomID dCreateCCylinder (dSpaceID space, dReal radius, dReal length) dGeomID dCreateGeomGroup (dSpaceID space) --- 354,358 ---- 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 dCreateGeomGroup (dSpaceID space) *************** *** 360,374 **** void dGeomBoxSetLengths (dGeomID box, dReal lx, dReal ly, dReal lz) void dGeomPlaneSetParams (dGeomID plane, dReal a, dReal b, dReal c, dReal d) ! void dGeomCCylinderSetParams (dGeomID ccylinder, dReal radius, dReal length) dReal dGeomSphereGetRadius (dGeomID sphere) void dGeomBoxGetLengths (dGeomID box, dVector3 result) void dGeomPlaneGetParams (dGeomID plane, dVector4 result) ! void dGeomCCylinderGetParams (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 dGeomCCylinderPointDepth (dGeomID ccylinder, dReal x, dReal y, dReal z) dGeomID dCreateRay (dSpaceID space, dReal length) --- 360,374 ---- 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) dReal dGeomSphereGetRadius (dGeomID sphere) void dGeomBoxGetLengths (dGeomID box, dVector3 result) void dGeomPlaneGetParams (dGeomID plane, dVector4 result) ! void dGeomCapsuleGetParams (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) |
From: Matthias B. <mb...@us...> - 2006-11-09 13:09:29
|
Update of /cvsroot/pyode/pyode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1345 Modified Files: ChangeLog Log Message: Applied two patches from the mailing list which add support for LMotor and Plane2DJoint. Index: ChangeLog =================================================================== RCS file: /cvsroot/pyode/pyode/ChangeLog,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ChangeLog 15 Aug 2006 12:58:42 -0000 1.12 --- ChangeLog 9 Nov 2006 13:09:24 -0000 1.13 *************** *** 1,2 **** --- 1,12 ---- + 2006-11-09 Matthias Baas <ba...@ir...> + + * joints.pyx: Applied a patch from the mailing list that adds support + for the LMotor (thanks to Ethan Glasser-Camp). + * joints.pyx: Applied a patch from the mailing list that adds support + for the Plane2DJoint (thanks to Leonard Ritter). + + These changes requires a more recent version of ODE than 0.5 + (I've switched to v0.7 now). + 2006-08-15 Matthias Baas <ba...@ir...> |
From: Matthias B. <mb...@us...> - 2006-11-09 13:09:26
|
Update of /cvsroot/pyode/pyode/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1345/src Modified Files: declarations.pyx joints.pyx ode.pyx Log Message: Applied two patches from the mailing list which add support for LMotor and Plane2DJoint. Index: ode.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/ode.pyx,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ode.pyx 13 Apr 2006 13:20:17 -0000 1.14 --- ode.pyx 9 Nov 2006 13:09:24 -0000 1.15 *************** *** 56,59 **** --- 56,60 ---- - ContactJoint - AMotor + - Plane2DJoint Geom classes: Index: joints.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/joints.pyx,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** joints.pyx 15 Aug 2006 12:58:42 -0000 1.10 --- joints.pyx 9 Nov 2006 13:09:24 -0000 1.11 *************** *** 1081,1082 **** --- 1081,1199 ---- + # LMotor + cdef class LMotor(Joint): + """LMotor joint. + + Constructor:: + + LMotor(world, jointgroup=None) + """ + + def __new__(self, World world not None, jointgroup=None): + cdef JointGroup jg + cdef dJointGroupID jgid + + jgid = NULL + if jointgroup!=None: + jg = jointgroup + jgid = jg.gid + self.jid = dJointCreateLMotor(world.wid, jgid) + + def __init__(self, World world not None, jointgroup=None): + self.world = world + if jointgroup!=None: + jointgroup._addjoint(self) + + # setNumAxes + def setNumAxes(self, int num): + """setNumAxes(num) + + Set the number of angular axes that will be controlled by the LMotor. + num may be in the range from 0 to 3. + + @param num: Number of axes (0-3) + @type num: int + """ + dJointSetLMotorNumAxes(self.jid, num) + + # getNumAxes + def getNumAxes(self): + """getNumAxes() -> int + + Get the number of angular axes that are controlled by the LMotor. + """ + return dJointGetLMotorNumAxes(self.jid) + + # setAxis + def setAxis(self, int anum, int rel, axis): + """setAxis(anum, rel, axis) + + Set an LMotor axis. + + The anum argument selects the axis to change (0,1 or 2). + + rel is (in ODE 0.7) ignored for LMotors. + + @param anum: Axis number + @param rel: Relative orientation mode + @param axis: Axis + @type anum: int + @type rel: int + @type axis: 3-sequence of floats + """ + dJointSetLMotorAxis(self.jid, anum, rel, axis[0], axis[1], axis[2]) + + # getAxis + def getAxis(self, int anum): + """getAxis(anum) + + Get an LMotor axis. + + @param anum: Axis index (0-2) + @type anum: int + """ + cdef dVector3 a + dJointGetLMotorAxis(self.jid, anum, a) + return (a[0],a[1],a[2]) + + # setParam + def setParam(self, param, value): + dJointSetLMotorParam(self.jid, param, value) + + # getParam + def getParam(self, param): + return dJointGetLMotorParam(self.jid, param) + + + # Plane2DJoint + cdef class Plane2DJoint(Joint): + """Plane-2D Joint. + + Constructor:: + + Plane2DJoint(world, jointgroup=None) + """ + + def __new__(self, World world not None, jointgroup=None): + cdef JointGroup jg + cdef dJointGroupID jgid + + jgid=NULL + if jointgroup!=None: + jg=jointgroup + jgid=jg.gid + self.jid = dJointCreatePlane2D(world.wid, jgid) + + def __init__(self, World world not None, jointgroup=None): + self.world = world + if jointgroup!=None: + jointgroup._addjoint(self) + + def setXParam(self, param, value): + dJointSetPlane2DXParam(self.jid, param, value) + + def setYParam(self, param, value): + dJointSetPlane2DYParam(self.jid, param, value) + + def setAngleParam(self, param, value): + dJointSetPlane2DAngleParam(self.jid, param, value) Index: declarations.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/declarations.pyx,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** declarations.pyx 30 May 2006 14:23:44 -0000 1.16 --- declarations.pyx 9 Nov 2006 13:09:24 -0000 1.17 *************** *** 213,216 **** --- 213,218 ---- dJointID dJointCreateNull (dWorldID, dJointGroupID) dJointID dJointCreateAMotor (dWorldID, dJointGroupID) + dJointID dJointCreateLMotor (dWorldID, dJointGroupID) + dJointID dJointCreatePlane2D (dWorldID, dJointGroupID) void dJointDestroy (dJointID) *************** *** 251,255 **** void dJointSetAMotorMode (dJointID, int mode) void dJointAddAMotorTorques (dJointID, dReal torque1, dReal torque2, dReal torque3) ! void dJointGetBallAnchor (dJointID, dVector3 result) void dJointGetBallAnchor2 (dJointID, dVector3 result) --- 253,260 ---- 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) *************** *** 284,287 **** --- 289,298 ---- 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) void dJointSetFeedback (dJointID, dJointFeedback *) |
From: Matthias B. <mb...@us...> - 2006-08-15 12:58:47
|
Update of /cvsroot/pyode/pyode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6140 Modified Files: ChangeLog Log Message: JointGroup.__dealloc__() now calls _destroyed() on the contained joints Index: ChangeLog =================================================================== RCS file: /cvsroot/pyode/pyode/ChangeLog,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ChangeLog 30 May 2006 14:23:44 -0000 1.11 --- ChangeLog 15 Aug 2006 12:58:42 -0000 1.12 *************** *** 1,2 **** --- 1,8 ---- + 2006-08-15 Matthias Baas <ba...@ir...> + + * joints.pyx: The JointGroup.__dealloc__() method now notifies + the contained joints about the destruction of the ODE joints + (i.e. _destroyed() is called). + 2006-05-30 Matthias Baas <ba...@ir...> |
From: Matthias B. <mb...@us...> - 2006-08-15 12:58:44
|
Update of /cvsroot/pyode/pyode/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6140/src Modified Files: joints.pyx Log Message: JointGroup.__dealloc__() now calls _destroyed() on the contained joints Index: joints.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/joints.pyx,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** joints.pyx 13 Apr 2006 13:09:58 -0000 1.9 --- joints.pyx 15 Aug 2006 12:58:42 -0000 1.10 *************** *** 56,59 **** --- 56,61 ---- def __dealloc__(self): if self.gid!=NULL: + for j in self.jointlist: + j._destroyed() dJointGroupDestroy(self.gid) |
From: Matthias B. <mb...@us...> - 2006-05-30 14:23:57
|
Update of /cvsroot/pyode/pyode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12918 Modified Files: ChangeLog Log Message: Applied Chris Bainbridge's patch that adds the Mass.setBoxTotal() method, and while I was at it I added the other set*Total() methods, too. Index: ChangeLog =================================================================== RCS file: /cvsroot/pyode/pyode/ChangeLog,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ChangeLog 13 Apr 2006 13:20:16 -0000 1.10 --- ChangeLog 30 May 2006 14:23:44 -0000 1.11 *************** *** 1,2 **** --- 1,8 ---- + 2006-05-30 Matthias Baas <ba...@ir...> + + * mass.pyx: Applied Chris Bainbridge's patch that adds the + Mass.setBoxTotal() method, and while I was at it I added + the other set*Total() methods, too. + 2006-04-13 Matthias Baas <ba...@ir...> |
From: Matthias B. <mb...@us...> - 2006-05-30 14:23:56
|
Update of /cvsroot/pyode/pyode/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12918/src Modified Files: declarations.pyx mass.pyx Log Message: Applied Chris Bainbridge's patch that adds the Mass.setBoxTotal() method, and while I was at it I added the other set*Total() methods, too. Index: mass.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/mass.pyx,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** mass.pyx 15 Nov 2004 20:16:03 -0000 1.6 --- mass.pyx 30 May 2006 14:23:44 -0000 1.7 *************** *** 91,94 **** --- 91,107 ---- dMassSetSphere(&self._mass, density, radius) + def setSphereTotal(self, total_mass, radius): + """setSphereTotal(total_mass, radius) + + Set the mass parameters to represent a sphere of the given radius + and mass, with the center of mass at (0,0,0) relative to the body. + + @param total_mass: The total mass of the sphere + @param radius: The radius of the sphere + @type total_mass: float + @type radius: float + """ + dMassSetSphere(&self._mass, total_mass, radius) + def setCappedCylinder(self, density, direction, r, h): """setCappedCylinder(density, direction, r, h) *************** *** 113,116 **** --- 126,151 ---- dMassSetCappedCylinder(&self._mass, density, direction, r, h) + def setCappedCylinderTotal(self, total_mass, direction, r, h): + """setCappedCylinderTotal(total_mass, direction, r, h) + + Set the mass parameters to represent a capped cylinder of the + given parameters and mass, with the center of mass at + (0,0,0) relative to the body. The radius of the cylinder (and + the spherical cap) is r. The length of the cylinder (not + counting the spherical cap) is h. The cylinder's long axis is + oriented along the body's x, y or z axis according to the + value of direction (1=x, 2=y, 3=z). + + @param total_mass: The total mass of the cylinder + @param direction: The direction of the cylinder (1=x axis, 2=y axis, 3=z axis) + @param r: The radius of the cylinder + @param h: The length of the cylinder (without the caps) + @type total_mass: float + @type direction: int + @type r: float + @type h: float + """ + dMassSetCappedCylinderTotal(&self._mass, total_mass, direction, r, h) + def setCylinder(self, density, direction, r, h): """setCylinder(density, direction, r, h) *************** *** 134,137 **** --- 169,193 ---- dMassSetCylinder(&self._mass, density, direction, r, h) + def setCylinderTotal(self, total_mass, direction, r, h): + """setCylinderTotal(total_mass, direction, r, h) + + Set the mass parameters to represent a flat-ended cylinder of + the given parameters and mass, with the center of mass at + (0,0,0) relative to the body. The radius of the cylinder is r. + The length of the cylinder is h. The cylinder's long axis is + oriented along the body's x, y or z axis according to the value + of direction (1=x, 2=y, 3=z). + + @param total_mass: The total mass of the cylinder + @param direction: The direction of the cylinder (1=x axis, 2=y axis, 3=z axis) + @param r: The radius of the cylinder + @param h: The length of the cylinder + @type total_mass: float + @type direction: int + @type r: float + @type h: float + """ + dMassSetCylinderTotal(&self._mass, total_mass, direction, r, h) + def setBox(self, density, lx, ly, lz): """setBox(density, lx, ly, lz) *************** *** 153,156 **** --- 209,231 ---- dMassSetBox(&self._mass, density, lx, ly, lz) + def setBoxTotal(self, total_mass, lx, ly, lz): + """setBoxTotal(total_mass, lx, ly, lz) + + Set the mass parameters to represent a box of the given + dimensions and mass, with the center of mass at (0,0,0) + relative to the body. The side lengths of the box along the x, + y and z axes are lx, ly and lz. + + @param total_mass: The total mass of the box + @param lx: The length along the x axis + @param ly: The length along the y axis + @param lz: The length along the z axis + @type total_mass: float + @type lx: float + @type ly: float + @type lz: float + """ + dMassSetBoxTotal(&self._mass, total_mass, lx, ly, lz) + def adjust(self, newmass): """adjust(newmass) Index: declarations.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/declarations.pyx,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** declarations.pyx 13 Apr 2006 13:20:17 -0000 1.15 --- declarations.pyx 30 May 2006 14:23:44 -0000 1.16 *************** *** 297,306 **** --- 297,313 ---- dReal I12, dReal I13, dReal I23) void dMassSetSphere (dMass *, dReal density, dReal radius) + void dMassSetSphereTotal (dMass *, dReal total_mass, dReal radius) void dMassSetCappedCylinder (dMass *, dReal density, int direction, dReal a, dReal b) + void dMassSetCappedCylinderTotal (dMass *, dReal total_mass, int direction, + dReal a, dReal b) 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) |
From: Matthias B. <mb...@us...> - 2006-04-13 13:20:22
|
Update of /cvsroot/pyode/pyode/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14485/src Modified Files: declarations.pyx ode.pyx Log Message: Added the collide2() function and fixed some more doc strings Index: ode.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/ode.pyx,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ode.pyx 20 Sep 2005 15:34:17 -0000 1.13 --- ode.pyx 13 Apr 2006 13:20:17 -0000 1.14 *************** *** 182,186 **** def collide(geom1, geom2): ! """Generate contact information for two objects. Given two geometry objects that potentially touch (geom1 and geom2), --- 182,188 ---- def collide(geom1, geom2): ! """collide(geom1, geom2) -> contacts ! ! Generate contact information for two objects. Given two geometry objects that potentially touch (geom1 and geom2), *************** *** 198,201 **** --- 200,209 ---- If the objects touch, this returns a list of Contact objects, otherwise it returns an empty list. + + @param geom1: First Geom + @type geom1: GeomObject + @param geom2: Second Geom + @type geom2: GeomObject + @returns: Returns a list of Contact objects. """ *************** *** 220,226 **** return res def areConnected(Body body1, Body body2): ! """Return True if the two bodies are connected together by a joint, ! otherwise return False. """ --- 228,270 ---- return res + def collide2(geom1, geom2, arg, callback): + """collide2(geom1, geom2, arg, callback) + + Calls the callback for all potentially intersecting pairs that contain + one geom from geom1 and one geom from geom2. + + @param geom1: First Geom + @type geom1: GeomObject + @param geom2: Second Geom + @type geom2: GeomObject + @param arg: A user argument that is passed to the callback function + @param callback: Callback function + @type callback: callable + """ + cdef void* data + cdef object tup + cdef long id1 + cdef long id2 + + id1 = geom1._id() + id2 = geom2._id() + + tup = (callback, arg) + data = <void*>tup + # collide_callback is defined in space.pyx + dSpaceCollide2(<dGeomID>id1, <dGeomID>id2, data, collide_callback) + + def areConnected(Body body1, Body body2): ! """areConnected(body1, body2) -> bool ! ! Return True if the two bodies are connected together by a joint, ! otherwise return False. ! ! @param body1: First body ! @type body1: Body ! @param body2: Second body ! @type body2: Body ! @returns: True if the bodies are connected """ Index: declarations.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/declarations.pyx,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** declarations.pyx 17 Jan 2006 09:07:54 -0000 1.14 --- declarations.pyx 13 Apr 2006 13:20:17 -0000 1.15 *************** *** 321,324 **** --- 321,325 ---- 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) |
From: Matthias B. <mb...@us...> - 2006-04-13 13:20:20
|
Update of /cvsroot/pyode/pyode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14485 Modified Files: ChangeLog Log Message: Added the collide2() function and fixed some more doc strings Index: ChangeLog =================================================================== RCS file: /cvsroot/pyode/pyode/ChangeLog,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ChangeLog 17 Jan 2006 09:07:53 -0000 1.9 --- ChangeLog 13 Apr 2006 13:20:16 -0000 1.10 *************** *** 1,2 **** --- 1,9 ---- + 2006-04-13 Matthias Baas <ba...@ir...> + + * space.pyx, joints.pyx: Fixed some doc strings that generated + epydoc warnings. + * ode.pyx: Added the collide2() function (and fixed some more doc + strings). + 2006-01-17 Matthias Baas <ba...@ir...> |
From: Matthias B. <mb...@us...> - 2006-04-13 13:10:17
|
Update of /cvsroot/pyode/pyode/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5365/src Modified Files: joints.pyx space.pyx Log Message: Fixed doc strings that generated epydoc warnings Index: space.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/space.pyx,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** space.pyx 6 Jun 2005 13:05:23 -0000 1.7 --- space.pyx 13 Apr 2006 13:09:58 -0000 1.8 *************** *** 169,173 **** def collide(self, arg, callback): ! """Do collision detection. Call a callback function one or more times, for all --- 169,173 ---- def collide(self, arg, callback): ! """collide(arg, callback) Call a callback function one or more times, for all *************** *** 183,186 **** --- 183,190 ---- method) on geom1 and geom2, perhaps first determining whether to collide them at all based on other information. + + @param arg: A user argument that is passed to the callback function + @param callback: Callback function + @type callback: callable """ Index: joints.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/joints.pyx,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** joints.pyx 24 Jun 2005 16:21:42 -0000 1.8 --- joints.pyx 13 Apr 2006 13:09:58 -0000 1.9 *************** *** 430,434 **** # addTorque def addTorque(self, torque): ! """Applies the torque about the hinge axis. @param torque: Torque magnitude --- 430,436 ---- # addTorque def addTorque(self, torque): ! """addTorque(torque) ! ! Applies the torque about the hinge axis. @param torque: Torque magnitude *************** *** 545,549 **** # addForce def addForce(self, force): ! """Applies the given force in the slider's direction. @param force: Force magnitude --- 547,553 ---- # addForce def addForce(self, force): ! """addForce(force) ! ! Applies the given force in the slider's direction. @param force: Force magnitude *************** *** 668,672 **** # addTorques def addTorques(self, torque1, torque2): ! """Applies torque1 about axis 1, and torque2 about axis 2. @param torque1: Torque 1 magnitude --- 672,678 ---- # addTorques def addTorques(self, torque1, torque2): ! """addTorques(torque1, torque2) ! ! Applies torque1 about axis 1, and torque2 about axis 2. @param torque1: Torque 1 magnitude *************** *** 822,826 **** # addTorques def addTorques(self, torque1, torque2): ! """Applies torque1 about axis 1, and torque2 about axis 2. @param torque1: Torque 1 magnitude --- 828,834 ---- # addTorques def addTorques(self, torque1, torque2): ! """addTorques(torque1, torque2) ! ! Applies torque1 about axis 1, and torque2 about axis 2. @param torque1: Torque 1 magnitude *************** *** 1049,1053 **** # addTorques def addTorques(self, torque0, torque1, torque2): ! """Applies torques about the AMotor's axes. @param torque0: Torque 0 magnitude --- 1057,1063 ---- # addTorques def addTorques(self, torque0, torque1, torque2): ! """addTorques(torque0, torque1, torque2) ! ! Applies torques about the AMotor's axes. @param torque0: Torque 0 magnitude |
From: Matthias B. <mb...@us...> - 2006-01-17 09:08:02
|
Update of /cvsroot/pyode/pyode/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21008/src Modified Files: declarations.pyx geomobject.pyx Log Message: Added the getQuaternion()/setQuaternion() methods to the geom base class Index: declarations.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/declarations.pyx,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** declarations.pyx 5 May 2005 17:41:33 -0000 1.13 --- declarations.pyx 17 Jan 2006 09:07:54 -0000 1.14 *************** *** 366,371 **** --- 366,373 ---- 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 dGeomDestroy (dGeomID) void dGeomGetAABB (dGeomID, dReal aabb[6]) Index: geomobject.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/geomobject.pyx,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** geomobject.pyx 3 Mar 2005 09:36:16 -0000 1.3 --- geomobject.pyx 17 Jan 2006 09:07:54 -0000 1.4 *************** *** 189,192 **** --- 189,224 ---- return [m[0],m[1],m[2],m[4],m[5],m[6],m[8],m[9],m[10]] + def getQuaternion(self): + """getQuaternion() -> (w,x,y,z) + + Get the current orientation of the geom. If the geom is attached to + a body the returned value is the body's orientation. + """ + if not self.placeable(): + raise ValueError, "Non-placeable geoms do not have an orientation." + + cdef dQuaternion q + dGeomGetQuaternion(self.gid, q) + return (q[0],q[1],q[2],q[3]) + + def setQuaternion(self, q): + """setQuaternion(q) + + Set the orientation of the geom. If the geom is attached to a body, + the body's orientation will also be changed. + + @param q: Quaternion (w,x,y,z) + @type q: 4-sequence of floats + """ + if not self.placeable(): + raise ValueError, "Cannot set a quaternion on non-placeable geoms." + + cdef dQuaternion cq + cq[0] = q[0] + cq[1] = q[1] + cq[2] = q[2] + cq[3] = q[3] + dGeomSetQuaternion(self.gid, cq) + def getAABB(self): """getAABB() -> 6-tuple |
From: Matthias B. <mb...@us...> - 2006-01-17 09:08:02
|
Update of /cvsroot/pyode/pyode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21008 Modified Files: ChangeLog Log Message: Added the getQuaternion()/setQuaternion() methods to the geom base class Index: ChangeLog =================================================================== RCS file: /cvsroot/pyode/pyode/ChangeLog,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ChangeLog 16 Dec 2005 17:06:48 -0000 1.8 --- ChangeLog 17 Jan 2006 09:07:53 -0000 1.9 *************** *** 1,2 **** --- 1,6 ---- + 2006-01-17 Matthias Baas <ba...@ir...> + + * geomobject.pyx: Added the getQuaternion()/setQuaternion() methods + 2005-12-16 Timothy Stranex <tim...@gm...> * setup.py: Modified setup to look for ODE installations in common |
From: Timothy S. <pe...@us...> - 2005-12-16 17:07:01
|
Update of /cvsroot/pyode/pyode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13593 Modified Files: ChangeLog INSTALL setup.py Log Message: Updated setup script and updated tutorial3.py with Pierre Gay's changes. Index: setup.py =================================================================== RCS file: /cvsroot/pyode/pyode/setup.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** setup.py 8 Jul 2005 08:56:37 -0000 1.9 --- setup.py 16 Dec 2005 17:06:48 -0000 1.10 *************** *** 8,11 **** --- 8,14 ---- #ODE_BASE = '../ode' + # Set to the location of your ODE user-settings file. + #USER_SETTINGS = '../ode/config/user-settings' + # Set to True or False to force trimesh support to be enabled or disabled. #TRIMESH_SUPPORT_OVERRIDE = True *************** *** 18,32 **** from stat import * # Windows? if sys.platform=="win32": try: ! base = ODE_BASE except NameError: ! ODE_BASE = "../ode_single_trimesh" ! #ODE_BASE = "../ode_double_notrimesh" ! ! INC_DIRS = [os.path.join(ODE_BASE, "include")] ! LIB_DIRS = [os.path.join(ODE_BASE, "lib")] LIBS = ["ode", "user32"] # user32 because of the MessageBox() call CC_ARGS = ["/ML"] --- 21,37 ---- from stat import * + + base = [] + # Windows? if sys.platform=="win32": try: ! base = [ODE_BASE] except NameError: ! base = [] ! base.append("../ode_single_trimesh") ! base.append("../ode_double_notrimesh") ! LIBS = ["ode", "user32"] # user32 because of the MessageBox() call CC_ARGS = ["/ML"] *************** *** 36,55 **** try: ! base = ODE_BASE except NameError: ! ODE_BASE = "../ode" - INC_DIRS = [os.path.join(ODE_BASE, "include")] - LIB_DIRS = [os.path.join(ODE_BASE, "lib")] LIBS = ["ode", "stdc++"] CC_ARGS = [] ###################################################################### def readODEConfig(): config = {} ! ! filename = os.path.normpath(os.path.join(ODE_BASE, "config", "user-settings")) ! print 'Reading ODE configuration "%s"...' % filename try: --- 41,122 ---- try: ! base = [ODE_BASE] except NameError: ! base = [] ! base.append("/usr") ! base.append("/usr/local") ! base.append("../ode") LIBS = ["ode", "stdc++"] CC_ARGS = [] + + # Look for an ODE user-settings file. + def findODEConfig(prefix): + try: + suffix = [USER_SETTINGS] + prefix = '' + except NameError: + suffix = [os.path.join('config', 'user-settings'), + os.path.join('include', 'ode', 'config', 'user-settings'), + os.path.join('share', 'ode-0.5', 'config', 'user-settings')] + + for s in suffix: + path = os.path.normpath(os.path.join(prefix, s)) + if (os.path.exists(path)): + return path + + return None + + # Find an ODE installation. + ODE_BASE = None + for path in base: + if (not os.path.exists(path)): + continue + + c = findODEConfig(path) + if (c is None): + continue + + if (not os.path.exists(os.path.join(path, 'include'))): + continue + + if (not os.path.exists(os.path.join(path, 'lib'))): + continue + + ODE_BASE = path + break + + + if (ODE_BASE is None): + print + print "Error: ODE installation not found." + print + print "The following installation bases were checked:" + for path in base: + print " -", path + print + print 'This Python ODE wrapper assumes that you have a compiled version of' + print 'the ODE library already somewhere on your system. The path to the' + print 'ODE installation has to be set in the setup script via the variable' + print 'ODE_BASE and the path to the user-settings file has to be set via' + print 'the variable USER_SETTINGS. Please change these variables so that' + print 'they point to the actual location of your ODE installation.' + sys.exit(1) + + + print 'Using "%s" as base of ODE installation.' % ODE_BASE + + + INC_DIRS = [os.path.join(ODE_BASE, "include")] + LIB_DIRS = [os.path.join(ODE_BASE, "lib")] + ###################################################################### def readODEConfig(): config = {} ! ! filename = findODEConfig(ODE_BASE) ! print 'Reading ODE user-settings from "%s".' % filename try: *************** *** 58,62 **** print "ERROR:", e raise RuntimeError ! for line in f.readlines(): s = line.strip() --- 125,129 ---- print "ERROR:", e raise RuntimeError ! for line in f.readlines(): s = line.strip() *************** *** 103,107 **** def generate(name, trimesh_support): # Generate the trimesh_switch file ! f = file("_trimesh_switch.pyx", "wt") print >>f, '# This file was generated by the setup script and is included in ode.pyx.\n' --- 170,174 ---- def generate(name, trimesh_support): # Generate the trimesh_switch file ! f = file("_trimesh_switch.pyx", "wt") print >>f, '# This file was generated by the setup script and is included in ode.pyx.\n' *************** *** 112,116 **** print >>f, 'include "trimesh_dummy.pyx"' f.close() ! cmd = "pyrexc -o %s -I. -Isrc src/ode.pyx" % name pyrex_out = name --- 179,183 ---- print >>f, 'include "trimesh_dummy.pyx"' f.close() ! cmd = "pyrexc -o %s -I. -Isrc src/ode.pyx" % name pyrex_out = name *************** *** 141,153 **** sys.exit(err) - # Check if the ODE_BASE path does exist - if not os.path.exists(ODE_BASE): - print """This Python ODE wrapper assumes that you have a compiled version of - the ODE library already somewhere on your system. The path to the ODE - distribution has to be set in the setup script via the variable - ODE_BASE. Currently it points to "%s". - However, that path does not exist. So please change the variable inside the - script so that it points to the actual location of the ODE directory."""%ODE_BASE - sys.exit() config = readODEConfig() --- 208,211 ---- *************** *** 181,184 **** ,include_dirs=INC_DIRS ,library_dirs=LIB_DIRS ! ,extra_compile_args=CC_ARGS) ]) --- 239,242 ---- ,include_dirs=INC_DIRS ,library_dirs=LIB_DIRS ! ,extra_compile_args=CC_ARGS) ]) Index: INSTALL =================================================================== RCS file: /cvsroot/pyode/pyode/INSTALL,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** INSTALL 30 Nov 2004 08:00:21 -0000 1.4 --- INSTALL 16 Dec 2005 17:06:48 -0000 1.5 *************** *** 2,9 **** ========================================= ! Requirements: ------------- ! - Python v2.2 (or higher) http://www.python.org/ --- 2,9 ---- ========================================= ! Requirements: ------------- ! - Python v2.2 (or higher) http://www.python.org/ *************** *** 11,15 **** http://ode.org/ ! - Pyrex 0.9.3 (or higher) http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/ This is only required for PyODE development; you don't need it to install --- 11,15 ---- http://ode.org/ ! - Pyrex 0.9.3 (or higher) http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/ This is only required for PyODE development; you don't need it to install *************** *** 27,32 **** python setup.py install ! which installs the package on your system. ! See the "Installing Python Modules" manual inside your Python documentation or at http://docs.python.org/inst/inst.html if you want to customize the build process or the target location. --- 27,32 ---- python setup.py install ! which installs the package on your system. ! See the "Installing Python Modules" manual inside your Python documentation or at http://docs.python.org/inst/inst.html if you want to customize the build process or the target location. *************** *** 34,41 **** Note: It is assumed that the ODE library is already compiled and installed ! somewhere on your system. In the setup script there's a variable ODE_BASE ! that points to the base ODE directory. It might be possible that you have ! to modify this variable so that it points to the actual location on your ! system. ODE can either be compiled with or without trimesh support. The setup script --- 34,42 ---- Note: It is assumed that the ODE library is already compiled and installed ! somewhere on your system. The setup script will try to find the ODE ! installation on your system by trying several common locations. However, if the ! installation can not be found, you will have to modify the variables ODE_BASE ! and/or USER_SETTINGS at the top of the setup.py script to point to the ! installation. ODE can either be compiled with or without trimesh support. The setup script Index: ChangeLog =================================================================== RCS file: /cvsroot/pyode/pyode/ChangeLog,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ChangeLog 20 Sep 2005 15:34:17 -0000 1.7 --- ChangeLog 16 Dec 2005 17:06:48 -0000 1.8 *************** *** 1,2 **** --- 1,10 ---- + 2005-12-16 Timothy Stranex <tim...@gm...> + * setup.py: Modified setup to look for ODE installations in common + locations. + * examples/tutorial3.py: Updated with Pierre Gay's changes so that it + does not depend on cgkit or pygame. + * tests/test_xode.py: Fixed some instances of testing floats for + equality. + 2005-09-20 Matthias Baas <ba...@ir...> |
From: Timothy S. <pe...@us...> - 2005-12-16 17:06:57
|
Update of /cvsroot/pyode/pyode/examples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13593/examples Modified Files: tutorial3.py Log Message: Updated setup script and updated tutorial3.py with Pierre Gay's changes. Index: tutorial3.py =================================================================== RCS file: /cvsroot/pyode/pyode/examples/tutorial3.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tutorial3.py 27 Jun 2004 20:46:16 -0000 1.1 --- tutorial3.py 16 Dec 2005 17:06:48 -0000 1.2 *************** *** 1,254 **** ! # pyODE example 3: Collision detection ! ! import sys, os, random ! import pygame ! from pygame.locals import * ! from cgtypes import * ! from math import * ! from OpenGL.GL import * ! from OpenGL.GLU import * ! from OpenGL.GLUT import * ! import ode ! ! ! # 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() ! P = mat4(1).perspective(45,1.3333,0.2,20) ! glMultMatrixd(P.toList()) ! ! # 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 ! V = mat4(1).lookAt(1.2*vec3(2,3,4),(0.5,0.5,0), up=(0,1,0)) ! V.rotate(pi,vec3(0,1,0)) ! V = V.inverse() ! glMultMatrixd(V.toList()) ! ! ! # draw_body ! def draw_body(body): ! """Draw an ODE body. ! """ ! ! x,y,z = body.getPosition() ! R = body.getRotation() ! T = mat4() ! T[0,0] = R[0] ! T[0,1] = R[1] ! T[0,2] = R[2] ! T[1,0] = R[3] ! T[1,1] = R[4] ! T[1,2] = R[5] ! T[2,0] = R[6] ! T[2,1] = R[7] ! T[2,2] = R[8] ! T[3] = (x,y,z,1.0) ! ! glPushMatrix() ! glMultMatrixd(T.toList()) ! if body.shape=="box": ! sx,sy,sz = body.boxsize ! glScale(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 ! ! # drop_object ! def drop_object(): ! """Drop an object into the scene.""" ! ! global bodies, counter, objcount ! ! body = 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)) ) ! m = mat4().rotation(random.uniform(0,2*pi), (0,1,0)) ! body.setRotation(m.toList()) ! bodies.append(body) ! 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: ! p = vec3(b.getPosition()) ! d = p.length() ! a = max(0, 40000*(1.0-0.2*d*d)) ! p = vec3(p.x/4, p.y, p.z/4) ! b.addForce(a*p.normalize()) ! ! # 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: ! p = vec3(b.getPosition()) ! b.addForce(-1000*p.normalize()) ! 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 pygame ! passed, failed = pygame.init() ! ! # Open a window ! srf = pygame.display.set_mode((640,480), OPENGL | DOUBLEBUF) ! ! # 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 = [] ! ! # 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 ! clk = pygame.time.Clock() ! #frame=1 ! while running: ! events = pygame.event.get() ! for e in events: ! if e.type==QUIT: ! running=False ! elif e.type==KEYDOWN: ! running=False ! elif e.type==MOUSEBUTTONDOWN or e.type==MOUSEMOTION: ! pass ! ! counter+=1 ! # State 0: Drop objects ! 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 ! ! # Draw the scene ! prepare_GL() ! for b in bodies: ! draw_body(b) ! ! pygame.display.flip() ! # pygame.image.save(srf,"delme%04d.bmp"%frame) ! # frame+=1 ! ! # Simulate ! n = 2 ! for i in range(n): ! # Detect collisions and create contact joints ! space.collide((world,contactgroup), near_callback) ! ! # Simulation step ! # world.step(dt/n) ! world.quickStep(dt/n) ! ! # Remove all contact joints ! contactgroup.empty() ! ! clk.tick(fps) ! --- 1,275 ---- ! # 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 ! glScale(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 ! ! # drop_object ! def drop_object(): ! """Drop an object into the scene.""" ! ! global bodies, counter, objcount ! ! body = 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) ! 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_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 = [] ! ! # 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 = 2 ! ! 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 () |
From: Timothy S. <pe...@us...> - 2005-12-16 17:06:56
|
Update of /cvsroot/pyode/pyode/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13593/tests Modified Files: test_xode.py Log Message: Updated setup script and updated tutorial3.py with Pierre Gay's changes. Index: test_xode.py =================================================================== RCS file: /cvsroot/pyode/pyode/tests/test_xode.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_xode.py 16 Nov 2004 06:19:49 -0000 1.6 --- test_xode.py 16 Dec 2005 17:06:48 -0000 1.7 *************** *** 309,313 **** self.node2.setODEObject(Class2()) self.node3.setODEObject(Class1()) ! def testGetName(self): self.assertEqual(self.node1.getName(), 'node1') --- 309,313 ---- self.node2.setODEObject(Class2()) self.node3.setODEObject(Class1()) ! def testGetName(self): self.assertEqual(self.node1.getName(), 'node1') *************** *** 356,359 **** --- 356,363 ---- self.root = self.p.parseString(test_doc) + def assertEqualf(a, b): + self.assertEqual(feq(a, b), True) + self.assertEqualf = assertEqualf + class TestWorldParser(TestParser): def testInstance(self): *************** *** 384,388 **** self.root3 = self.p3.parseString(doc) self.quadSpace = self.root3.namedChild('space1').getODEObject() ! def testSimpleInstance(self): self.assert_(isinstance(self.simpleSpace, ode.SimpleSpace)) --- 388,392 ---- self.root3 = self.p3.parseString(doc) self.quadSpace = self.root3.namedChild('space1').getODEObject() ! def testSimpleInstance(self): self.assert_(isinstance(self.simpleSpace, ode.SimpleSpace)) *************** *** 405,409 **** self.body3 = self.root.namedChild('body3').getODEObject() self.body6 = self.root.namedChild('body6').getODEObject() ! def testInstance(self): self.assert_(isinstance(self.body1, ode.Body)) --- 409,413 ---- self.body3 = self.root.namedChild('body3').getODEObject() self.body6 = self.root.namedChild('body6').getODEObject() ! def testInstance(self): self.assert_(isinstance(self.body1, ode.Body)) *************** *** 443,447 **** self.assertEqual(self.body1.getAngularVel(), (3.0, 2.0, 1.0)) ! class TestMassParser(TestParser): def setUp(self): TestParser.setUp(self) --- 447,451 ---- self.assertEqual(self.body1.getAngularVel(), (3.0, 2.0, 1.0)) ! class TestMassParser(TestParser): def setUp(self): TestParser.setUp(self) *************** *** 577,614 **** def testAxisParamLoStop(self): ! self.assertEqual(self.joint6.getParam(ode.paramLoStop), 1.0) def testAxisParamHiStop(self): ! self.assertEqual(self.joint6.getParam(ode.paramHiStop), 2.0) def testAxisParamVel(self): ! self.assertEqual(self.joint6.getParam(ode.paramVel), 3.0) def testAxisParamFMax(self): ! self.assertEqual(self.joint6.getParam(ode.paramFMax), 4.0) def testAxisParamFudgeFactor(self): ! self.assertEqual(self.joint6.getParam(ode.paramFudgeFactor), 0.5) def testAxisParamBounce(self): ! self.assertEqual(self.joint6.getParam(ode.paramBounce), 6.0) def testAxisParamCFM(self): ! self.assertEqual(self.joint6.getParam(ode.paramCFM), 7.0) def testAxisParamStopERP(self): ! self.assertEqual(self.joint6.getParam(ode.paramStopERP), 8.0) def testAxisParamStopCFM(self): ! self.assertEqual(self.joint6.getParam(ode.paramStopCFM), 9.0) def testAxisParamSuspensionERP(self): ! self.assertEqual(self.joint8.getParam(ode.paramSuspensionERP), 2.0) def testAxisParamSuspensionCFM(self): ! self.assertEqual(self.joint8.getParam(ode.paramSuspensionCFM), 3.0) def testAxis2FudgeFactor(self): ! self.assertEqual(self.joint8.getParam(ode.ParamFudgeFactor2), 0.2) class TestGeomParser(TestParser): --- 581,618 ---- def testAxisParamLoStop(self): ! self.assertEqualf(self.joint6.getParam(ode.paramLoStop), 1.0) def testAxisParamHiStop(self): ! self.assertEqualf(self.joint6.getParam(ode.paramHiStop), 2.0) def testAxisParamVel(self): ! self.assertEqualf(self.joint6.getParam(ode.paramVel), 3.0) def testAxisParamFMax(self): ! self.assertEqualf(self.joint6.getParam(ode.paramFMax), 4.0) def testAxisParamFudgeFactor(self): ! self.assertEqualf(self.joint6.getParam(ode.paramFudgeFactor), 0.5) def testAxisParamBounce(self): ! self.assertEqualf(self.joint6.getParam(ode.paramBounce), 6.0) def testAxisParamCFM(self): ! self.assertEqualf(self.joint6.getParam(ode.paramCFM), 7.0) def testAxisParamStopERP(self): ! self.assertEqualf(self.joint6.getParam(ode.paramStopERP), 8.0) def testAxisParamStopCFM(self): ! self.assertEqualf(self.joint6.getParam(ode.paramStopCFM), 9.0) def testAxisParamSuspensionERP(self): ! self.assertEqualf(self.joint8.getParam(ode.paramSuspensionERP), 2.0) def testAxisParamSuspensionCFM(self): ! self.assertEqualf(self.joint8.getParam(ode.paramSuspensionCFM), 3.0) def testAxis2FudgeFactor(self): ! self.assertEqualf(self.joint8.getParam(ode.ParamFudgeFactor2), 0.2) class TestGeomParser(TestParser): |