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 *) |