opal-commits Mailing List for Open Physics Abstraction Layer (Page 27)
Status: Inactive
Brought to you by:
tylerstreeter
You can subscribe to this list here.
2005 |
Jan
|
Feb
(162) |
Mar
(134) |
Apr
(113) |
May
(13) |
Jun
(60) |
Jul
(18) |
Aug
(25) |
Sep
|
Oct
(2) |
Nov
(35) |
Dec
(76) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2008 |
Jan
|
Feb
|
Mar
(3) |
Apr
(8) |
May
(4) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
(1) |
Mar
(12) |
Apr
(16) |
May
(2) |
Jun
(2) |
Jul
(1) |
Aug
(1) |
Sep
(3) |
Oct
|
Nov
|
Dec
(3) |
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(15) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: tylerstreeter <tyl...@us...> - 2005-02-11 04:04:00
|
Update of /cvsroot/opal/opal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21528 Modified Files: todo.txt Log Message: various minor fixes Index: todo.txt =================================================================== RCS file: /cvsroot/opal/opal/todo.txt,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** todo.txt 11 Feb 2005 02:18:36 -0000 1.31 --- todo.txt 11 Feb 2005 04:03:44 -0000 1.32 *************** *** 32,48 **** - most structs - custom motors ! For Version 0.2.0 ================= ! * memory allocation ! - event handlers: created and destroyed by users ! - custom motors: created and destroyed by users? (must be alloc'd and dealloc'd on the same side of ! the DLL interface ! ! * Add a boolean to Solid that determines if it generates contacts at all (the docking volume shouldn't collide with anything but should generate collision events still). ! * remove address accessor to Solid transform (too dangerous for new users?) ! - solution: keep and document, or remove? For Version 0.3.0 --- 32,43 ---- - most structs - custom motors + - event handlers ! For Version 0.2.1 ================= ! * fix Blueprint, BlueprintManager access to DLL ! * fix Joints (test car demo) For Version 0.3.0 *************** *** 51,54 **** --- 46,51 ---- * add 'web' and 'doc' modules to repos + * Add a boolean to Solid that determines if it generates contacts at all (the docking volume shouldn't collide with anything but should generate collision events still). + * for most objects (e.g. joints, sensors, motors) should we have multiple create functions that each return different types, or just one create function (which returns a single type ptr), then call init in different ways to create different types? *************** *** 109,112 **** --- 106,112 ---- ============== + * remove address accessor to Solid transform (too dangerous for new users?) + - solution: keep and document, or remove? + * trigger Solids - set a boolean that makes contacts always ignored |
From: tylerstreeter <tyl...@us...> - 2005-02-11 04:03:59
|
Update of /cvsroot/opal/opal/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21528/src Modified Files: Joint.cpp Joint.h Singleton.h Log Message: various minor fixes Index: Joint.h =================================================================== RCS file: /cvsroot/opal/opal/src/Joint.h,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** Joint.h 11 Feb 2005 02:18:34 -0000 1.41 --- Joint.h 11 Feb 2005 04:03:44 -0000 1.42 *************** *** 118,123 **** /// Sets the Solids constrained by this Joint. If both Solids ! /// are NULL, this Joint will have no effect (i.e. it will be ! /// disabled). If only one of its Solids is NULL, the other Solid /// will be attached to the static environment. If both Solids are /// non-NULL, the Joint will behave normally. If both Solids refer --- 118,123 ---- /// Sets the Solids constrained by this Joint. If both Solids ! /// are NULL, this Joint will be disabled. If only one of its ! /// Solids is NULL, the other Solid /// will be attached to the static environment. If both Solids are /// non-NULL, the Joint will behave normally. If both Solids refer *************** *** 134,138 **** /// will cause a runtime error. The axis will be normalized. Note: /// BallJoints take only two perpendicular axes (0 and 2); axis 1 is ! /// automatically computed. virtual void OPAL_CALL setAxis(int axisNum, const Vec3r& axis); --- 134,139 ---- /// will cause a runtime error. The axis will be normalized. Note: /// BallJoints take only two perpendicular axes (0 and 2); axis 1 is ! /// automatically computed. This Joint's Solids must be set before ! /// calling this function. virtual void OPAL_CALL setAxis(int axisNum, const Vec3r& axis); *************** *** 141,145 **** /// Sets the anchor point for this Joint. Both Solids must be ! /// valid (non-NULL) before this is called for it to affect anything. virtual void OPAL_CALL setAnchor(const Point3r& anchor); --- 142,147 ---- /// Sets the anchor point for this Joint. Both Solids must be ! /// valid (non-NULL) before this is called for it to affect anything. ! /// This Joint's Solids must be set before calling this function. virtual void OPAL_CALL setAnchor(const Point3r& anchor); Index: Joint.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/Joint.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Joint.cpp 11 Feb 2005 02:18:34 -0000 1.11 --- Joint.cpp 11 Feb 2005 04:03:39 -0000 1.12 *************** *** 294,298 **** void Joint::setSolids(Solid* solid0, Solid* solid1) { ! if (mSolid0 == mSolid1 || (NULL == mSolid0 && NULL == mSolid1)) { mSolid0 = NULL; --- 294,300 ---- void Joint::setSolids(Solid* solid0, Solid* solid1) { ! // Note that this automatically handles the case when both are being ! // set to NULL. ! if (solid0 == solid1) { mSolid0 = NULL; Index: Singleton.h =================================================================== RCS file: /cvsroot/opal/opal/src/Singleton.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Singleton.h 7 Feb 2005 02:08:22 -0000 1.5 --- Singleton.h 11 Feb 2005 04:03:44 -0000 1.6 *************** *** 39,43 **** public: ! static TYPE& instance() { //static TYPE* mSelf)new TYPE); --- 39,43 ---- public: ! static TYPE& OPAL_CALL instance() { //static TYPE* mSelf)new TYPE); |
From: tylerstreeter <tyl...@us...> - 2005-02-11 02:19:23
|
Update of /cvsroot/opal/opal/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10327/src Modified Files: AttractorMotor.cpp AttractorMotor.h Joint.cpp Joint.h SConscript ServoMotor.h Simulator.cpp Simulator.h Space.h Added Files: SpringMotor.cpp SpringMotor.h Removed Files: DesiredPosMotor.cpp DesiredPosMotor.h Log Message: changed Space creation; renamed DesiredPosMotor to SpringMotor Index: ServoMotor.h =================================================================== RCS file: /cvsroot/opal/opal/src/ServoMotor.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** ServoMotor.h 9 Feb 2005 07:12:46 -0000 1.15 --- ServoMotor.h 11 Feb 2005 02:18:34 -0000 1.16 *************** *** 35,43 **** namespace opal { ! /// This is a Motor with an internal feedback loop, allowing more ! /// precise positioning control. It controls a single Joint axis. ! /// Depending on the desired mode of operation, it tries to achieve ! /// a desired position or velocity using up to a set maximum force. ! /// The Joint axis can be either linear or rotational. class ServoMotor : public Motor { --- 35,44 ---- namespace opal { ! /// This is a Motor with an internal feedback loop, allowing ! /// precise positioning control with minimal overshooting. It ! /// controls a single Joint axis. Depending on the desired mode of ! /// operation, it tries to achieve a desired position or velocity ! /// using up to a set maximum force. The Joint axis can be either ! /// linear or rotational. class ServoMotor : public Motor { Index: AttractorMotor.h =================================================================== RCS file: /cvsroot/opal/opal/src/AttractorMotor.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** AttractorMotor.h 9 Feb 2005 07:12:46 -0000 1.17 --- AttractorMotor.h 11 Feb 2005 02:18:34 -0000 1.18 *************** *** 37,46 **** { public: - enum Mode - { - SOLID_SOLID_MODE, - SOLID_POINT_MODE - }; - AttractorMotor(); --- 37,40 ---- *************** *** 51,58 **** virtual void OPAL_CALL init(Solid* solid0, Solid* solid1); - /// Sets up the Motor to attract a single Solid some a given point. - /// This will enable the Motor. - virtual void OPAL_CALL init(Solid* solid, const Point3r& point); - virtual void OPAL_CALL internal_update(); --- 45,48 ---- *************** *** 72,80 **** protected: - Mode mMode; - Solid* mSolid0; Solid* mSolid1; - Point3r mPoint; /// Constant used to scale attraction (repulsion if strength < 0). --- 62,67 ---- Index: Simulator.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/Simulator.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Simulator.cpp 10 Feb 2005 23:16:26 -0000 1.23 --- Simulator.cpp 11 Feb 2005 02:18:34 -0000 1.24 *************** *** 387,391 **** ++spaceIter) { ! Space* newSpace = createSpace(NULL); // for each space, loop over its list of solids --- 387,391 ---- ++spaceIter) { ! Space* newSpace = createSpace(); // for each space, loop over its list of solids *************** *** 504,510 **** } ! DesiredPosMotor* Simulator::createDesiredPosMotor() { ! DesiredPosMotor* newMotor = new DesiredPosMotor(); addMotor((Motor*)newMotor); return newMotor; --- 504,510 ---- } ! SpringMotor* Simulator::createSpringMotor() { ! SpringMotor* newMotor = new SpringMotor(); addMotor((Motor*)newMotor); return newMotor; --- DesiredPosMotor.cpp DELETED --- Index: Simulator.h =================================================================== RCS file: /cvsroot/opal/opal/src/Simulator.h,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** Simulator.h 10 Feb 2005 23:16:26 -0000 1.67 --- Simulator.h 11 Feb 2005 02:18:35 -0000 1.68 *************** *** 43,47 **** #include "ServoMotor.h" #include "AttractorMotor.h" ! #include "DesiredPosMotor.h" #include "Blueprint.h" #include "Sensor.h" --- 43,47 ---- #include "ServoMotor.h" #include "AttractorMotor.h" ! #include "SpringMotor.h" #include "Blueprint.h" #include "Sensor.h" *************** *** 157,161 **** virtual AttractorMotor* OPAL_CALL createAttractorMotor(); ! virtual DesiredPosMotor* OPAL_CALL createDesiredPosMotor(); /// Inform the Simulator of a custom Motor. Custom Motors are --- 157,161 ---- virtual AttractorMotor* OPAL_CALL createAttractorMotor(); ! virtual SpringMotor* OPAL_CALL createSpringMotor(); /// Inform the Simulator of a custom Motor. Custom Motors are *************** *** 181,185 **** // SPACES ! virtual Space* OPAL_CALL createSpace(Space* parentSpace = NULL) = 0; protected: --- 181,188 ---- // SPACES ! ! /// Creates and returns a pointer to a Space with its parent Space ! /// set to NULL. ! virtual Space* OPAL_CALL createSpace() = 0; protected: --- NEW FILE: SpringMotor.h --- /************************************************************************* * * * Open Physics Abstraction Layer * * Copyright (C) 2004-2005 * * Alan Fischer ala...@gm... * * Andres Reinot an...@re... * * Tyler Streeter tyl...@gm... * * All rights reserved. * * Web: opal.sourceforge.net * * * * 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-LGPL.txt. * * (2) The BSD-style license that is included with this library in * * the file license-BSD.txt. * * * * 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-LGPL.txt and license-BSD.txt for more details. * * * *************************************************************************/ #ifndef OPAL_SPRING_MOTOR_H #define OPAL_SPRING_MOTOR_H #include "Defines.h" #include "Motor.h" namespace opal { /// This is a spring that either 1) operates in 3 dimensions to keep /// a Solid in a desired position, or 2) operates in 3 degrees of /// rotational motion to keep a Solid in a desired orientation. It can /// also do both modes at once. class SpringMotor : public Motor { public: enum Mode { LINEAR_MODE, ANGULAR_MODE, LINEAR_AND_ANGULAR_MODE }; SpringMotor(); virtual ~SpringMotor(); /// Sets up the Motor to affect a Solid. Also specifies which /// degrees of freedom are affected by the Motor. This will /// enable the Motor. virtual void OPAL_CALL init(Solid* solid, Mode m); virtual void OPAL_CALL internal_update(); /// Sets the desired position and orientation. virtual void OPAL_CALL setDesiredTransform(const Matrix44r& transform); /// Sets the desired position. virtual void OPAL_CALL setDesiredPos(const Point3r& pos); /// Sets the desired orientation. virtual void OPAL_CALL setDesiredOrientation(const Vec3r& forward, const Vec3r& up, const Vec3r& right); virtual bool OPAL_CALL internal_dependsOn(Solid* solid); virtual void OPAL_CALL setLinearKd(real kd); virtual void OPAL_CALL setLinearKs(real ks); virtual real OPAL_CALL getLinearKd(); virtual real OPAL_CALL getLinearKs(); virtual void OPAL_CALL setAngularKd(real kd); virtual void OPAL_CALL setAngularKs(real ks); virtual real OPAL_CALL getAngularKd(); virtual real OPAL_CALL getAngularKs(); protected: Solid* mSolid; Mode mMode; Point3r mDesiredPos; Vec3r mDesiredForward; Vec3r mDesiredUp; Vec3r mDesiredRight; real mLinearKd; real mLinearKs; real mAngularKd; real mAngularKs; private: }; } #endif Index: Joint.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/Joint.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Joint.cpp 10 Feb 2005 23:16:26 -0000 1.10 --- Joint.cpp 11 Feb 2005 02:18:34 -0000 1.11 *************** *** 278,286 **** } ! void Joint::setDesiredVel(int axisNum, real value) { } ! void Joint::setMaxForce(int axisNum, real value) { } --- 278,286 ---- } ! void Joint::internal_setDesiredVel(int axisNum, real value) { } ! void Joint::internal_setMaxForce(int axisNum, real value) { } --- DesiredPosMotor.h DELETED --- Index: Space.h =================================================================== RCS file: /cvsroot/opal/opal/src/Space.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Space.h 9 Feb 2005 07:12:46 -0000 1.7 --- Space.h 11 Feb 2005 02:18:35 -0000 1.8 *************** *** 42,45 **** --- 42,49 ---- {} + /// Removes the Space from its current parent Space and adds it to + /// the new Space. + virtual void OPAL_CALL setParentSpace(Space* parentSpace) = 0; + protected: --- NEW FILE: SpringMotor.cpp --- /************************************************************************* * * * Open Physics Abstraction Layer * * Copyright (C) 2004-2005 * * Alan Fischer ala...@gm... * * Andres Reinot an...@re... * * Tyler Streeter tyl...@gm... * * All rights reserved. * * Web: opal.sourceforge.net * * * * 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-LGPL.txt. * * (2) The BSD-style license that is included with this library in * * the file license-BSD.txt. * * * * 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-LGPL.txt and license-BSD.txt for more details. * * * *************************************************************************/ #include "SpringMotor.h" #include "Solid.h" namespace opal { SpringMotor::SpringMotor() : Motor() { mSolid = NULL; mMode = LINEAR_MODE; mDesiredPos = Point3r(); mDesiredForward = Vec3r(); mDesiredUp = Vec3r(); mDesiredRight = Vec3r(); mLinearKd = (real)0.1; mLinearKs = (real)1.0; mAngularKd = (real)0.1; mAngularKs = (real)1.0; } SpringMotor::~SpringMotor() { } void SpringMotor::init(Solid* solid, Mode m) { mSolid = solid; mMode = m; mEnabled = true; } void SpringMotor::internal_update() { // note: this only applies to global position and orientation if (mEnabled) { if (LINEAR_MODE == mMode || LINEAR_AND_ANGULAR_MODE == mMode) { Vec3r error = mDesiredPos - mSolid->getPosition(); Force f; f.singleStep = true; f.type = GLOBAL_FORCE; f.vec = mLinearKs * error - mLinearKd * mSolid->getGlobalLinearVel(); mSolid->addForce(f); } if (ANGULAR_MODE == mMode || LINEAR_AND_ANGULAR_MODE == mMode) { // find cross products of actual and desired forward, up, // and right vectors; these represent the orientation error Matrix44r transform = mSolid->getTransform(); Vec3r actualForward = transform.getForward(); Vec3r actualUp = transform.getUp(); Vec3r actualRight = transform.getRight(); if (0 != actualForward.lengthSquared()) { actualForward.normalize(); } if (0 != actualUp.lengthSquared()) { actualUp.normalize(); } if (0 != actualRight.lengthSquared()) { actualRight.normalize(); } Vec3r forwardError = cross(mDesiredForward, actualForward); Vec3r upError = cross(mDesiredUp, actualUp); Vec3r rightError = cross(mDesiredRight, actualRight); if (0 != forwardError.lengthSquared()) { forwardError.normalize(); } if (0 != upError.lengthSquared()) { upError.normalize(); } if (0 != rightError.lengthSquared()) { rightError.normalize(); } // scale error vectors by the magnitude of the angles real fangle = angleBetweenPreNorm(mDesiredForward, actualForward); real uangle = angleBetweenPreNorm(mDesiredUp, actualUp); real rangle = angleBetweenPreNorm(mDesiredRight, actualRight); forwardError *= -fangle; upError *= -uangle; rightError *= -rangle; // average the vectors into one Vec3r errorAxis = (forwardError + upError + rightError) * globals::OPAL_ONE_THIRD; // use the error vector to calculate torque Force f; f.singleStep = true; f.type = GLOBAL_TORQUE; f.vec = mAngularKs * errorAxis - mAngularKd * mSolid->getGlobalAngularVel(); mSolid->addForce(f); } } } void SpringMotor::setDesiredTransform(const Matrix44r& transform) { mDesiredPos = transform.getPosition(); mDesiredForward = transform.getForward(); if (0 != mDesiredForward.lengthSquared()) { mDesiredForward.normalize(); } mDesiredUp = transform.getUp(); if (0 != mDesiredUp.lengthSquared()) { mDesiredUp.normalize(); } mDesiredRight = transform.getRight(); if (0 != mDesiredRight.lengthSquared()) { mDesiredRight.normalize(); } } void SpringMotor::setDesiredPos(const Point3r& pos) { mDesiredPos = pos; } void SpringMotor::setDesiredOrientation(const Vec3r& forward, const Vec3r& up, const Vec3r& right) { mDesiredForward = forward; if (0 != mDesiredRight.lengthSquared()) { mDesiredForward.normalize(); } mDesiredUp = up; if (0 != mDesiredUp.lengthSquared()) { mDesiredUp.normalize(); } mDesiredRight = right; if (0 != mDesiredRight.lengthSquared()) { mDesiredRight.normalize(); } } void SpringMotor::setLinearKd(real kd) { mLinearKd = kd; } void SpringMotor::setLinearKs(real ks) { mLinearKs = ks; } real SpringMotor::getLinearKd() { return mLinearKd; } real SpringMotor::getLinearKs() { return mLinearKs; } void SpringMotor::setAngularKd(real kd) { mAngularKd = kd; } void SpringMotor::setAngularKs(real ks) { mAngularKs = ks; } real SpringMotor::getAngularKd() { return mAngularKd; } real SpringMotor::getAngularKs() { return mAngularKs; } bool SpringMotor::internal_dependsOn(Solid* solid) { if (solid == mSolid) { return true; } else { return false; } } } Index: Joint.h =================================================================== RCS file: /cvsroot/opal/opal/src/Joint.h,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** Joint.h 10 Feb 2005 23:16:26 -0000 1.40 --- Joint.h 11 Feb 2005 02:18:34 -0000 1.41 *************** *** 106,115 **** real duration, bool singleStep=false); ! // Set the desired linear or angular velocity for this joint. ! virtual void OPAL_CALL setDesiredVel(int axisNum, real value); ! // Set the max force this joint can use to attain its desired velocity. ! virtual void OPAL_CALL setMaxForce(int axisNum, real value); virtual void OPAL_CALL wakeSolids(); --- 106,118 ---- real duration, bool singleStep=false); ! /// Set the desired linear or angular velocity for this joint. ! virtual void OPAL_CALL internal_setDesiredVel(int axisNum, ! real value); ! /// Set the max force this joint can use to attain its desired ! /// velocity. ! virtual void OPAL_CALL internal_setMaxForce(int axisNum, real value); + /// Wakes up this Joint's two Solids. virtual void OPAL_CALL wakeSolids(); Index: AttractorMotor.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/AttractorMotor.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** AttractorMotor.cpp 9 Feb 2005 07:12:46 -0000 1.10 --- AttractorMotor.cpp 11 Feb 2005 02:18:34 -0000 1.11 *************** *** 34,41 **** : Motor() { - mMode = SOLID_SOLID_MODE; mSolid0 = NULL; mSolid1 = NULL; - mPoint = Point3r(); mStrength = (real)1.0; mExponent = (real)1.0; --- 34,39 ---- *************** *** 48,52 **** void AttractorMotor::init(Solid* solid0, Solid* solid1) { - mMode = SOLID_SOLID_MODE; mSolid0 = solid0; mSolid1 = solid1; --- 46,49 ---- *************** *** 54,66 **** } - void AttractorMotor::init(Solid* solid, const Point3r& point) - { - mMode = SOLID_POINT_MODE; - mSolid0 = solid; - mSolid1 = NULL; - mPoint = point; - mEnabled = true; - } - void AttractorMotor::internal_update() { --- 51,54 ---- *************** *** 69,121 **** // TODO: Try including the solids' masses (i.e. f = gmm/r^2). ! if (SOLID_SOLID_MODE == mMode) ! { ! Point3r pos1 = mSolid0->getPosition(); ! Point3r pos2 = mSolid1->getPosition(); ! ! // Create a vector pointing from mSolid1 to mSolid0. ! Vec3r v = pos1 - pos2; ! Force f; ! f.singleStep = true; ! f.type = GLOBAL_FORCE; ! ! if ((real)2.0 == mExponent) ! { ! // If we know the exponent is 2, this can speed things up. ! f.vec = v * mStrength / v.lengthSquared(); ! } ! else ! { ! f.vec = v * mStrength / (pow(v.length(), mExponent)); ! } ! mSolid1->addForce(f); ! f.vec *= (real)-1.0; ! mSolid0->addForce(f); } ! else // solid-point mode { ! Point3r pos1 = mSolid0->getPosition(); ! ! // Create a vector pointing from mSolid1 to mPoint. ! Vec3r v = mPoint - pos1; ! ! Force f; ! f.singleStep = true; ! f.type = GLOBAL_FORCE; ! ! if (2.0 == mExponent) ! { ! // If we know the exponent is 2, this can speed things up. ! f.vec = v * mStrength / v.lengthSquared(); ! } ! else ! { ! f.vec = v * mStrength / (pow(v.length(), mExponent)); ! } ! ! mSolid0->addForce(f); } } } --- 57,83 ---- // TODO: Try including the solids' masses (i.e. f = gmm/r^2). ! Point3r pos1 = mSolid0->getPosition(); ! Point3r pos2 = mSolid1->getPosition(); ! // Create a vector pointing from mSolid1 to mSolid0. ! Vec3r v = pos1 - pos2; ! Force f; ! f.singleStep = true; ! f.type = GLOBAL_FORCE; ! ! if ((real)2.0 == mExponent) ! { ! // If we know the exponent is 2, this can speed things up. ! f.vec = v * mStrength / v.lengthSquared(); } ! else { ! f.vec = v * mStrength / (pow(v.length(), mExponent)); } + + mSolid1->addForce(f); + f.vec *= (real)-1.0; + mSolid0->addForce(f); } } Index: SConscript =================================================================== RCS file: /cvsroot/opal/opal/src/SConscript,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SConscript 8 Feb 2005 21:54:19 -0000 1.5 --- SConscript 11 Feb 2005 02:18:34 -0000 1.6 *************** *** 9,13 **** BlueprintManager.h Defines.h - DesiredPosMotor.h EventHandler.h FixedJoint.h --- 9,12 ---- *************** *** 31,34 **** --- 30,34 ---- Solid.h Space.h + SpringMotor.h ThrusterMotor.h UniversalJoint.h *************** *** 41,45 **** Blueprint.cpp BlueprintManager.cpp - DesiredPosMotor.cpp GearedMotor.cpp Joint.cpp --- 41,44 ---- *************** *** 49,52 **** --- 48,52 ---- Simulator.cpp Solid.cpp + SpringMotor.h ThrusterMotor.cpp """) |
From: tylerstreeter <tyl...@us...> - 2005-02-11 02:18:47
|
Update of /cvsroot/opal/opal/src/ODE In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10327/src/ODE Modified Files: ODEBallJoint.cpp ODEBallJoint.h ODEHinge2Joint.cpp ODEHinge2Joint.h ODEHingeJoint.cpp ODEHingeJoint.h ODEServoMotor.cpp ODESimulator.cpp ODESimulator.h ODESliderJoint.cpp ODESliderJoint.h ODESpace.cpp ODESpace.h ODEUniversalJoint.cpp ODEUniversalJoint.h Log Message: changed Space creation; renamed DesiredPosMotor to SpringMotor Index: ODEHingeJoint.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEHingeJoint.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** ODEHingeJoint.cpp 9 Feb 2005 07:12:47 -0000 1.31 --- ODEHingeJoint.cpp 11 Feb 2005 02:18:35 -0000 1.32 *************** *** 131,135 **** } ! void ODEHingeJoint::setDesiredVel(int axisNum, real value) { value = degToRad(value); --- 131,135 ---- } ! void ODEHingeJoint::internal_setDesiredVel(int axisNum, real value) { value = degToRad(value); *************** *** 137,141 **** } ! void ODEHingeJoint::setMaxForce(int axisNum, real value) { dJointSetHingeParam(mJointID, dParamFMax, value); --- 137,141 ---- } ! void ODEHingeJoint::internal_setMaxForce(int axisNum, real value) { dJointSetHingeParam(mJointID, dParamFMax, value); Index: ODEHinge2Joint.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEHinge2Joint.h,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** ODEHinge2Joint.h 9 Feb 2005 07:12:47 -0000 1.27 --- ODEHinge2Joint.h 11 Feb 2005 02:18:35 -0000 1.28 *************** *** 56,62 **** virtual void OPAL_CALL internal_update(); ! virtual void OPAL_CALL setDesiredVel(int axisNum, real value); ! virtual void OPAL_CALL setMaxForce(int axisNum, real value); virtual void OPAL_CALL setSolids(Solid* solid1, Solid* solid2); --- 56,62 ---- virtual void OPAL_CALL internal_update(); ! virtual void OPAL_CALL internal_setDesiredVel(int axisNum, real value); ! virtual void OPAL_CALL internal_setMaxForce(int axisNum, real value); virtual void OPAL_CALL setSolids(Solid* solid1, Solid* solid2); Index: ODESliderJoint.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESliderJoint.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** ODESliderJoint.cpp 9 Feb 2005 07:12:47 -0000 1.30 --- ODESliderJoint.cpp 11 Feb 2005 02:18:36 -0000 1.31 *************** *** 127,136 **** } ! void ODESliderJoint::setDesiredVel(int axisNum, real value) { dJointSetSliderParam (mJointID, dParamVel, value); } ! void ODESliderJoint::setMaxForce(int axisNum, real value) { dJointSetSliderParam (mJointID, dParamFMax, value); --- 127,136 ---- } ! void ODESliderJoint::internal_setDesiredVel(int axisNum, real value) { dJointSetSliderParam (mJointID, dParamVel, value); } ! void ODESliderJoint::internal_setMaxForce(int axisNum, real value) { dJointSetSliderParam (mJointID, dParamFMax, value); Index: ODEUniversalJoint.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEUniversalJoint.h,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** ODEUniversalJoint.h 9 Feb 2005 07:12:47 -0000 1.27 --- ODEUniversalJoint.h 11 Feb 2005 02:18:36 -0000 1.28 *************** *** 54,60 **** virtual void OPAL_CALL internal_update(); ! virtual void OPAL_CALL setDesiredVel(int axisNum, real value); ! virtual void OPAL_CALL setMaxForce(int axisNum, real value); virtual void OPAL_CALL setSolids(Solid* solid1, Solid* solid2); --- 54,60 ---- virtual void OPAL_CALL internal_update(); ! virtual void OPAL_CALL internal_setDesiredVel(int axisNum, real value); ! virtual void OPAL_CALL internal_setMaxForce(int axisNum, real value); virtual void OPAL_CALL setSolids(Solid* solid1, Solid* solid2); Index: ODESpace.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESpace.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ODESpace.cpp 9 Feb 2005 07:12:47 -0000 1.7 --- ODESpace.cpp 11 Feb 2005 02:18:36 -0000 1.8 *************** *** 30,37 **** namespace opal { ! ODESpace::ODESpace(dSpaceID parentSpace) : Space() { ! mSpaceID = dSimpleSpaceCreate(parentSpace); } --- 30,39 ---- namespace opal { ! ODESpace::ODESpace() : Space() { ! // Create the Space without adding it to another Space. ! mSpaceID = dSimpleSpaceCreate(0); ! mParentSpaceID = NULL; } *************** *** 39,41 **** --- 41,66 ---- { } + + void ODESpace::setParentSpace(Space* parentSpace) + { + dSpaceID tempSpaceID = + ((ODESpace*)parentSpace)->internal_getSpaceID(); + + // First remove this Space from its current parent Space, if one + // exists. + if (NULL != mParentSpaceID) + { + dSpaceRemove(mParentSpaceID, (dGeomID)mSpaceID); + } + + // Now add this Space into the new Space. + dSpaceAdd(tempSpaceID, (dGeomID)mSpaceID); + + mParentSpaceID = tempSpaceID; + } + + dSpaceID ODESpace::internal_getSpaceID()const + { + return mSpaceID; + } } Index: ODEServoMotor.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEServoMotor.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ODEServoMotor.cpp 9 Feb 2005 07:12:47 -0000 1.14 --- ODEServoMotor.cpp 11 Feb 2005 02:18:35 -0000 1.15 *************** *** 42,47 **** if (NULL != mJoint) { ! mJoint->setDesiredVel(mJointAxis, 0); ! mJoint->setMaxForce(mJointAxis, 0); } } --- 42,47 ---- if (NULL != mJoint) { ! mJoint->internal_setDesiredVel(mJointAxis, 0); ! mJoint->internal_setMaxForce(mJointAxis, 0); } } *************** *** 60,64 **** real velocity = mDesiredPos - mJoint->getAngle( mJointAxis); ! mJoint->setDesiredVel(mJointAxis, mRestoreSpeed * velocity); } --- 60,64 ---- real velocity = mDesiredPos - mJoint->getAngle( mJointAxis); ! mJoint->internal_setDesiredVel(mJointAxis, mRestoreSpeed * velocity); } *************** *** 68,72 **** real velocity = mDesiredPos - mJoint->getLinearPos( mJointAxis); ! mJoint->setDesiredVel(mJointAxis, mRestoreSpeed * velocity); } --- 68,72 ---- real velocity = mDesiredPos - mJoint->getLinearPos( mJointAxis); ! mJoint->internal_setDesiredVel(mJointAxis, mRestoreSpeed * velocity); } *************** *** 82,86 **** void ODEServoMotor::setDesiredVel(real vel) { ! mJoint->setDesiredVel(mJointAxis, vel); ServoMotor::setDesiredVel(vel); } --- 82,86 ---- void ODEServoMotor::setDesiredVel(real vel) { ! mJoint->internal_setDesiredVel(mJointAxis, vel); ServoMotor::setDesiredVel(vel); } *************** *** 88,92 **** void ODEServoMotor::setMaxForce(real max) { ! mJoint->setMaxForce(mJointAxis, max); ServoMotor::setMaxForce(max); } --- 88,92 ---- void ODEServoMotor::setMaxForce(real max) { ! mJoint->internal_setMaxForce(mJointAxis, max); ServoMotor::setMaxForce(max); } Index: ODEHinge2Joint.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEHinge2Joint.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** ODEHinge2Joint.cpp 9 Feb 2005 07:12:47 -0000 1.33 --- ODEHinge2Joint.cpp 11 Feb 2005 02:18:35 -0000 1.34 *************** *** 163,167 **** } ! void ODEHinge2Joint::setDesiredVel(int axisNum, real value) { value = degToRad(value); --- 163,167 ---- } ! void ODEHinge2Joint::internal_setDesiredVel(int axisNum, real value) { value = degToRad(value); *************** *** 182,186 **** } ! void ODEHinge2Joint::setMaxForce(int axisNum, real value) { switch(axisNum) --- 182,186 ---- } ! void ODEHinge2Joint::internal_setMaxForce(int axisNum, real value) { switch(axisNum) Index: ODEHingeJoint.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEHingeJoint.h,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** ODEHingeJoint.h 9 Feb 2005 07:12:47 -0000 1.27 --- ODEHingeJoint.h 11 Feb 2005 02:18:35 -0000 1.28 *************** *** 54,60 **** virtual void OPAL_CALL internal_update(); ! virtual void OPAL_CALL setDesiredVel(int axisNum, real value); ! virtual void OPAL_CALL setMaxForce(int axisNum, real value); virtual void OPAL_CALL setSolids(Solid* solid1, Solid* solid2); --- 54,60 ---- virtual void OPAL_CALL internal_update(); ! virtual void OPAL_CALL internal_setDesiredVel(int axisNum, real value); ! virtual void OPAL_CALL internal_setMaxForce(int axisNum, real value); virtual void OPAL_CALL setSolids(Solid* solid1, Solid* solid2); Index: ODESimulator.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESimulator.cpp,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** ODESimulator.cpp 9 Feb 2005 07:12:47 -0000 1.70 --- ODESimulator.cpp 11 Feb 2005 02:18:35 -0000 1.71 *************** *** 616,635 **** } ! Space* ODESimulator::createSpace(Space* parentSpace) { ! Space* newSpace = NULL; ! ! if (NULL == parentSpace) ! { ! newSpace = new ODESpace(mRootSpaceID); ! } ! else ! { ! newSpace = new ODESpace( ! ((ODESpace*)parentSpace)->internal_getSpaceID()); ! } ! addSpace(newSpace); - return newSpace; } --- 616,623 ---- } ! Space* ODESimulator::createSpace() { ! Space* newSpace = new ODESpace(); addSpace(newSpace); return newSpace; } Index: ODESimulator.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESimulator.h,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** ODESimulator.h 9 Feb 2005 07:12:47 -0000 1.49 --- ODESimulator.h 11 Feb 2005 02:18:36 -0000 1.50 *************** *** 86,90 **** // SPACES ! virtual Space* OPAL_CALL createSpace(Space* parentSpace = NULL); //convenience collision check function --- 86,90 ---- // SPACES ! virtual Space* OPAL_CALL createSpace(); //convenience collision check function Index: ODEBallJoint.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEBallJoint.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** ODEBallJoint.cpp 9 Feb 2005 07:12:47 -0000 1.32 --- ODEBallJoint.cpp 11 Feb 2005 02:18:35 -0000 1.33 *************** *** 167,171 **** } ! void ODEBallJoint::setDesiredVel(int axisNum, real value) { value = degToRad(value); --- 167,171 ---- } ! void ODEBallJoint::internal_setDesiredVel(int axisNum, real value) { value = degToRad(value); *************** *** 188,192 **** } ! void ODEBallJoint::setMaxForce(int axisNum, real value) { switch(axisNum) --- 188,192 ---- } ! void ODEBallJoint::internal_setMaxForce(int axisNum, real value) { switch(axisNum) Index: ODEUniversalJoint.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEUniversalJoint.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** ODEUniversalJoint.cpp 9 Feb 2005 07:12:47 -0000 1.31 --- ODEUniversalJoint.cpp 11 Feb 2005 02:18:36 -0000 1.32 *************** *** 177,181 **** } ! void ODEUniversalJoint::setDesiredVel(int axisNum, real value) { value = degToRad(value); --- 177,181 ---- } ! void ODEUniversalJoint::internal_setDesiredVel(int axisNum, real value) { value = degToRad(value); *************** *** 196,200 **** } ! void ODEUniversalJoint::setMaxForce(int axisNum, real value) { switch(axisNum) --- 196,200 ---- } ! void ODEUniversalJoint::internal_setMaxForce(int axisNum, real value) { switch(axisNum) Index: ODESpace.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESpace.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ODESpace.h 9 Feb 2005 07:12:47 -0000 1.9 --- ODESpace.h 11 Feb 2005 02:18:36 -0000 1.10 *************** *** 38,52 **** { public: ! ODESpace(dSpaceID parentSpace); virtual ~ODESpace(); ! virtual dSpaceID OPAL_CALL internal_getSpaceID()const ! { ! return mSpaceID; ! } protected: dSpaceID mSpaceID; private: --- 38,52 ---- { public: ! ODESpace(); virtual ~ODESpace(); ! virtual void OPAL_CALL setParentSpace(Space* parentSpace); ! ! virtual dSpaceID OPAL_CALL internal_getSpaceID()const; protected: dSpaceID mSpaceID; + dSpaceID mParentSpaceID; private: Index: ODESliderJoint.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESliderJoint.h,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** ODESliderJoint.h 9 Feb 2005 07:12:47 -0000 1.26 --- ODESliderJoint.h 11 Feb 2005 02:18:36 -0000 1.27 *************** *** 54,60 **** virtual void OPAL_CALL internal_update(); ! virtual void OPAL_CALL setDesiredVel(int axisNum, real value); ! virtual void OPAL_CALL setMaxForce(int axisNum, real value); virtual void OPAL_CALL setSolids(Solid* solid1, Solid* solid2); --- 54,60 ---- virtual void OPAL_CALL internal_update(); ! virtual void OPAL_CALL internal_setDesiredVel(int axisNum, real value); ! virtual void OPAL_CALL internal_setMaxForce(int axisNum, real value); virtual void OPAL_CALL setSolids(Solid* solid1, Solid* solid2); Index: ODEBallJoint.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEBallJoint.h,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** ODEBallJoint.h 9 Feb 2005 07:12:47 -0000 1.27 --- ODEBallJoint.h 11 Feb 2005 02:18:35 -0000 1.28 *************** *** 54,60 **** virtual void OPAL_CALL internal_update(); ! virtual void OPAL_CALL setDesiredVel(int axisNum, real value); ! virtual void OPAL_CALL setMaxForce(int axisNum, real value); virtual void OPAL_CALL setSolids(Solid* solid1, Solid* solid2); --- 54,60 ---- virtual void OPAL_CALL internal_update(); ! virtual void OPAL_CALL internal_setDesiredVel(int axisNum, real value); ! virtual void OPAL_CALL internal_setMaxForce(int axisNum, real value); virtual void OPAL_CALL setSolids(Solid* solid1, Solid* solid2); |
From: tylerstreeter <tyl...@us...> - 2005-02-11 02:18:46
|
Update of /cvsroot/opal/opal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10327 Modified Files: todo.txt Log Message: changed Space creation; renamed DesiredPosMotor to SpringMotor Index: todo.txt =================================================================== RCS file: /cvsroot/opal/opal/todo.txt,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** todo.txt 10 Feb 2005 23:16:22 -0000 1.30 --- todo.txt 11 Feb 2005 02:18:36 -0000 1.31 *************** *** 19,23 **** Object Properties ! - user managed vs. OPAL managed Document --- 19,24 ---- Object Properties ! - memory management: user managed vs. OPAL managed ! - initially enabled or disabled Document *************** *** 40,57 **** the DLL interface - * remove params from Space creation - - * shape class/struct - - solution: yes - - user-created (not requested from simulator or solid) - - * Motors: - - Combine DesiredPosMotor with ServoMotor since they do almost the same thing? - - ServoMotor: PID, doesn't overshoot; linear or angular; joint only - - SpringMotor (was DesiredPosMotor): kd and ks, can overshoot; linear and/or angular; solid only - - maybe also add in Attractor stuff to previous? make it really general? - - * Remove ODE-style motor functions from Joint class (e.g. setDesiredVel) - * Add a boolean to Solid that determines if it generates contacts at all (the docking volume shouldn't collide with anything but should generate collision events still). --- 41,44 ---- *************** *** 90,94 **** - examples: - SolidBP (contains many ShapeBPs, or maybe just references to them) ! - ShapeBP - JointBP: refers to SolidBPs - MotorBP: refers to SolidBPs and/or JointBPs --- 77,81 ---- - examples: - SolidBP (contains many ShapeBPs, or maybe just references to them) ! - ShapeBP (no actual Shape class, just this one) - JointBP: refers to SolidBPs - MotorBP: refers to SolidBPs and/or JointBPs |
From: tylerstreeter <tyl...@us...> - 2005-02-11 02:18:46
|
Update of /cvsroot/opal/opal/vc7 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10327/vc7 Modified Files: opal-ode.vcproj Log Message: changed Space creation; renamed DesiredPosMotor to SpringMotor Index: opal-ode.vcproj =================================================================== RCS file: /cvsroot/opal/opal/vc7/opal-ode.vcproj,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** opal-ode.vcproj 9 Feb 2005 07:12:48 -0000 1.6 --- opal-ode.vcproj 11 Feb 2005 02:18:37 -0000 1.7 *************** *** 125,131 **** </File> <File - RelativePath="..\src\DesiredPosMotor.cpp"> - </File> - <File RelativePath="..\src\GearedMotor.cpp"> </File> --- 125,128 ---- *************** *** 149,152 **** --- 146,152 ---- </File> <File + RelativePath="..\src\SpringMotor.cpp"> + </File> + <File RelativePath="..\src\ThrusterMotor.cpp"> </File> *************** *** 171,177 **** </File> <File - RelativePath="..\src\DesiredPosMotor.h"> - </File> - <File RelativePath="..\src\EventHandler.h"> </File> --- 171,174 ---- *************** *** 222,225 **** --- 219,225 ---- </File> <File + RelativePath="..\src\SpringMotor.h"> + </File> + <File RelativePath="..\src\ThrusterMotor.h"> </File> |
From: tylerstreeter <tyl...@us...> - 2005-02-10 23:17:13
|
Update of /cvsroot/opal/opal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4488 Modified Files: changelog.txt gatherCommon.py todo.txt Log Message: fixed problems with xml code conditional compilation Index: changelog.txt =================================================================== RCS file: /cvsroot/opal/opal/changelog.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** changelog.txt 6 Feb 2005 05:59:26 -0000 1.2 --- changelog.txt 10 Feb 2005 23:16:11 -0000 1.3 *************** *** 1,9 **** ! Version 0.1.7 ------------- * Changed build systems from make to SCons * Changed build systems to produce a shared library on all platforms ! * Added Blueprint classes for XML loading ! * Added garbage collector to allow object destruction at any time ! * Added trimesh object to ODE version * Numerous API changes --- 1,10 ---- ! Version 0.2.0 ------------- * Changed build systems from make to SCons * Changed build systems to produce a shared library on all platforms ! * Added XML loading ! * Added garbage collector to allow safe object destruction at any time ! * Added mesh shapes ! * Added Sensor objects * Numerous API changes Index: todo.txt =================================================================== RCS file: /cvsroot/opal/opal/todo.txt,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** todo.txt 9 Feb 2005 07:12:44 -0000 1.29 --- todo.txt 10 Feb 2005 23:16:22 -0000 1.30 *************** *** 32,73 **** - custom motors ! Immediate ! ========= ! ! * add 'web' and 'doc' modules to repos ! ! * for most objects (e.g. joints, sensors, motors) should we have multiple create functions that each return different types, or just one create function (which returns a single type ptr), then call init in different ways to create different types? ! * almost every member function should check if (enabled) at the beginning? * remove params from Space creation - * "desc" (description) classes - - overloaded init functions (or "loadFromDesc") can take these instead of individual params - - objects each have "saveToDesc(desc&)" functions - - how do different descs refer to other objects? by name? by int id? - - examples: - - SolidDesc (contains many ShapeDescs, or maybe just references to them) - - ShapeDesc - - JointDesc: refers to SolidDescs - - MotorDesc: refers to SolidDescs and/or JointDescs - - SensorDesc: refers to SolidDescs - - * sensors - - need an update function - - types: - - RayCastSensor (i.e. "PSD (position sensitive detector)" or "rangefinder"): measures distance from sensor to first intersection (attach to a solid [be sure to ignore collisions with the attached solid] or nothing) - - ContactSensor: holds a queue of contact events (attach to a solid, to a single shape, or to nothing?) - - VelocitySensor: linear vel (i.e. "velocimeter") and/or angular vel ("gyroscope") sensor - - AccelerationSensor (i.e. "accelerometer"): linear and/or angular acceleration sensor - - InclineSensor (i.e. "inclinometer"): measures angle between initial and current orientation - * shape class/struct - solution: yes - user-created (not requested from simulator or solid) - * separate Solid options for sleeping (wakeUp, putToSleep, disable/enable sleeping) - - per-object sleepiness - * Motors: - Combine DesiredPosMotor with ServoMotor since they do almost the same thing? --- 32,49 ---- - custom motors ! For Version 0.2.0 ! ================= ! * memory allocation ! - event handlers: created and destroyed by users ! - custom motors: created and destroyed by users? (must be alloc'd and dealloc'd on the same side of ! the DLL interface * remove params from Space creation * shape class/struct - solution: yes - user-created (not requested from simulator or solid) * Motors: - Combine DesiredPosMotor with ServoMotor since they do almost the same thing? *************** *** 83,89 **** - solution: keep and document, or remove? ! * XML/blueprint - update parsing - update instantiation functions * event handling/callbacks --- 59,106 ---- - solution: keep and document, or remove? ! For Version 0.3.0 ! ================= ! ! * add 'web' and 'doc' modules to repos ! ! * for most objects (e.g. joints, sensors, motors) should we have multiple create functions that each return different types, or just one create function (which returns a single type ptr), then call init in different ways to create different types? ! ! * separate Solid options for sleeping (setSleeping(true/false), setSleepingEnabled(true/false)) ! - per-Solid sleepiness ! ! * calculate actual kd and ks for joints from erp/cfm ! - another option: don't let users change this for joints: make them use the motors instead ! - or, just have a 'restitution' parameter per joint axis ! ! * materials ! - have a 'restitution' parameter to replace some others ! ! * implement sensors ! - RayCastSensor (i.e. "PSD (position sensitive detector)" or "rangefinder"): measures distance from sensor to first intersection (attach to a solid [be sure to ignore collisions with the attached solid] or nothing) ! - ContactSensor: holds a queue of contact events (attach to a solid, to a single shape, or to nothing?) ! - VelocitySensor: linear vel (i.e. "velocimeter") and/or angular vel ("gyroscope") sensor ! - AccelerationSensor (i.e. "accelerometer"): linear and/or angular acceleration sensor ! - InclineSensor (i.e. "inclinometer"): measures angle between initial and current orientation ! ! * "BP" (blueprint) classes ! - search and replace "blueprint" with "BP", except for the base Blueprint class ! - overloaded init functions (or "loadFromDesc") can take these instead of individual params ! - objects each have "saveToDesc(desc&)" functions ! - how do different descs refer to other objects? by name? by int id? ! - examples: ! - SolidBP (contains many ShapeBPs, or maybe just references to them) ! - ShapeBP ! - JointBP: refers to SolidBPs ! - MotorBP: refers to SolidBPs and/or JointBPs ! - SensorBP: refers to SolidBPs ! - CompoundBP: contains/refers to lots of other BPs ! ! * XML loader, manager - update parsing - update instantiation functions + - maybe rename BlueprintManager to ResourceManager + - holds a cache of BPs + - BPs can be added through XML files or manually + - BPs can be requested by name/ID * event handling/callbacks *************** *** 126,132 **** - shapes simply use a material name - * calculate actual kd and ks for joints from erp/cfm - - another option: don't let users change this for joints: make them use the motors instead - * try to fix weird inheritance with Joint, ODEJoint, HingeJoint, ODEHingeJoint, etc. (look at Novodex sdk for ideas) --- 143,146 ---- *************** *** 143,153 **** * make an 'enable acceleration calculations' function so they don't get calculated unnecessarily - solution: flag which pieces of the solid state are kept up to date (local/global accelerations, prev velocities, etc) * make sure everything is stepsize independent ! ! * memory allocation ! - event handlers: created and destroyed by users ! - custom motors: created and destroyed by users? (must be alloc'd and dealloc'd on the same side of ! the DLL interface * Sample apps using OGRE --- 157,164 ---- * make an 'enable acceleration calculations' function so they don't get calculated unnecessarily - solution: flag which pieces of the solid state are kept up to date (local/global accelerations, prev velocities, etc) + - better solution: use acceleration sensor * make sure everything is stepsize independent ! - maybe pass dt to all update functions, especially motors * Sample apps using OGRE Index: gatherCommon.py =================================================================== RCS file: /cvsroot/opal/opal/gatherCommon.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** gatherCommon.py 3 Feb 2005 19:44:11 -0000 1.1 --- gatherCommon.py 10 Feb 2005 23:16:22 -0000 1.2 *************** *** 4,8 **** from types import ListType ! versionString = '0.1.7' # Add path as a prefix to each element of filenames --- 4,8 ---- from types import ListType ! versionString = '0.2.0' # Add path as a prefix to each element of filenames |
From: tylerstreeter <tyl...@us...> - 2005-02-10 23:17:11
|
Update of /cvsroot/opal/opal/samples/simple_objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4488/samples/simple_objects Modified Files: main.cpp Log Message: fixed problems with xml code conditional compilation Index: main.cpp =================================================================== RCS file: /cvsroot/opal/opal/samples/simple_objects/main.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** main.cpp 9 Feb 2005 07:12:45 -0000 1.13 --- main.cpp 10 Feb 2005 23:16:22 -0000 1.14 *************** *** 73,76 **** --- 73,81 ---- gGround->addPlane(gGroundParams, gGroundMaterial); + opal::Blueprint bp; + bp.setName("hi"); + bp.getNumSolids(); + //gSimulator->instantiateBlueprint(bp); + std::cout << "==============================================" << std::endl; std::cout << " OPAL Objects Test" << std::endl; |
From: tylerstreeter <tyl...@us...> - 2005-02-10 23:16:55
|
Update of /cvsroot/opal/opal/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4488/src Modified Files: Blueprint.cpp Blueprint.h BlueprintManager.cpp BlueprintManager.h Defines.h Joint.cpp Joint.h Simulator.cpp Simulator.h Solid.cpp Solid.h Log Message: fixed problems with xml code conditional compilation Index: Blueprint.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/Blueprint.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Blueprint.cpp 9 Feb 2005 07:12:46 -0000 1.8 --- Blueprint.cpp 10 Feb 2005 23:16:24 -0000 1.9 *************** *** 26,31 **** *************************************************************************/ - #ifdef OPAL_USE_XML - #include "Blueprint.h" --- 26,29 ---- *************** *** 135,138 **** } } - - #endif --- 133,134 ---- Index: Defines.h =================================================================== RCS file: /cvsroot/opal/opal/src/Defines.h,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** Defines.h 8 Feb 2005 21:54:09 -0000 1.47 --- Defines.h 10 Feb 2005 23:16:26 -0000 1.48 *************** *** 272,275 **** --- 272,423 ---- Material material; }; + + // Structs used for Blueprints... + + struct UserProperty + { + std::string name; + std::string value; + }; + + struct SolidDescription + { + ~SolidDescription() + { + shapeList.clear(); + userProperties.clear(); + } + + std::string name; + Matrix44r transform; + bool isStatic; + real linearDamping; + real angularDamping; + std::vector<ShapeDescription> shapeList; + std::vector<UserProperty> userProperties; + }; + + // anchor and axes here are in global coordinates + struct JointDescription + { + std::string name; + JointType type; + std::string solid1Name; + std::string solid2Name; + real kd; + real ks; + Point3r anchor; + Vec3r axis0; + Vec3r axis1; + Vec3r axis2; + bool axis0LimitsEnabled; + bool axis1LimitsEnabled; + bool axis2LimitsEnabled; + real lowLimit0; + real highLimit0; + real lowLimit1; + real highLimit1; + real lowLimit2; + real highLimit2; + + // see Joint class for a description of these parameters + JointBreakMode breakMode; + real breakThresh; + real accumThresh; + }; + + struct SpaceDescription + { + ~SpaceDescription() + { + solidNameList.clear(); + } + + bool containsSolid(const std::string& name) + { + std::vector<std::string>::iterator iter; + for (iter = solidNameList.begin(); iter != solidNameList.end(); + ++iter) + { + if (name == (*iter)) + { + return true; + } + } + + return false; + } + + std::vector<std::string> solidNameList; + }; + + struct SolidData + { + ~SolidData() + { + userProperties.clear(); + } + + std::string getUserProperty(std::string name) + { + std::map<std::string, std::string>::iterator iter = + userProperties.find(name); + if (userProperties.end() != iter) + { + return (*iter).second; + } + else + { + return ""; + } + } + + Solid* solidPtr; + std::map<std::string, std::string> userProperties; + }; + + // For giving users lists of pointers to solids and joints created from + // blueprints; pointers can be accessed by individual names. + struct NamedObjectCollection + { + ~NamedObjectCollection() + { + solidMap.clear(); + jointMap.clear(); + } + + SolidData getSolid(std::string name) + { + if (solidMap.end() == solidMap.find(name)) + { + //std::cout << "Error in opal::NamedObjectCollection::getSolid: Invalid solid requested: " + // << name << std::endl; + SolidData sd; + sd.solidPtr = NULL; + return sd; + } + else + { + return solidMap[name]; + } + } + + Joint* getJoint(std::string name) + { + if (jointMap.end() == jointMap.find(name)) + { + //std::cout << "Error in opal::NamedObjectCollection::getJoint: Invalid joint requested: " + // << name << std::endl; + return NULL; + } + else + { + return jointMap[name]; + } + } + + std::map<std::string, SolidData> solidMap; + std::map<std::string, Joint*> jointMap; + }; } Index: Simulator.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/Simulator.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Simulator.cpp 9 Feb 2005 07:12:46 -0000 1.22 --- Simulator.cpp 10 Feb 2005 23:16:26 -0000 1.23 *************** *** 222,226 **** } - #ifdef OPAL_USE_XML NamedObjectCollection Simulator::instantiateBlueprint( const Blueprint& bp) --- 222,225 ---- *************** *** 402,406 **** return coll; } - #endif void Simulator::setMaxLinearVel(real max) --- 401,404 ---- Index: Simulator.h =================================================================== RCS file: /cvsroot/opal/opal/src/Simulator.h,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** Simulator.h 9 Feb 2005 07:12:46 -0000 1.66 --- Simulator.h 10 Feb 2005 23:16:26 -0000 1.67 *************** *** 75,82 **** virtual void OPAL_CALL setStepSize(real stepSize); - #ifdef OPAL_USE_XML virtual NamedObjectCollection OPAL_CALL instantiateBlueprint( const Blueprint& bp); - #endif // convenience collision check function --- 75,80 ---- Index: Solid.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/Solid.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Solid.cpp 9 Feb 2005 07:12:46 -0000 1.15 --- Solid.cpp 10 Feb 2005 23:16:26 -0000 1.16 *************** *** 164,168 **** void Solid::addForce(const Force& f) { ! mForceList.push_back(f); } --- 164,171 ---- void Solid::addForce(const Force& f) { ! if (mEnabled) ! { ! mForceList.push_back(f); ! } } Index: BlueprintManager.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/BlueprintManager.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** BlueprintManager.cpp 9 Feb 2005 07:12:46 -0000 1.17 --- BlueprintManager.cpp 10 Feb 2005 23:16:26 -0000 1.18 *************** *** 26,33 **** *************************************************************************/ - #ifdef OPAL_USE_XML - #include "BlueprintManager.h" namespace opal { --- 26,35 ---- *************************************************************************/ #include "BlueprintManager.h" + #ifdef OPAL_USE_XML + #include <tinyxml/tinyxml.h> + #endif + namespace opal { *************** *** 80,83 **** --- 82,86 ---- } + #ifdef OPAL_USE_XML void BlueprintManager::loadFile(const std::string& filename) { *************** *** 773,776 **** --- 776,780 ---- } } + #endif // End of XML functions. Blueprint* BlueprintManager::getBlueprint(const std::string& name) *************** *** 790,793 **** } } - - #endif --- 794,795 ---- Index: Joint.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/Joint.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Joint.cpp 8 Feb 2005 04:59:05 -0000 1.9 --- Joint.cpp 10 Feb 2005 23:16:26 -0000 1.10 *************** *** 233,252 **** bool singleStep) { ! Force f; ! f.singleStep = singleStep; ! ! // We only care about the duration if this is not a single-step force. ! if (!f.singleStep) { ! f.timeLeft = duration; ! } ! f.type = LOCAL_FORCE; ! Vec3r direction = getAxis(jointAxisNum); ! f.vec = magnitude * direction; ! mSolid0->addForce(f); ! f.vec *= (real)-1.0; ! mSolid1->addForce(f); } --- 233,255 ---- bool singleStep) { ! if (mEnabled) { ! Force f; ! f.singleStep = singleStep; ! // We only care about the duration if this is not a single-step force. ! if (!f.singleStep) ! { ! f.timeLeft = duration; ! } ! f.type = LOCAL_FORCE; ! Vec3r direction = getAxis(jointAxisNum); ! f.vec = magnitude * direction; ! ! mSolid0->addForce(f); ! f.vec *= (real)-1.0; ! mSolid1->addForce(f); ! } } *************** *** 254,273 **** bool singleStep) { ! Force f; ! f.singleStep = singleStep; ! ! // We only care about the duration if this is not a single-step force. ! if (!f.singleStep) { ! f.timeLeft = duration; ! } ! f.type = LOCAL_TORQUE; ! Vec3r axis = getAxis(jointAxisNum); ! f.vec = magnitude * axis; ! mSolid0->addForce(f); ! f.vec *= (real)-1.0; ! mSolid1->addForce(f); } --- 257,279 ---- bool singleStep) { ! if (mEnabled) { ! Force f; ! f.singleStep = singleStep; ! // We only care about the duration if this is not a single-step force. ! if (!f.singleStep) ! { ! f.timeLeft = duration; ! } ! f.type = LOCAL_TORQUE; ! Vec3r axis = getAxis(jointAxisNum); ! f.vec = magnitude * axis; ! ! mSolid0->addForce(f); ! f.vec *= (real)-1.0; ! mSolid1->addForce(f); ! } } Index: BlueprintManager.h =================================================================== RCS file: /cvsroot/opal/opal/src/BlueprintManager.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** BlueprintManager.h 9 Feb 2005 07:12:46 -0000 1.10 --- BlueprintManager.h 10 Feb 2005 23:16:26 -0000 1.11 *************** *** 26,31 **** *************************************************************************/ - #ifdef OPAL_USE_XML - #ifndef OPAL_BLUEPRINT_MANAGER_H #define OPAL_BLUEPRINT_MANAGER_H --- 26,29 ---- *************** *** 34,38 **** #include "Singleton.h" #include "Blueprint.h" ! #include <tinyxml/tinyxml.h> namespace opal --- 32,37 ---- #include "Singleton.h" #include "Blueprint.h" ! ! class TiXmlNode; namespace opal *************** *** 84,87 **** #endif - - #endif --- 83,84 ---- Index: Joint.h =================================================================== RCS file: /cvsroot/opal/opal/src/Joint.h,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** Joint.h 9 Feb 2005 07:12:46 -0000 1.39 --- Joint.h 10 Feb 2005 23:16:26 -0000 1.40 *************** *** 96,102 **** virtual real OPAL_CALL getLinearPosRate(int axisNum)const; virtual void OPAL_CALL addForce(int jointAxisNum, real magnitude, real duration, bool singleStep=false); ! virtual void OPAL_CALL addTorque(int jointAxisNum, real magnitude, real duration, bool singleStep=false); --- 96,106 ---- virtual real OPAL_CALL getLinearPosRate(int axisNum)const; + /// Applies a force to this Joint's Solids. This does nothing if + /// the Joint is disabled. virtual void OPAL_CALL addForce(int jointAxisNum, real magnitude, real duration, bool singleStep=false); ! ! /// Applies a torque to this Joint's Solids. This does nothing if ! /// the Joint is disabled. virtual void OPAL_CALL addTorque(int jointAxisNum, real magnitude, real duration, bool singleStep=false); Index: Blueprint.h =================================================================== RCS file: /cvsroot/opal/opal/src/Blueprint.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Blueprint.h 9 Feb 2005 07:12:46 -0000 1.15 --- Blueprint.h 10 Feb 2005 23:16:26 -0000 1.16 *************** *** 26,31 **** *************************************************************************/ - #ifdef OPAL_USE_XML - #ifndef OPAL_BLUEPRINT_H #define OPAL_BLUEPRINT_H --- 26,29 ---- *************** *** 35,186 **** namespace opal { ! struct UserProperty ! { ! std::string name; ! std::string value; ! }; ! ! struct SolidDescription ! { ! ~SolidDescription() ! { ! shapeList.clear(); ! userProperties.clear(); ! } ! ! std::string name; ! Matrix44r transform; ! bool isStatic; ! real linearDamping; ! real angularDamping; ! std::vector<ShapeDescription> shapeList; ! std::vector<UserProperty> userProperties; ! }; ! ! // anchor and axes here are in global coordinates ! struct JointDescription ! { ! std::string name; ! JointType type; ! std::string solid1Name; ! std::string solid2Name; ! real kd; ! real ks; ! Point3r anchor; ! Vec3r axis0; ! Vec3r axis1; ! Vec3r axis2; ! bool axis0LimitsEnabled; ! bool axis1LimitsEnabled; ! bool axis2LimitsEnabled; ! real lowLimit0; ! real highLimit0; ! real lowLimit1; ! real highLimit1; ! real lowLimit2; ! real highLimit2; ! ! // see Joint class for a description of these parameters ! JointBreakMode breakMode; ! real breakThresh; ! real accumThresh; ! }; ! ! struct SpaceDescription ! { ! ~SpaceDescription() ! { ! solidNameList.clear(); ! } ! ! bool containsSolid(const std::string& name) ! { ! std::vector<std::string>::iterator iter; ! for (iter = solidNameList.begin(); iter != solidNameList.end(); ! ++iter) ! { ! if (name == (*iter)) ! { ! return true; ! } ! } ! ! return false; ! } ! ! std::vector<std::string> solidNameList; ! }; ! ! struct SolidData ! { ! ~SolidData() ! { ! userProperties.clear(); ! } ! ! std::string getUserProperty(std::string name) ! { ! std::map<std::string, std::string>::iterator iter = ! userProperties.find(name); ! if (userProperties.end() != iter) ! { ! return (*iter).second; ! } ! else ! { ! return ""; ! } ! } ! ! Solid* solidPtr; ! std::map<std::string, std::string> userProperties; ! }; ! ! // For giving users lists of pointers to solids and joints created from ! // blueprints; pointers can be accessed by individual names. ! struct NamedObjectCollection ! { ! ~NamedObjectCollection() ! { ! solidMap.clear(); ! jointMap.clear(); ! } ! ! SolidData getSolid(std::string name) ! { ! if (solidMap.end() == solidMap.find(name)) ! { ! //std::cout << "Error in opal::NamedObjectCollection::getSolid: Invalid solid requested: " ! // << name << std::endl; ! SolidData sd; ! sd.solidPtr = NULL; ! return sd; ! } ! else ! { ! return solidMap[name]; ! } ! } ! ! Joint* getJoint(std::string name) ! { ! if (jointMap.end() == jointMap.find(name)) ! { ! //std::cout << "Error in opal::NamedObjectCollection::getJoint: Invalid joint requested: " ! // << name << std::endl; ! return NULL; ! } ! else ! { ! return jointMap[name]; ! } ! } ! ! std::map<std::string, SolidData> solidMap; ! std::map<std::string, Joint*> jointMap; ! }; ! ! // for storing a description of a "compound solid" (e.g. multiple solids with joints, ! // multiple solids without joints, or just a single solid) class Blueprint --- 33,38 ---- namespace opal { ! /// Blueprints are for storing a descriptions of groups of Solids, ! /// Joints, Motors, and/or Sensors. class Blueprint *************** *** 226,229 **** #endif - - #endif --- 78,79 ---- Index: Solid.h =================================================================== RCS file: /cvsroot/opal/opal/src/Solid.h,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** Solid.h 9 Feb 2005 07:12:46 -0000 1.67 --- Solid.h 10 Feb 2005 23:16:26 -0000 1.68 *************** *** 50,62 **** /// Sets whether the Solid can collide with other Solids and be ! /// physically simulated. virtual void OPAL_CALL setEnabled(bool e); /// Update the OPAL Solid's transform using the transform from the ! /// object within the actual physics engine virtual void OPAL_CALL internal_updateTransform() = 0; /// Update the transform within the actual physics engine using the ! /// OPAL Solid's transform virtual void OPAL_CALL internal_uploadTransformChanges() = 0; --- 50,63 ---- /// Sets whether the Solid can collide with other Solids and be ! /// physically simulated. Forces applied to this Solid while ! /// disabled will be ignored. virtual void OPAL_CALL setEnabled(bool e); /// Update the OPAL Solid's transform using the transform from the ! /// object within the actual physics engine. virtual void OPAL_CALL internal_updateTransform() = 0; /// Update the transform within the actual physics engine using the ! /// OPAL Solid's transform. virtual void OPAL_CALL internal_uploadTransformChanges() = 0; *************** *** 100,104 **** virtual Quaternion OPAL_CALL getQuaternion()const; ! virtual void OPAL_CALL addBox(const Vec3r& dimensions, const Matrix44r& offset = Matrix44r(), --- 101,105 ---- virtual Quaternion OPAL_CALL getQuaternion()const; ! virtual void OPAL_CALL addBox(const Vec3r& dimensions, const Matrix44r& offset = Matrix44r(), *************** *** 143,146 **** --- 144,148 ---- //virtual void addCHull(); + /// Applies a force/torque to this Solid. virtual void OPAL_CALL addForce(const Force& f); |
From: Alan F. <pal...@us...> - 2005-02-09 21:34:21
|
Update of /cvsroot/opal/opal/vc6 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25859/vc6 Modified Files: opalode.dsp Log Message: Index: opalode.dsp =================================================================== RCS file: /cvsroot/opal/opal/vc6/opalode.dsp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** opalode.dsp 1 Feb 2005 16:57:22 -0000 1.1 --- opalode.dsp 9 Feb 2005 21:34:08 -0000 1.2 *************** *** 69,73 **** # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OPALODE_EXPORTS" /YX /FD /GZ /c ! # ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OPALODE_EXPORTS" /YX /FD /GZ /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 --- 69,73 ---- # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OPALODE_EXPORTS" /YX /FD /GZ /c ! # ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OPALODE_EXPORTS" /D "OPAL_DLL_EXPORTING" /YX /FD /GZ /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 *************** *** 92,180 **** # Begin Source File ! SOURCE=..\..\src\ODE\ODEBallJoint.cpp # End Source File # Begin Source File ! SOURCE=..\..\src\ODE\ODEBallJoint.h # End Source File # Begin Source File ! SOURCE=..\..\src\ODE\ODEFixedJoint.cpp # End Source File # Begin Source File ! SOURCE=..\..\src\ODE\ODEFixedJoint.h # End Source File # Begin Source File ! SOURCE=..\..\src\ODE\ODEHinge2Joint.cpp # End Source File # Begin Source File ! SOURCE=..\..\src\ODE\ODEHinge2Joint.h # End Source File # Begin Source File ! SOURCE=..\..\src\ODE\ODEHingeJoint.cpp # End Source File # Begin Source File ! SOURCE=..\..\src\ODE\ODEHingeJoint.h # End Source File # Begin Source File ! SOURCE=..\..\src\ODE\ODEJoint.cpp # End Source File # Begin Source File ! SOURCE=..\..\src\ODE\ODEJoint.h # End Source File # Begin Source File ! SOURCE=..\..\src\ODE\ODEServoMotor.cpp # End Source File # Begin Source File ! SOURCE=..\..\src\ODE\ODEServoMotor.h # End Source File # Begin Source File ! SOURCE=..\..\src\ODE\ODESimulator.cpp # End Source File # Begin Source File ! SOURCE=..\..\src\ODE\ODESimulator.h # End Source File # Begin Source File ! SOURCE=..\..\src\ODE\ODESliderJoint.cpp # End Source File # Begin Source File ! SOURCE=..\..\src\ODE\ODESliderJoint.h # End Source File # Begin Source File ! SOURCE=..\..\src\ODE\ODESolid.cpp # End Source File # Begin Source File ! SOURCE=..\..\src\ODE\ODESolid.h # End Source File # Begin Source File ! SOURCE=..\..\src\ODE\ODESpace.cpp # End Source File # Begin Source File ! SOURCE=..\..\src\ODE\ODESpace.h # End Source File # Begin Source File ! SOURCE=..\..\src\ODE\ODEUniversalJoint.cpp # End Source File # Begin Source File ! SOURCE=..\..\src\ODE\ODEUniversalJoint.h # End Source File # End Group --- 92,348 ---- # Begin Source File ! SOURCE=..\src\AttractorMotor.cpp # End Source File # Begin Source File ! SOURCE=..\src\AttractorMotor.h # End Source File # Begin Source File ! SOURCE=..\src\BallJoint.h # End Source File # Begin Source File ! SOURCE=..\src\Blueprint.cpp # End Source File # Begin Source File ! SOURCE=..\src\Blueprint.h # End Source File # Begin Source File ! SOURCE=..\src\BlueprintManager.cpp # End Source File # Begin Source File ! SOURCE=..\src\BlueprintManager.h # End Source File # Begin Source File ! SOURCE=..\src\Defines.h # End Source File # Begin Source File ! SOURCE=..\src\DesiredPosMotor.cpp # End Source File # Begin Source File ! SOURCE=..\src\DesiredPosMotor.h # End Source File # Begin Source File ! SOURCE=..\src\EventHandler.h # End Source File # Begin Source File ! SOURCE=..\src\FixedJoint.h # End Source File # Begin Source File ! SOURCE=..\src\GearedMotor.cpp # End Source File # Begin Source File ! SOURCE=..\src\GearedMotor.h # End Source File # Begin Source File ! SOURCE=..\src\Hinge2Joint.h # End Source File # Begin Source File ! SOURCE=..\src\HingeJoint.h # End Source File # Begin Source File ! SOURCE=..\src\Joint.cpp # End Source File # Begin Source File ! SOURCE=..\src\Joint.h # End Source File # Begin Source File ! SOURCE=..\src\Matrix44r.h # End Source File # Begin Source File ! SOURCE=..\src\Motor.cpp # End Source File # Begin Source File ! SOURCE=..\src\Motor.h # End Source File # Begin Source File ! SOURCE=..\src\ODE\ODEBallJoint.cpp ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\ODE\ODEBallJoint.h ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\ODE\ODEFixedJoint.cpp ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\ODE\ODEFixedJoint.h ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\ODE\ODEHinge2Joint.cpp ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\ODE\ODEHinge2Joint.h ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\ODE\ODEHingeJoint.cpp ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\ODE\ODEHingeJoint.h ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\ODE\ODEJoint.cpp ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\ODE\ODEJoint.h ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\ODE\ODEServoMotor.cpp ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\ODE\ODEServoMotor.h ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\ODE\ODESimulator.cpp ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\ODE\ODESimulator.h ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\ODE\ODESliderJoint.cpp ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\ODE\ODESliderJoint.h ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\ODE\ODESolid.cpp ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\ODE\ODESolid.h ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\ODE\ODESpace.cpp ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\ODE\ODESpace.h ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\ODE\ODEUniversalJoint.cpp ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\ODE\ODEUniversalJoint.h ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\opal.h ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\OpalMath.h ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\Point3r.h ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\Portability.h ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\Quaternion.h ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\Rayr.h ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\Sensor.cpp ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\Sensor.h ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\ServoMotor.cpp ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\ServoMotor.h ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\Simulator.cpp ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\Simulator.h ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\Singleton.h ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\SliderJoint.h ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\Solid.cpp ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\Solid.h ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\Space.h ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\ThrusterMotor.cpp ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\ThrusterMotor.h ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\UniversalJoint.h ! # End Source File ! # Begin Source File ! ! SOURCE=..\src\Vec3r.h # End Source File # End Group |
Update of /cvsroot/opal/opal/src/ODE In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14586/src/ODE Modified Files: ODEBallJoint.cpp ODEBallJoint.h ODEFixedJoint.cpp ODEFixedJoint.h ODEHinge2Joint.cpp ODEHinge2Joint.h ODEHingeJoint.cpp ODEHingeJoint.h ODEJoint.cpp ODEJoint.h ODEServoMotor.cpp ODEServoMotor.h ODESimulator.cpp ODESimulator.h ODESliderJoint.cpp ODESliderJoint.h ODESolid.cpp ODESolid.h ODESpace.cpp ODESpace.h ODEUniversalJoint.cpp ODEUniversalJoint.h Log Message: removed destroy functions and made destructors public again Index: ODEJoint.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEJoint.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** ODEJoint.cpp 8 Feb 2005 04:59:05 -0000 1.17 --- ODEJoint.cpp 9 Feb 2005 07:12:47 -0000 1.18 *************** *** 39,47 **** } - void ODEJoint::internal_destroy() - { - delete this; - } - void ODEJoint::setupODEBodies(ODESolid* solid1, ODESolid* solid2) { --- 39,42 ---- Index: ODEUniversalJoint.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEUniversalJoint.h,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** ODEUniversalJoint.h 8 Feb 2005 04:59:06 -0000 1.26 --- ODEUniversalJoint.h 9 Feb 2005 07:12:47 -0000 1.27 *************** *** 40,44 **** ODEUniversalJoint(dWorldID world); ! virtual void OPAL_CALL internal_destroy(); virtual void OPAL_CALL setLimits(int axisNum, real low, real high); --- 40,44 ---- ODEUniversalJoint(dWorldID world); ! virtual ~ODEUniversalJoint(); virtual void OPAL_CALL setLimits(int axisNum, real low, real high); *************** *** 70,74 **** protected: - virtual ~ODEUniversalJoint(); private: --- 70,73 ---- Index: ODESolid.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESolid.h,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** ODESolid.h 8 Feb 2005 04:59:06 -0000 1.53 --- ODESolid.h 9 Feb 2005 07:12:47 -0000 1.54 *************** *** 60,64 **** ODESolid(dWorldID worldID, dSpaceID spaceID); ! virtual void OPAL_CALL internal_destroy(); virtual void OPAL_CALL internal_updateTransform(); --- 60,66 ---- ODESolid(dWorldID worldID, dSpaceID spaceID); ! virtual ~ODESolid(); ! ! virtual void OPAL_CALL setEnabled(bool e); virtual void OPAL_CALL internal_updateTransform(); *************** *** 144,149 **** protected: - virtual ~ODESolid(); - //void addNewGeom(dGeomID geomID, dGeomID transformID, // const Matrix44r& offset, const Material& material, ShapeType type); --- 146,149 ---- Index: ODEHinge2Joint.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEHinge2Joint.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** ODEHinge2Joint.cpp 8 Feb 2005 04:59:05 -0000 1.32 --- ODEHinge2Joint.cpp 9 Feb 2005 07:12:47 -0000 1.33 *************** *** 56,64 **** } - void ODEHinge2Joint::internal_destroy() - { - delete this; - } - void ODEHinge2Joint::setLimits(int axisNum, real low, real high) { --- 56,59 ---- Index: ODEHingeJoint.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEHingeJoint.h,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** ODEHingeJoint.h 8 Feb 2005 04:59:05 -0000 1.26 --- ODEHingeJoint.h 9 Feb 2005 07:12:47 -0000 1.27 *************** *** 40,44 **** ODEHingeJoint(dWorldID worldID); ! virtual void OPAL_CALL internal_destroy(); virtual void OPAL_CALL setLimits(int axisNum, real low, real high); --- 40,44 ---- ODEHingeJoint(dWorldID worldID); ! virtual ~ODEHingeJoint(); virtual void OPAL_CALL setLimits(int axisNum, real low, real high); *************** *** 70,74 **** protected: - virtual ~ODEHingeJoint(); private: --- 70,73 ---- Index: ODEBallJoint.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEBallJoint.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** ODEBallJoint.cpp 8 Feb 2005 04:59:05 -0000 1.31 --- ODEBallJoint.cpp 9 Feb 2005 07:12:47 -0000 1.32 *************** *** 63,71 **** } - void ODEBallJoint::internal_destroy() - { - delete this; - } - void ODEBallJoint::setLimits(int axisNum, real low, real high) { --- 63,66 ---- Index: ODEUniversalJoint.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEUniversalJoint.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** ODEUniversalJoint.cpp 8 Feb 2005 04:59:06 -0000 1.30 --- ODEUniversalJoint.cpp 9 Feb 2005 07:12:47 -0000 1.31 *************** *** 56,64 **** } - void ODEUniversalJoint::internal_destroy() - { - delete this; - } - void ODEUniversalJoint::setLimits(int axisNum, real low, real high) { --- 56,59 ---- Index: ODEJoint.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEJoint.h,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** ODEJoint.h 7 Feb 2005 02:08:23 -0000 1.21 --- ODEJoint.h 9 Feb 2005 07:12:47 -0000 1.22 *************** *** 40,48 **** ODEJoint(); - virtual void OPAL_CALL internal_destroy(); - - protected: virtual ~ODEJoint(); real calcStress(JointBreakMode mode); --- 40,46 ---- ODEJoint(); virtual ~ODEJoint(); + protected: real calcStress(JointBreakMode mode); Index: ODEBallJoint.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEBallJoint.h,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** ODEBallJoint.h 8 Feb 2005 04:59:05 -0000 1.26 --- ODEBallJoint.h 9 Feb 2005 07:12:47 -0000 1.27 *************** *** 40,44 **** ODEBallJoint(dWorldID worldID); ! virtual void OPAL_CALL internal_destroy(); virtual void OPAL_CALL setLimits(int axisNum, real low, real high); --- 40,44 ---- ODEBallJoint(dWorldID worldID); ! virtual ~ODEBallJoint(); virtual void OPAL_CALL setLimits(int axisNum, real low, real high); *************** *** 70,75 **** protected: - virtual ~ODEBallJoint(); - dJointID mAMotorID; --- 70,73 ---- Index: ODEHingeJoint.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEHingeJoint.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** ODEHingeJoint.cpp 8 Feb 2005 04:59:05 -0000 1.30 --- ODEHingeJoint.cpp 9 Feb 2005 07:12:47 -0000 1.31 *************** *** 53,61 **** } - void ODEHingeJoint::internal_destroy() - { - delete this; - } - void ODEHingeJoint::setLimits(int axisNum, real low, real high) { --- 53,56 ---- Index: ODESliderJoint.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESliderJoint.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** ODESliderJoint.cpp 8 Feb 2005 04:59:06 -0000 1.29 --- ODESliderJoint.cpp 9 Feb 2005 07:12:47 -0000 1.30 *************** *** 52,60 **** } - void ODESliderJoint::internal_destroy() - { - delete this; - } - void ODESliderJoint::setLimits(int axisNum, real low, real high) { --- 52,55 ---- Index: ODESpace.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESpace.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ODESpace.cpp 7 Feb 2005 02:08:23 -0000 1.6 --- ODESpace.cpp 9 Feb 2005 07:12:47 -0000 1.7 *************** *** 39,46 **** { } - - void ODESpace::internal_destroy() - { - delete this; - } } --- 39,41 ---- Index: ODEServoMotor.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEServoMotor.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ODEServoMotor.cpp 8 Feb 2005 04:59:05 -0000 1.13 --- ODEServoMotor.cpp 9 Feb 2005 07:12:47 -0000 1.14 *************** *** 47,55 **** } - void ODEServoMotor::internal_destroy() - { - delete this; - } - void ODEServoMotor::internal_update() { --- 47,50 ---- *************** *** 65,69 **** real velocity = mDesiredPos - mJoint->getAngle( mJointAxis); ! mJoint->setDesiredVel(mJointAxis, mMultiplier * velocity); } --- 60,64 ---- real velocity = mDesiredPos - mJoint->getAngle( mJointAxis); ! mJoint->setDesiredVel(mJointAxis, mRestoreSpeed * velocity); } *************** *** 73,77 **** real velocity = mDesiredPos - mJoint->getLinearPos( mJointAxis); ! mJoint->setDesiredVel(mJointAxis, mMultiplier * velocity); } --- 68,72 ---- real velocity = mDesiredPos - mJoint->getLinearPos( mJointAxis); ! mJoint->setDesiredVel(mJointAxis, mRestoreSpeed * velocity); } Index: ODESliderJoint.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESliderJoint.h,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** ODESliderJoint.h 8 Feb 2005 04:59:06 -0000 1.25 --- ODESliderJoint.h 9 Feb 2005 07:12:47 -0000 1.26 *************** *** 40,44 **** ODESliderJoint(dWorldID worldID); ! virtual void OPAL_CALL internal_destroy(); virtual void OPAL_CALL setLimits(int axisNum, real low, real high); --- 40,44 ---- ODESliderJoint(dWorldID worldID); ! virtual ~ODESliderJoint(); virtual void OPAL_CALL setLimits(int axisNum, real low, real high); *************** *** 68,72 **** protected: - virtual ~ODESliderJoint(); private: --- 68,71 ---- Index: ODEFixedJoint.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEFixedJoint.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** ODEFixedJoint.cpp 8 Feb 2005 04:59:05 -0000 1.21 --- ODEFixedJoint.cpp 9 Feb 2005 07:12:47 -0000 1.22 *************** *** 46,54 **** } - void ODEFixedJoint::internal_destroy() - { - delete this; - } - void ODEFixedJoint::setDampingConstant(real kd) { --- 46,49 ---- Index: ODEServoMotor.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEServoMotor.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ODEServoMotor.h 8 Feb 2005 04:59:05 -0000 1.13 --- ODEServoMotor.h 9 Feb 2005 07:12:47 -0000 1.14 *************** *** 40,44 **** ODEServoMotor(); ! virtual void OPAL_CALL internal_destroy(); virtual void OPAL_CALL internal_update(); --- 40,44 ---- ODEServoMotor(); ! virtual ~ODEServoMotor(); virtual void OPAL_CALL internal_update(); *************** *** 49,53 **** protected: - virtual ~ODEServoMotor(); private: --- 49,52 ---- Index: ODESimulator.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESimulator.cpp,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** ODESimulator.cpp 8 Feb 2005 04:59:05 -0000 1.69 --- ODESimulator.cpp 9 Feb 2005 07:12:47 -0000 1.70 *************** *** 609,627 **** //} ! Solid* ODESimulator::createSolid(const Matrix44r& transform, ! Space* parentSpace) { ! Solid* newSolid = NULL; ! ! if (NULL == parentSpace) ! { ! newSolid = new ODESolid(mWorldID, mRootSpaceID); ! } ! else ! { ! newSolid = new ODESolid(mWorldID, ! ((ODESpace*)parentSpace)->internal_getSpaceID()); ! } ! addSolid(newSolid); return newSolid; --- 609,615 ---- //} ! Solid* ODESimulator::createSolid() { ! Solid* newSolid = new ODESolid(mWorldID, mRootSpaceID); addSolid(newSolid); return newSolid; *************** *** 647,663 **** } ! HingeJoint* ODESimulator::createHingeJoint(Solid* solid1, Solid* solid2, ! const Point3r& anchor, const Vec3r& axis) ! { ! if(solid1->getTransform().internal_isDirty()) ! { ! solid1->internal_uploadTransformChanges(); ! } ! ! if(solid2->getTransform().internal_isDirty()) ! { ! solid2->internal_uploadTransformChanges(); ! } ! HingeJoint* newJoint = new ODEHingeJoint(mWorldID); addJoint(newJoint); --- 635,640 ---- } ! HingeJoint* ODESimulator::createHingeJoint() ! { HingeJoint* newJoint = new ODEHingeJoint(mWorldID); addJoint(newJoint); *************** *** 665,682 **** } ! UniversalJoint* ODESimulator::createUniversalJoint(Solid* solid1, ! Solid* solid2, const Point3r& anchor, const Vec3r& axis0, ! const Vec3r& axis1) { - if(solid1->getTransform().internal_isDirty()) - { - solid1->internal_uploadTransformChanges(); - } - - if(solid2->getTransform().internal_isDirty()) - { - solid2->internal_uploadTransformChanges(); - } - UniversalJoint* newJoint = new ODEUniversalJoint(mWorldID); addJoint(newJoint); --- 642,647 ---- } ! UniversalJoint* ODESimulator::createUniversalJoint() { UniversalJoint* newJoint = new ODEUniversalJoint(mWorldID); addJoint(newJoint); *************** *** 684,701 **** } ! BallJoint* ODESimulator::createBallJoint(Solid* solid1, Solid* solid2, ! const Point3r& anchor, const Vec3r& axis0, const Vec3r& axis1, ! const Vec3r& axis2) { - if(solid1->getTransform().internal_isDirty()) - { - solid1->internal_uploadTransformChanges(); - } - - if(solid2->getTransform().internal_isDirty()) - { - solid2->internal_uploadTransformChanges(); - } - BallJoint* newJoint = new ODEBallJoint(mWorldID); addJoint(newJoint); --- 649,654 ---- } ! BallJoint* ODESimulator::createBallJoint() { BallJoint* newJoint = new ODEBallJoint(mWorldID); addJoint(newJoint); *************** *** 703,719 **** } ! SliderJoint* ODESimulator::createSliderJoint(Solid* solid1, Solid* solid2, ! const Vec3r& axis) { - if(solid1->getTransform().internal_isDirty()) - { - solid1->internal_uploadTransformChanges(); - } - - if(solid2->getTransform().internal_isDirty()) - { - solid2->internal_uploadTransformChanges(); - } - SliderJoint* newJoint = new ODESliderJoint(mWorldID); addJoint(newJoint); --- 656,661 ---- } ! SliderJoint* ODESimulator::createSliderJoint() { SliderJoint* newJoint = new ODESliderJoint(mWorldID); addJoint(newJoint); *************** *** 721,737 **** } ! Hinge2Joint* ODESimulator::createHinge2Joint(Solid* solid1, Solid* solid2, ! const Point3r& anchor, const Vec3r& axis0, const Vec3r& axis1) { - if(solid1->getTransform().internal_isDirty()) - { - solid1->internal_uploadTransformChanges(); - } - - if(solid2->getTransform().internal_isDirty()) - { - solid2->internal_uploadTransformChanges(); - } - Hinge2Joint* newJoint = new ODEHinge2Joint(mWorldID); addJoint(newJoint); --- 663,668 ---- } ! Hinge2Joint* ODESimulator::createHinge2Joint() { Hinge2Joint* newJoint = new ODEHinge2Joint(mWorldID); addJoint(newJoint); *************** *** 739,755 **** } ! FixedJoint* ODESimulator::createFixedJoint(Solid* solid1, Solid* solid2) { - //TODO: this sux! - if(solid1->getTransform().internal_isDirty()) - { - solid1->internal_uploadTransformChanges(); - } - - if(solid2->getTransform().internal_isDirty()) - { - solid2->internal_uploadTransformChanges(); - } - FixedJoint* newJoint = new ODEFixedJoint(mWorldID); addJoint(newJoint); --- 670,675 ---- } ! FixedJoint* ODESimulator::createFixedJoint() { FixedJoint* newJoint = new ODEFixedJoint(mWorldID); addJoint(newJoint); Index: ODESolid.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESolid.cpp,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** ODESolid.cpp 8 Feb 2005 04:59:06 -0000 1.59 --- ODESolid.cpp 9 Feb 2005 07:12:47 -0000 1.60 *************** *** 84,90 **** } ! void ODESolid::internal_destroy() { ! delete this; } --- 84,121 ---- } ! void ODESolid::setEnabled(bool e) { ! if (e) ! { ! // If this Solid is dynamic, enable the ODE body. ! if (!mStatic) ! { ! dBodyEnable(mBodyID); ! } ! ! // Enable the ODE geoms. ! std::vector<GeomData*>::iterator iter; ! for (iter = mGeomDataList.begin(); ! iter != mGeomDataList.end(); ++iter) ! { ! dGeomEnable((*iter)->geomID); ! } ! } ! else // Disable the Solid. ! { ! // If this Solid is dynamic, disable the ODE body. ! if (!mStatic) ! { ! dBodyDisable(mBodyID); ! } ! ! // Disable the ODE geoms. ! std::vector<GeomData*>::iterator iter; ! for (iter = mGeomDataList.begin(); ! iter != mGeomDataList.end(); ++iter) ! { ! dGeomDisable((*iter)->geomID); ! } ! } } *************** *** 181,191 **** if (false == s) { ! // make this object dynamic mStatic = false; ! // create a new body mBodyID = dBodyCreate(mWorldID); ! // set the position of the new body dMatrix3 R = {mTransform[0], mTransform[4], mTransform[8], 0, --- 212,222 ---- if (false == s) { ! // Make this object dynamic. mStatic = false; ! // Create a new body. mBodyID = dBodyCreate(mWorldID); ! // Set the position of the new body. dMatrix3 R = {mTransform[0], mTransform[4], mTransform[8], 0, *************** *** 196,205 **** mTransform[14]); ! // loop over the existing shapes std::vector<GeomData*>::iterator iter; for (iter = mGeomDataList.begin(); iter != mGeomDataList.end(); ++iter) { ! // setup mass switch((*iter)->shape.type) { --- 227,236 ---- mTransform[14]); ! // Loop over the existing shapes. std::vector<GeomData*>::iterator iter; for (iter = mGeomDataList.begin(); iter != mGeomDataList.end(); ++iter) { ! // Setup mass. switch((*iter)->shape.type) { *************** *** 242,254 **** } ! // add each shape to the new body if (0 == (*iter)->transformID) { ! //no geom transform dGeomSetBody((*iter)->geomID, mBodyID); } else { ! //use geom transform dGeomSetBody((*iter)->transformID, mBodyID); } --- 273,285 ---- } ! // Add each shape to the new body. if (0 == (*iter)->transformID) { ! // No geom transform. dGeomSetBody((*iter)->geomID, mBodyID); } else { ! // Use geom transform. dGeomSetBody((*iter)->transformID, mBodyID); } Index: ODESimulator.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESimulator.h,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** ODESimulator.h 8 Feb 2005 21:54:23 -0000 1.48 --- ODESimulator.h 9 Feb 2005 07:12:47 -0000 1.49 *************** *** 64,90 **** // SOLIDS ! virtual Solid* OPAL_CALL createSolid( ! const Matrix44r& transform=Matrix44r(), Space* parentSpace = NULL); // JOINTS ! virtual HingeJoint* OPAL_CALL createHingeJoint(Solid* solid1, ! Solid* solid2, const Point3r& anchor, const Vec3r& axis); ! virtual UniversalJoint* OPAL_CALL createUniversalJoint(Solid* solid1, ! Solid* solid2, const Point3r& anchor, const Vec3r& axis0, ! const Vec3r& axis1); ! virtual BallJoint* OPAL_CALL createBallJoint(Solid* solid1, ! Solid* solid2, const Point3r& anchor, const Vec3r& axis0, ! const Vec3r& axis1, const Vec3r& axis2); ! virtual SliderJoint* OPAL_CALL createSliderJoint(Solid* solid1, Solid* solid2, ! const Vec3r& axis); ! virtual Hinge2Joint* OPAL_CALL createHinge2Joint(Solid* solid1, Solid* solid2, ! const Point3r& anchor, const Vec3r& axis0, const Vec3r& axis1); ! virtual FixedJoint* OPAL_CALL createFixedJoint(Solid* solid1, Solid* solid2); // MOTORS --- 64,82 ---- // SOLIDS ! virtual Solid* OPAL_CALL createSolid(); // JOINTS ! virtual HingeJoint* OPAL_CALL createHingeJoint(); ! virtual UniversalJoint* OPAL_CALL createUniversalJoint(); ! virtual BallJoint* OPAL_CALL createBallJoint(); ! virtual SliderJoint* OPAL_CALL createSliderJoint(); ! virtual Hinge2Joint* OPAL_CALL createHinge2Joint(); ! virtual FixedJoint* OPAL_CALL createFixedJoint(); // MOTORS Index: ODEHinge2Joint.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEHinge2Joint.h,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** ODEHinge2Joint.h 8 Feb 2005 04:59:05 -0000 1.26 --- ODEHinge2Joint.h 9 Feb 2005 07:12:47 -0000 1.27 *************** *** 40,44 **** ODEHinge2Joint(dWorldID worldID); ! virtual void OPAL_CALL internal_destroy(); virtual void OPAL_CALL setLimits(int axisNum, real low, real high); --- 40,44 ---- ODEHinge2Joint(dWorldID worldID); ! virtual ~ODEHinge2Joint(); virtual void OPAL_CALL setLimits(int axisNum, real low, real high); *************** *** 72,76 **** protected: - virtual ~ODEHinge2Joint(); private: --- 72,75 ---- Index: ODESpace.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESpace.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ODESpace.h 7 Feb 2005 02:08:23 -0000 1.8 --- ODESpace.h 9 Feb 2005 07:12:47 -0000 1.9 *************** *** 40,44 **** ODESpace(dSpaceID parentSpace); ! virtual void OPAL_CALL internal_destroy(); virtual dSpaceID OPAL_CALL internal_getSpaceID()const --- 40,44 ---- ODESpace(dSpaceID parentSpace); ! virtual ~ODESpace(); virtual dSpaceID OPAL_CALL internal_getSpaceID()const *************** *** 48,53 **** protected: - virtual ~ODESpace(); - dSpaceID mSpaceID; --- 48,51 ---- Index: ODEFixedJoint.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEFixedJoint.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** ODEFixedJoint.h 8 Feb 2005 04:59:05 -0000 1.18 --- ODEFixedJoint.h 9 Feb 2005 07:12:47 -0000 1.19 *************** *** 40,44 **** ODEFixedJoint(dWorldID worldID); ! virtual void OPAL_CALL internal_destroy(); virtual void OPAL_CALL setDampingConstant(real kd); --- 40,44 ---- ODEFixedJoint(dWorldID worldID); ! virtual ~ODEFixedJoint(); virtual void OPAL_CALL setDampingConstant(real kd); *************** *** 54,58 **** protected: - virtual ~ODEFixedJoint(); private: --- 54,57 ---- |
Update of /cvsroot/opal/opal/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14586/src Modified Files: AttractorMotor.cpp AttractorMotor.h BallJoint.h Blueprint.cpp Blueprint.h BlueprintManager.cpp BlueprintManager.h DesiredPosMotor.cpp DesiredPosMotor.h EventHandler.h FixedJoint.h GearedMotor.cpp GearedMotor.h Hinge2Joint.h HingeJoint.h Joint.h Motor.h Sensor.h ServoMotor.cpp ServoMotor.h Simulator.cpp Simulator.h SliderJoint.h Solid.cpp Solid.h Space.h ThrusterMotor.cpp ThrusterMotor.h UniversalJoint.h opal.h Log Message: removed destroy functions and made destructors public again Index: Sensor.h =================================================================== RCS file: /cvsroot/opal/opal/src/Sensor.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Sensor.h 8 Feb 2005 21:54:22 -0000 1.1 --- Sensor.h 9 Feb 2005 07:12:46 -0000 1.2 *************** *** 40,50 **** virtual ~Sensor(); ! /// Called regularly to update the Sensor. virtual void OPAL_CALL internal_update() = 0; ! /// Returns true if the Motor is enabled. virtual bool OPAL_CALL isEnabled()const; ! /// Sets whether the Motor can affect anything. virtual void OPAL_CALL setEnabled(bool e); --- 40,51 ---- virtual ~Sensor(); ! /// Called regularly to update the Sensor. This does nothing if the ! /// Sensor is disabled. virtual void OPAL_CALL internal_update() = 0; ! /// Returns true if the Sensor is enabled. virtual bool OPAL_CALL isEnabled()const; ! /// Sets whether the Sensor can update its measurements. virtual void OPAL_CALL setEnabled(bool e); Index: opal.h =================================================================== RCS file: /cvsroot/opal/opal/src/opal.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** opal.h 8 Feb 2005 04:59:05 -0000 1.10 --- opal.h 9 Feb 2005 07:12:47 -0000 1.11 *************** *** 43,46 **** --- 43,47 ---- #include "SliderJoint.h" #include "UniversalJoint.h" + #include "Sensor.h" #include "EventHandler.h" #include "Blueprint.h" Index: Joint.h =================================================================== RCS file: /cvsroot/opal/opal/src/Joint.h,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** Joint.h 8 Feb 2005 04:59:05 -0000 1.38 --- Joint.h 9 Feb 2005 07:12:46 -0000 1.39 *************** *** 40,44 **** Joint(); ! virtual void OPAL_CALL internal_destroy() = 0; // damping constant must be between 0.0 and 1.0 --- 40,44 ---- Joint(); ! virtual ~Joint(); // damping constant must be between 0.0 and 1.0 *************** *** 58,62 **** virtual void OPAL_CALL restoreDamage(); ! // various things could be updated here, including damage values virtual void OPAL_CALL internal_update() = 0; --- 58,62 ---- virtual void OPAL_CALL restoreDamage(); ! /// Various things could be updated here, including damage values. virtual void OPAL_CALL internal_update() = 0; *************** *** 153,158 **** protected: - virtual ~Joint(); - void updateDamage(real currentStress); --- 153,156 ---- Index: UniversalJoint.h =================================================================== RCS file: /cvsroot/opal/opal/src/UniversalJoint.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** UniversalJoint.h 8 Feb 2005 04:59:05 -0000 1.17 --- UniversalJoint.h 9 Feb 2005 07:12:47 -0000 1.18 *************** *** 45,50 **** } - virtual void OPAL_CALL internal_destroy() = 0; - protected: --- 45,48 ---- Index: Motor.h =================================================================== RCS file: /cvsroot/opal/opal/src/Motor.h,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Motor.h 8 Feb 2005 21:54:19 -0000 1.27 --- Motor.h 9 Feb 2005 07:12:46 -0000 1.28 *************** *** 43,51 **** Motor(); ! virtual void OPAL_CALL internal_destroy() = 0; ! ! //bool getGlobal(); ! /// Called regularly to update the Motor. virtual void OPAL_CALL internal_update() = 0; --- 43,50 ---- Motor(); ! virtual ~Motor(); ! /// Called regularly to update the Motor. This does nothing if the ! /// Motor is disabled. virtual void OPAL_CALL internal_update() = 0; *************** *** 70,75 **** protected: - virtual ~Motor(); - bool mEnabled; bool mIsCustom; --- 69,72 ---- Index: Simulator.h =================================================================== RCS file: /cvsroot/opal/opal/src/Simulator.h,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** Simulator.h 8 Feb 2005 21:54:21 -0000 1.65 --- Simulator.h 9 Feb 2005 07:12:46 -0000 1.66 *************** *** 119,125 **** /// Creates and returns a pointer to a Solid. ! virtual Solid* OPAL_CALL createSolid( ! const Matrix44r& transform=Matrix44r(), ! Space* parentSpace = NULL) = 0; /// Marks the given Solid as garbage. --- 119,123 ---- /// Creates and returns a pointer to a Solid. ! virtual Solid* OPAL_CALL createSolid() = 0; /// Marks the given Solid as garbage. *************** *** 133,156 **** // JOINTS ! virtual HingeJoint* OPAL_CALL createHingeJoint(Solid* solid1, ! Solid* solid2,const Point3r& anchor, const Vec3r& axis) = 0; ! virtual UniversalJoint* OPAL_CALL createUniversalJoint(Solid* solid1, ! Solid* solid2, const Point3r& anchor, const Vec3r& axis0, ! const Vec3r& axis1) = 0; ! virtual BallJoint* OPAL_CALL createBallJoint(Solid* solid1, ! Solid* solid2, const Point3r& anchor, const Vec3r& axis0, ! const Vec3r& axis1, const Vec3r& axis2) = 0; ! virtual SliderJoint* OPAL_CALL createSliderJoint(Solid* solid1, ! Solid* solid2, const Vec3r& axis) = 0; ! virtual Hinge2Joint* OPAL_CALL createHinge2Joint(Solid* solid1, ! Solid* solid2, const Point3r& anchor, const Vec3r& axis0, ! const Vec3r& axis1) = 0; ! virtual FixedJoint* OPAL_CALL createFixedJoint(Solid* solid1, ! Solid* solid2) = 0; /// Marks the given Joint as garbage. --- 131,145 ---- // JOINTS ! virtual HingeJoint* OPAL_CALL createHingeJoint() = 0; ! virtual UniversalJoint* OPAL_CALL createUniversalJoint() = 0; ! virtual BallJoint* OPAL_CALL createBallJoint() = 0; ! virtual SliderJoint* OPAL_CALL createSliderJoint() = 0; ! virtual Hinge2Joint* OPAL_CALL createHinge2Joint() = 0; ! virtual FixedJoint* OPAL_CALL createFixedJoint() = 0; /// Marks the given Joint as garbage. Index: Blueprint.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/Blueprint.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Blueprint.cpp 7 Feb 2005 02:08:22 -0000 1.7 --- Blueprint.cpp 9 Feb 2005 07:12:46 -0000 1.8 *************** *** 43,51 **** } - void Blueprint::internal_destroy() - { - delete this; - } - void Blueprint::setName(const std::string& name) { --- 43,46 ---- Index: DesiredPosMotor.h =================================================================== RCS file: /cvsroot/opal/opal/src/DesiredPosMotor.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** DesiredPosMotor.h 8 Feb 2005 04:59:05 -0000 1.11 --- DesiredPosMotor.h 9 Feb 2005 07:12:46 -0000 1.12 *************** *** 50,53 **** --- 50,55 ---- DesiredPosMotor(); + virtual ~DesiredPosMotor(); + /// Sets up the Motor to affect a Solid. Also specifies which /// degrees of freedom are affected by the Motor. This will *************** *** 55,60 **** virtual void OPAL_CALL init(Solid* solid, Mode m); - virtual void OPAL_CALL internal_destroy(); - virtual void OPAL_CALL internal_update(); --- 57,60 ---- *************** *** 88,93 **** protected: - virtual ~DesiredPosMotor(); - Solid* mSolid; Mode mMode; --- 88,91 ---- Index: BlueprintManager.h =================================================================== RCS file: /cvsroot/opal/opal/src/BlueprintManager.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** BlueprintManager.h 7 Feb 2005 02:08:22 -0000 1.9 --- BlueprintManager.h 9 Feb 2005 07:12:46 -0000 1.10 *************** *** 45,49 **** BlueprintManager(); ! //virtual void OPAL_CALL internal_destroy(); virtual void OPAL_CALL loadFile(const std::string& filename); --- 45,49 ---- BlueprintManager(); ! virtual ~BlueprintManager(); virtual void OPAL_CALL loadFile(const std::string& filename); *************** *** 57,62 **** private: - virtual ~BlueprintManager(); - SolidDescription loadSolid(const TiXmlNode* nodePtr, const std::string& filename); --- 57,60 ---- Index: Space.h =================================================================== RCS file: /cvsroot/opal/opal/src/Space.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Space.h 7 Feb 2005 02:08:22 -0000 1.6 --- Space.h 9 Feb 2005 07:12:46 -0000 1.7 *************** *** 39,48 **** {} - virtual void OPAL_CALL internal_destroy() = 0; - - protected: virtual ~Space() {} private: --- 39,47 ---- {} virtual ~Space() {} + protected: + private: Index: BallJoint.h =================================================================== RCS file: /cvsroot/opal/opal/src/BallJoint.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** BallJoint.h 8 Feb 2005 04:59:05 -0000 1.16 --- BallJoint.h 9 Feb 2005 07:12:46 -0000 1.17 *************** *** 45,50 **** } - virtual void OPAL_CALL internal_destroy() = 0; - protected: --- 45,48 ---- Index: ThrusterMotor.h =================================================================== RCS file: /cvsroot/opal/opal/src/ThrusterMotor.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ThrusterMotor.h 8 Feb 2005 04:59:05 -0000 1.1 --- ThrusterMotor.h 9 Feb 2005 07:12:47 -0000 1.2 *************** *** 40,48 **** ThrusterMotor(); /// Sets up the Motor to affect a Solid. This will enable the Motor. virtual void OPAL_CALL init(Solid* solid); - virtual void OPAL_CALL internal_destroy(); - virtual void OPAL_CALL internal_update(); --- 40,48 ---- ThrusterMotor(); + virtual ~ThrusterMotor(); + /// Sets up the Motor to affect a Solid. This will enable the Motor. virtual void OPAL_CALL init(Solid* solid); virtual void OPAL_CALL internal_update(); *************** *** 56,61 **** protected: - virtual ~ThrusterMotor(); - Solid* mSolid; Force mForce; --- 56,59 ---- Index: Blueprint.h =================================================================== RCS file: /cvsroot/opal/opal/src/Blueprint.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Blueprint.h 7 Feb 2005 02:08:22 -0000 1.14 --- Blueprint.h 9 Feb 2005 07:12:46 -0000 1.15 *************** *** 189,193 **** Blueprint(); ! virtual void OPAL_CALL internal_destroy(); virtual void OPAL_CALL setName(const std::string& name); --- 189,193 ---- Blueprint(); ! virtual ~Blueprint(); virtual void OPAL_CALL setName(const std::string& name); *************** *** 212,217 **** private: - virtual ~Blueprint(); - bool solidExists(const std::string& name); --- 212,215 ---- Index: GearedMotor.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/GearedMotor.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GearedMotor.cpp 8 Feb 2005 04:59:05 -0000 1.1 --- GearedMotor.cpp 9 Feb 2005 07:12:46 -0000 1.2 *************** *** 46,67 **** } ! void GearedMotor::init(Joint* joint, int jointAxis, ! real maxTorque, real maxVelocity) { assert(joint->isAxisRotational(jointAxis)); - assert(maxVelocity != 0); mJoint = joint; mJointAxis = jointAxis; ! mMaxTorque = maxTorque; ! mMaxVelInverse = (real)1.0 / maxVelocity; mEnabled = true; } - void GearedMotor::internal_destroy() - { - delete this; - } - void GearedMotor::internal_update() { --- 46,60 ---- } ! void GearedMotor::init(Joint* joint, int jointAxis) { assert(joint->isAxisRotational(jointAxis)); mJoint = joint; mJointAxis = jointAxis; ! mMaxTorque = (real)10; ! mMaxVelInverse = (real)0.1; mEnabled = true; } void GearedMotor::internal_update() { *************** *** 78,81 **** --- 71,95 ---- } + void GearedMotor::setMaxTorque(real max) + { + mMaxTorque = max; + } + + real GearedMotor::getMaxTorque()const + { + return mMaxTorque; + } + + void GearedMotor::setMaxVelocity(real max) + { + assert(max != 0); + mMaxVelInverse = (real)1.0 / max; + } + + real GearedMotor::getMaxVelocity()const + { + return (real)1.0 / mMaxVelInverse; + } + void GearedMotor::setThrottle(real throttle) { *************** *** 89,104 **** } - //bool GearedMotor::internal_dependsOn(Solid* solid) - //{ - // if (solid == mSolid) - // { - // return true; - // } - // else - // { - // return false; - // } - //} - bool GearedMotor::internal_dependsOn(Joint* joint) { --- 103,106 ---- Index: ServoMotor.h =================================================================== RCS file: /cvsroot/opal/opal/src/ServoMotor.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ServoMotor.h 8 Feb 2005 04:59:05 -0000 1.14 --- ServoMotor.h 9 Feb 2005 07:12:46 -0000 1.15 *************** *** 55,60 **** virtual void OPAL_CALL init(Joint* joint, int jointAxis, Mode m); - virtual void OPAL_CALL internal_destroy() = 0; - virtual void OPAL_CALL internal_update() = 0; --- 55,58 ---- *************** *** 83,92 **** virtual real OPAL_CALL getMaxForce(); ! /// Sets the multiplier used to scale how fast the Motor will /// achieve its desired position. Only used in the desired /// position mode. ! virtual void OPAL_CALL setMultiplier(real mult); ! virtual real OPAL_CALL getMultiplier(); //virtual bool OPAL_CALL internal_dependsOn(Solid* solid); --- 81,90 ---- virtual real OPAL_CALL getMaxForce(); ! /// Sets the parameter used to scale how fast the Motor will /// achieve its desired position. Only used in the desired /// position mode. ! virtual void OPAL_CALL setRestoreSpeed(real speed); ! virtual real OPAL_CALL getRestoreSpeed(); //virtual bool OPAL_CALL internal_dependsOn(Solid* solid); *************** *** 101,105 **** real mDesiredVel; real mMaxForce; ! real mMultiplier; private: --- 99,103 ---- real mDesiredVel; real mMaxForce; ! real mRestoreSpeed; private: Index: AttractorMotor.h =================================================================== RCS file: /cvsroot/opal/opal/src/AttractorMotor.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** AttractorMotor.h 8 Feb 2005 04:59:05 -0000 1.16 --- AttractorMotor.h 9 Feb 2005 07:12:46 -0000 1.17 *************** *** 45,48 **** --- 45,50 ---- AttractorMotor(); + virtual ~AttractorMotor(); + /// Sets up the Motor to attract two Solids to each other. This will /// enable the Motor. *************** *** 53,58 **** virtual void OPAL_CALL init(Solid* solid, const Point3r& point); - virtual void OPAL_CALL internal_destroy(); - virtual void OPAL_CALL internal_update(); --- 55,58 ---- *************** *** 72,77 **** protected: - virtual ~AttractorMotor(); - Mode mMode; --- 72,75 ---- Index: ThrusterMotor.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ThrusterMotor.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ThrusterMotor.cpp 8 Feb 2005 04:59:05 -0000 1.1 --- ThrusterMotor.cpp 9 Feb 2005 07:12:46 -0000 1.2 *************** *** 48,56 **** } - void ThrusterMotor::internal_destroy() - { - delete this; - } - void ThrusterMotor::internal_update() { --- 48,51 ---- Index: AttractorMotor.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/AttractorMotor.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** AttractorMotor.cpp 8 Feb 2005 04:59:05 -0000 1.9 --- AttractorMotor.cpp 9 Feb 2005 07:12:46 -0000 1.10 *************** *** 63,71 **** } - void AttractorMotor::internal_destroy() - { - delete this; - } - void AttractorMotor::internal_update() { --- 63,66 ---- Index: Simulator.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/Simulator.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Simulator.cpp 8 Feb 2005 21:54:20 -0000 1.21 --- Simulator.cpp 9 Feb 2005 07:12:46 -0000 1.22 *************** *** 69,74 **** while (!mSpaceList.empty()) { ! //delete mSpaceList.back(); ! mSpaceList.back()->internal_destroy(); mSpaceList.pop_back(); } --- 69,73 ---- while (!mSpaceList.empty()) { ! delete mSpaceList.back(); mSpaceList.pop_back(); } *************** *** 236,246 **** ++solidIter) { ! // just use the default parent space for now; if it should be ! // in a different space, it will get handled later (later this ! // function) SolidData newSolid; ! newSolid.solidPtr = createSolid((*solidIter).second.transform, ! NULL); newSolid.solidPtr->setStatic((*solidIter).second.isStatic); newSolid.solidPtr->setLinearDamping( --- 235,245 ---- ++solidIter) { ! // Just use the default parent space for now; if it should be ! // in a different space, it will get handled later this ! // function. SolidData newSolid; ! newSolid.solidPtr = createSolid(); ! newSolid.solidPtr->setTransform((*solidIter).second.transform); newSolid.solidPtr->setStatic((*solidIter).second.isStatic); newSolid.solidPtr->setLinearDamping( *************** *** 310,320 **** ++jointIter) { ! Solid* solid1 = coll.getSolid( (*jointIter).second.solid1Name).solidPtr; ! Solid* solid2 = coll.getSolid( (*jointIter).second.solid2Name).solidPtr; // if joint refers to non-existant solids, don't create the joint ! if (NULL == solid1 || NULL == solid2) { std::cout << "Error in opal::Simulator::instantiateBlueprint: \ --- 309,319 ---- ++jointIter) { ! Solid* solid0 = coll.getSolid( (*jointIter).second.solid1Name).solidPtr; ! Solid* solid1 = coll.getSolid( (*jointIter).second.solid2Name).solidPtr; // if joint refers to non-existant solids, don't create the joint ! if (NULL == solid0 || NULL == solid1) { std::cout << "Error in opal::Simulator::instantiateBlueprint: \ *************** *** 334,339 **** { case HINGE_JOINT: ! newJoint = createHingeJoint(solid1, solid2, anchor, ! axis0); break; case UNIVERSAL_JOINT: --- 333,340 ---- { case HINGE_JOINT: ! newJoint = createHingeJoint(); ! newJoint->setSolids(solid0, solid1); ! newJoint->setAnchor(anchor); ! newJoint->setAxis(0, axis0); break; case UNIVERSAL_JOINT: *************** *** 403,428 **** #endif - //void Simulator::setDefaultLinearDamping(real ld) - //{ - // assert(ld >= 0.0); - // mDefaultLinearDamping = ld; - //} - - //real Simulator::getDefaultLinearDamping()const - //{ - // return mDefaultLinearDamping; - //} - - //void Simulator::setDefaultAngularDamping(real ad) - //{ - // assert(ad >= 0.0); - // mDefaultAngularDamping = ad; - //} - - //real Simulator::getDefaultAngularDamping()const - //{ - // return mDefaultAngularDamping; - //} - void Simulator::setMaxLinearVel(real max) { --- 404,407 ---- *************** *** 447,450 **** --- 426,451 ---- } + //void Simulator::setDefaultLinearDamping(real ld) + //{ + // assert(ld >= 0.0); + // mDefaultLinearDamping = ld; + //} + + //real Simulator::getDefaultLinearDamping()const + //{ + // return mDefaultLinearDamping; + //} + + //void Simulator::setDefaultAngularDamping(real ad) + //{ + // assert(ad >= 0.0); + // mDefaultAngularDamping = ad; + //} + + //real Simulator::getDefaultAngularDamping()const + //{ + // return mDefaultAngularDamping; + //} + void Simulator::destroySolid(Solid* s) { *************** *** 625,630 **** if(mSolidList[i] == s) { ! //delete s; ! s->internal_destroy(); mSolidList[i] = mSolidList.back(); mSolidList.pop_back(); --- 626,630 ---- if(mSolidList[i] == s) { ! delete s; mSolidList[i] = mSolidList.back(); mSolidList.pop_back(); *************** *** 661,666 **** if(mJointList[i] == j) { ! //delete j; ! j->internal_destroy(); mJointList[i] = mJointList.back(); mJointList.pop_back(); --- 661,665 ---- if(mJointList[i] == j) { ! delete j; mJointList[i] = mJointList.back(); mJointList.pop_back(); *************** *** 684,689 **** if (!m->internal_isCustom()) { ! //delete m; ! m->internal_destroy(); } mMotorList[i] = mMotorList.back(); --- 683,687 ---- if (!m->internal_isCustom()) { ! delete m; } mMotorList[i] = mMotorList.back(); *************** *** 707,711 **** { delete s; - //s->internal_destroy(); mSensorList[i] = mSensorList.back(); mSensorList.pop_back(); --- 705,708 ---- Index: DesiredPosMotor.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/DesiredPosMotor.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** DesiredPosMotor.cpp 8 Feb 2005 21:54:18 -0000 1.11 --- DesiredPosMotor.cpp 9 Feb 2005 07:12:46 -0000 1.12 *************** *** 57,65 **** } - void DesiredPosMotor::internal_destroy() - { - delete this; - } - void DesiredPosMotor::internal_update() { --- 57,60 ---- Index: SliderJoint.h =================================================================== RCS file: /cvsroot/opal/opal/src/SliderJoint.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** SliderJoint.h 8 Feb 2005 04:59:05 -0000 1.17 --- SliderJoint.h 9 Feb 2005 07:12:46 -0000 1.18 *************** *** 45,50 **** } - virtual void OPAL_CALL internal_destroy() = 0; - protected: --- 45,48 ---- Index: Hinge2Joint.h =================================================================== RCS file: /cvsroot/opal/opal/src/Hinge2Joint.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Hinge2Joint.h 8 Feb 2005 04:59:05 -0000 1.18 --- Hinge2Joint.h 9 Feb 2005 07:12:46 -0000 1.19 *************** *** 45,50 **** } - virtual void OPAL_CALL internal_destroy() = 0; - protected: --- 45,48 ---- Index: Solid.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/Solid.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Solid.cpp 8 Feb 2005 21:54:21 -0000 1.14 --- Solid.cpp 9 Feb 2005 07:12:46 -0000 1.15 *************** *** 48,60 **** } ! //Simulator* Solid::getSimulator()const ! //{ ! // return mSimulator; ! //} ! //void Solid::setSimulator)Simulator* sim) ! //{ ! // mSimulator = sim; ! //} //void Solid::internal_updateAcceleration(real dt) --- 48,60 ---- } ! bool Solid::isEnabled()const ! { ! return mEnabled; ! } ! void Solid::setEnabled(bool e) ! { ! mEnabled = e; ! } //void Solid::internal_updateAcceleration(real dt) *************** *** 300,304 **** if ((*forceIter).timeLeft <= 0) { ! //delete this force //swap the element to be deleted with the last element --- 300,304 ---- if ((*forceIter).timeLeft <= 0) { ! // Delete this force. //swap the element to be deleted with the last element Index: BlueprintManager.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/BlueprintManager.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** BlueprintManager.cpp 8 Feb 2005 04:59:05 -0000 1.16 --- BlueprintManager.cpp 9 Feb 2005 07:12:46 -0000 1.17 *************** *** 43,56 **** for (iter = mBlueprintMap.begin(); iter != mBlueprintMap.end(); ++iter) { ! (*iter).second->internal_destroy(); } mBlueprintMap.clear(); } - //void BlueprintManager::internal_destroy() - //{ - // delete this; - //} - bool BlueprintManager::blueprintExists(const std::string& name) { --- 43,51 ---- for (iter = mBlueprintMap.begin(); iter != mBlueprintMap.end(); ++iter) { ! delete (*iter).second; } mBlueprintMap.clear(); } bool BlueprintManager::blueprintExists(const std::string& name) { Index: Solid.h =================================================================== RCS file: /cvsroot/opal/opal/src/Solid.h,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** Solid.h 8 Feb 2005 21:54:21 -0000 1.66 --- Solid.h 9 Feb 2005 07:12:46 -0000 1.67 *************** *** 40,51 **** { public: ! /// All Solids start out enabled. Solid(); ! virtual void OPAL_CALL internal_destroy() = 0; ! //virtual Simulator* OPAL_CALL getSimulator()const; ! //virtual void OPAL_CALL setSimulator(Simulator* sim); /// Update the OPAL Solid's transform using the transform from the --- 40,55 ---- { public: ! /// All Solids start out enabled, but they don't do much until ! /// Shapes are added. Solid(); ! virtual ~Solid(); ! /// Returns true if the Solid is enabled. ! virtual bool OPAL_CALL isEnabled()const; ! /// Sets whether the Solid can collide with other Solids and be ! /// physically simulated. ! virtual void OPAL_CALL setEnabled(bool e); /// Update the OPAL Solid's transform using the transform from the *************** *** 67,71 **** virtual void OPAL_CALL setStatic(bool s) = 0; ! // remove this solid and its collision shapes into a new space virtual void OPAL_CALL setSpace(Space* newSpace) = 0; --- 71,76 ---- virtual void OPAL_CALL setStatic(bool s) = 0; ! /// Removes the Solid from its current Space and adds it to the new ! /// Space. virtual void OPAL_CALL setSpace(Space* newSpace) = 0; *************** *** 218,232 **** protected: - virtual ~Solid(); - virtual void applyForce(const Force& f) = 0; std::vector<Force> mForceList; ! // the local transform of this solid and center of mass Matrix44r mTransform; - //Simulator* mSimulator; //used for cloning - bool mStatic; EventHandler* mEventHandler; --- 223,233 ---- protected: virtual void applyForce(const Force& f) = 0; std::vector<Force> mForceList; ! // This Solids's transform corresponding to its center of mass. Matrix44r mTransform; bool mStatic; EventHandler* mEventHandler; *************** *** 241,244 **** --- 242,247 ---- real mAngularDamping; + bool mEnabled; + private: Index: ServoMotor.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ServoMotor.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ServoMotor.cpp 8 Feb 2005 04:59:05 -0000 1.5 --- ServoMotor.cpp 9 Feb 2005 07:12:46 -0000 1.6 *************** *** 39,43 **** mDesiredVel = 0; mMaxForce = 0; ! mMultiplier = 0; } --- 39,43 ---- mDesiredVel = 0; mMaxForce = 0; ! mRestoreSpeed = 0; } *************** *** 101,112 **** } ! void ServoMotor::setMultiplier(real mult) { ! mMultiplier = mult; } ! real ServoMotor::getMultiplier() { ! return mMultiplier; } --- 101,112 ---- } ! void ServoMotor::setRestoreSpeed(real speed) { ! mRestoreSpeed = speed; } ! real ServoMotor::getRestoreSpeed() { ! return mRestoreSpeed; } Index: EventHandler.h =================================================================== RCS file: /cvsroot/opal/opal/src/EventHandler.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** EventHandler.h 7 Feb 2005 02:08:22 -0000 1.16 --- EventHandler.h 9 Feb 2005 07:12:46 -0000 1.17 *************** *** 52,57 **** {} - virtual void OPAL_CALL destroy() = 0; - /// Return true if collision contacts should be generated. virtual bool OPAL_CALL handleCollisionEvent( --- 52,55 ---- Index: HingeJoint.h =================================================================== RCS file: /cvsroot/opal/opal/src/HingeJoint.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** HingeJoint.h 8 Feb 2005 04:59:05 -0000 1.17 --- HingeJoint.h 9 Feb 2005 07:12:46 -0000 1.18 *************** *** 45,50 **** } - virtual void OPAL_CALL internal_destroy() = 0; - protected: --- 45,48 ---- Index: FixedJoint.h =================================================================== RCS file: /cvsroot/opal/opal/src/FixedJoint.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** FixedJoint.h 8 Feb 2005 04:59:05 -0000 1.11 --- FixedJoint.h 9 Feb 2005 07:12:46 -0000 1.12 *************** *** 45,50 **** } - virtual void OPAL_CALL internal_destroy() = 0; - protected: --- 45,48 ---- Index: GearedMotor.h =================================================================== RCS file: /cvsroot/opal/opal/src/GearedMotor.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GearedMotor.h 8 Feb 2005 04:59:05 -0000 1.1 --- GearedMotor.h 9 Feb 2005 07:12:46 -0000 1.2 *************** *** 44,69 **** public: ! GearedMotor::GearedMotor(); /// Sets up the Motor to affect one a Joint's axes. This will /// enable the Motor. ! virtual void OPAL_CALL init(Joint* joint, int jointAxis, real maxTorque, ! real maxVelocity); ! ! virtual void OPAL_CALL internal_destroy(); virtual void OPAL_CALL internal_update(); ! virtual void OPAL_CALL setThrottle(real throttle); ! virtual real OPAL_CALL getThrottle()const; ! //virtual bool OPAL_CALL internal_dependsOn(Solid* solid); virtual bool OPAL_CALL internal_dependsOn(Joint* joint); protected: - virtual ~GearedMotor(); - //Solid* mSolid; Joint* mJoint; --- 44,79 ---- public: ! GearedMotor(); ! ! virtual ~GearedMotor(); /// Sets up the Motor to affect one a Joint's axes. This will /// enable the Motor. ! virtual void OPAL_CALL init(Joint* joint, int jointAxis); virtual void OPAL_CALL internal_update(); ! /// Sets the max torque parameter. ! virtual void OPAL_CALL setMaxTorque(real max); ! /// Returns the max torque parameter. ! virtual real OPAL_CALL getMaxTorque()const; ! /// Sets the max velocity parameter. The maximum cannot be set to ! /// zero because that would cause a divide-by-zero error. ! virtual void OPAL_CALL setMaxVelocity(real max); ! ! /// Returns the max velocity parameter. ! virtual real OPAL_CALL getMaxVelocity()const; ! ! /// Sets the throttle parameter. ! virtual void OPAL_CALL setThrottle(real t); ! ! /// Returns the throttle parameter. ! virtual real OPAL_CALL getThrottle()const; virtual bool OPAL_CALL internal_dependsOn(Joint* joint); protected: //Solid* mSolid; Joint* mJoint; |
From: tylerstreeter <tyl...@us...> - 2005-02-09 07:13:30
|
Update of /cvsroot/opal/opal/vc7 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14586/vc7 Modified Files: opal-ode.vcproj Log Message: removed destroy functions and made destructors public again Index: opal-ode.vcproj =================================================================== RCS file: /cvsroot/opal/opal/vc7/opal-ode.vcproj,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** opal-ode.vcproj 8 Feb 2005 21:54:27 -0000 1.5 --- opal-ode.vcproj 9 Feb 2005 07:12:48 -0000 1.6 *************** *** 25,33 **** EnableIntrinsicFunctions="FALSE" FavorSizeOrSpeed="0" ! AdditionalIncludeDirectories="../../external/include" PreprocessorDefinitions="WIN32;_DEBUG;_LIB;OPAL_DLL_EXPORTING;OPAL_USE_XML" MinimalRebuild="TRUE" BasicRuntimeChecks="0" ! RuntimeLibrary="2" UsePrecompiledHeader="0" WarningLevel="3" --- 25,33 ---- EnableIntrinsicFunctions="FALSE" FavorSizeOrSpeed="0" ! AdditionalIncludeDirectories="" PreprocessorDefinitions="WIN32;_DEBUG;_LIB;OPAL_DLL_EXPORTING;OPAL_USE_XML" MinimalRebuild="TRUE" BasicRuntimeChecks="0" ! RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="3" *************** *** 74,78 **** EnableIntrinsicFunctions="TRUE" FavorSizeOrSpeed="1" ! AdditionalIncludeDirectories="../../external/include" PreprocessorDefinitions="WIN32;NDEBUG;_LIB;OPAL_DLL_EXPORTING;OPAL_USE_XML" RuntimeLibrary="2" --- 74,78 ---- EnableIntrinsicFunctions="TRUE" FavorSizeOrSpeed="1" ! AdditionalIncludeDirectories="" PreprocessorDefinitions="WIN32;NDEBUG;_LIB;OPAL_DLL_EXPORTING;OPAL_USE_XML" RuntimeLibrary="2" *************** *** 80,84 **** WarningLevel="3" Detect64BitPortabilityProblems="TRUE" ! DebugInformationFormat="3"/> <Tool Name="VCCustomBuildTool"/> --- 80,84 ---- WarningLevel="3" Detect64BitPortabilityProblems="TRUE" ! DebugInformationFormat="0"/> <Tool Name="VCCustomBuildTool"/> |
From: tylerstreeter <tyl...@us...> - 2005-02-09 07:13:28
|
Update of /cvsroot/opal/opal/samples/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14586/samples/src Modified Files: Base3DObject.h BoxObject.cpp BoxObject.h CarObject.cpp CarObject.h SphereObject.cpp SphereObject.h Log Message: removed destroy functions and made destructors public again Index: SphereObject.cpp =================================================================== RCS file: /cvsroot/opal/opal/samples/src/SphereObject.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SphereObject.cpp 13 Oct 2004 20:12:51 -0000 1.3 --- SphereObject.cpp 9 Feb 2005 07:12:45 -0000 1.4 *************** *** 1,29 **** #include "SphereObject.h" ! SphereObject::SphereObject( opal::Simulator* sim, bool isStatic, opal::real radius, ! opal::Material material, opal::Matrix44r transform, opal::Space* parentSpace) : Base3DObject() { mSim = sim; mRadius = radius; ! mSolid = sim->createSolid( isStatic, transform, parentSpace ); ! mSolid->addSphere( radius, opal::Matrix44r(), material ); } SphereObject::~SphereObject() { ! mSim->destroySolid( mSolid ); } void SphereObject::Draw() { ! float matAmbientAndDiffuse[4] = {.6, .1, .1, 1}; if (mSolid->getSleeping()) { ! matAmbientAndDiffuse[0] = 0.3; ! matAmbientAndDiffuse[1] = 0.3; ! matAmbientAndDiffuse[2] = 0.9; ! matAmbientAndDiffuse[3] = 1.0; } --- 1,32 ---- #include "SphereObject.h" ! SphereObject::SphereObject(opal::Simulator* sim, bool isStatic, ! opal::real radius, opal::Material material, opal::Matrix44r transform) : Base3DObject() { mSim = sim; mRadius = radius; ! mSolid = sim->createSolid(); ! mSolid->setStatic(isStatic); ! mSolid->setTransform(transform); ! mSolid->addSphere(radius, opal::Matrix44r(), material); } SphereObject::~SphereObject() { ! mSim->destroySolid(mSolid); } void SphereObject::Draw() { ! float matAmbientAndDiffuse[4] = ! {(float).6, (float).1, (float).1, (float)1}; if (mSolid->getSleeping()) { ! matAmbientAndDiffuse[0] = (float)0.3; ! matAmbientAndDiffuse[1] = (float)0.3; ! matAmbientAndDiffuse[2] = (float)0.9; ! matAmbientAndDiffuse[3] = (float)1.0; } *************** *** 32,36 **** glPushMatrix(); glMultMatrixf(mSolid->getTransform().getData()); ! DrawSphere( mRadius ); glPopMatrix(); } --- 35,39 ---- glPushMatrix(); glMultMatrixf(mSolid->getTransform().getData()); ! DrawSphere(mRadius); glPopMatrix(); } Index: Base3DObject.h =================================================================== RCS file: /cvsroot/opal/opal/samples/src/Base3DObject.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Base3DObject.h 9 Dec 2004 18:14:10 -0000 1.6 --- Base3DObject.h 9 Feb 2005 07:12:45 -0000 1.7 *************** *** 28,32 **** if (mBoxDispListValid) { ! glDeleteLists( mBoxDispList, 1 ); } } --- 28,32 ---- if (mBoxDispListValid) { ! glDeleteLists(mBoxDispList, 1); } } *************** *** 34,52 **** virtual void Draw() = 0; ! virtual void setSleeping( bool sleeping ) {} virtual opal::Solid* getSolid() = 0; ! void DrawSphere( opal::real radius ) { gluSphere(mQuadric, radius, 20, 20); } ! void DrawBox( const opal::Vec3r& dimensions ) { if (mBoxDispListValid) { ! glCallList( mBoxDispList ); } else --- 34,52 ---- virtual void Draw() = 0; ! virtual void setSleeping(bool sleeping) {} virtual opal::Solid* getSolid() = 0; ! void DrawSphere(opal::real radius) { gluSphere(mQuadric, radius, 20, 20); } ! void DrawBox(const opal::Vec3r& dimensions) { if (mBoxDispListValid) { ! glCallList(mBoxDispList); } else *************** *** 56,63 **** //create box display list mBoxDispList = glGenLists(1); ! glNewList( mBoxDispList, GL_COMPILE ); ! opal::real halfx = dimensions[0] * 0.5; ! opal::real halfy = dimensions[1] * 0.5; ! opal::real halfz = dimensions[2] * 0.5; glBegin(GL_QUADS); --- 56,63 ---- //create box display list mBoxDispList = glGenLists(1); ! glNewList(mBoxDispList, GL_COMPILE); ! opal::real halfx = dimensions[0] * (opal::real)0.5; ! opal::real halfy = dimensions[1] * (opal::real)0.5; ! opal::real halfz = dimensions[2] * (opal::real)0.5; glBegin(GL_QUADS); *************** *** 104,108 **** protected: ! void clamp( opal::real& value, opal::real min, opal::real max ) { if (value < min) --- 104,108 ---- protected: ! void clamp(opal::real& value, opal::real min, opal::real max) { if (value < min) Index: CarObject.cpp =================================================================== RCS file: /cvsroot/opal/opal/samples/src/CarObject.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** CarObject.cpp 15 Nov 2004 00:11:32 -0000 1.12 --- CarObject.cpp 9 Feb 2005 07:12:45 -0000 1.13 *************** *** 1,5 **** #include "CarObject.h" ! CarObject::CarObject( opal::Simulator* sim, opal::real size, const opal::Matrix44r& transform ) : Base3DObject() { --- 1,5 ---- #include "CarObject.h" ! CarObject::CarObject(opal::Simulator* sim, opal::real size, const opal::Matrix44r& transform) : Base3DObject() { *************** *** 8,18 **** mSim = sim; ! opal::Space* space = sim->createSpace(); ! mBody = sim->createSolid( false, transform, space ); //calculate body dimensions ! mBodyDimensions.set( 2.5 * size, 0.3 * size, 4.0 * size ); ! mBody->addBox( mBodyDimensions, opal::Matrix44r(), opal::globals::metalMaterial ); //calculate wheel radius --- 8,19 ---- mSim = sim; ! //opal::Space* space = sim->createSpace(); ! mBody = sim->createSolid(); ! mBody->setTransform(transform); //calculate body dimensions ! mBodyDimensions.set(2.5 * size, 0.3 * size, 4.0 * size); ! mBody->addBox(mBodyDimensions, opal::Matrix44r(), opal::globals::metalMaterial); //calculate wheel radius *************** *** 20,104 **** //opal::Matrix44r M = transform; ! opal::Point3r flPoint( -mBodyDimensions[0]*0.5 + 0.4 * mWheelRadius, ! -mBodyDimensions[1]*0.5, -mBodyDimensions[2]*0.5 + 1.3 * mWheelRadius ); //flPoint = transform * flPoint; ! opal::Point3r frPoint( mBodyDimensions[0]*0.5 - 0.4 * mWheelRadius, ! -mBodyDimensions[1]*0.5, -mBodyDimensions[2]*0.5 + 1.3 * mWheelRadius ); //frPoint = transform * frPoint; ! opal::Point3r rlPoint( -mBodyDimensions[0]*0.5 + 0.4 * mWheelRadius, ! -mBodyDimensions[1]*0.5, mBodyDimensions[2]*0.5 - 1.3 * mWheelRadius ); //rlPoint = transform * rlPoint; ! opal::Point3r rrPoint( mBodyDimensions[0]*0.5 - 0.4 * mWheelRadius, ! -mBodyDimensions[1]*0.5, mBodyDimensions[2]*0.5 - 1.3 * mWheelRadius ); //rrPoint = transform * rrPoint; //add shapes and joints opal::Matrix44r M = transform; ! M.translate( flPoint[0], flPoint[1], flPoint[2] ); ! mFLWheel = sim->createSolid( false, M, space ); ! mFLWheel->addSphere( mWheelRadius, opal::Matrix44r(), opal::globals::rubberMaterial ); ! mFLJoint = sim->createHinge2Joint( mBody, mFLWheel, M.getPosition(), opal::Vec3r(0,1,0), ! opal::Vec3r(1,0,0) ); ! mFLJoint->setLimits( mSteeringAngle, mSteeringAngle, 0 ); ! //mFLJoint->setDamping( 0.4 ); M = transform; ! M.translate( frPoint[0], frPoint[1], frPoint[2] ); ! mFRWheel = sim->createSolid( false, M, space ); ! mFRWheel->addSphere( mWheelRadius, opal::Matrix44r(), opal::globals::rubberMaterial ); ! mFRJoint = sim->createHinge2Joint( mBody, mFRWheel, M.getPosition(), opal::Vec3r(0,1,0), ! opal::Vec3r(1,0,0) ); ! mFRJoint->setLimits( mSteeringAngle, mSteeringAngle, 0 ); ! //mFRJoint->setDamping( 0.4 ); M = transform; ! M.translate( rlPoint[0], rlPoint[1], rlPoint[2] ); ! mRLWheel = sim->createSolid( false, M, space ); ! mRLWheel->addSphere( mWheelRadius, opal::Matrix44r(), opal::globals::rubberMaterial ); ! mRLJoint = sim->createHingeJoint( mBody, mRLWheel, M.getPosition(), ! opal::Vec3r(-1,0,0) ); ! mRLJoint->setDampingConstant( 0.0 ); ! mRLJoint->setSpringConstant( 1.0 ); M = transform; ! M.translate( rrPoint[0], rrPoint[1], rrPoint[2] ); ! mRRWheel = sim->createSolid( false, M, space ); ! mRRWheel->addSphere( mWheelRadius, opal::Matrix44r(), opal::globals::rubberMaterial ); ! mRRJoint = sim->createHingeJoint( mBody, mRRWheel, M.getPosition(), ! opal::Vec3r(-1,0,0) ); ! mRRJoint->setDampingConstant( 0.0 ); ! mRRJoint->setSpringConstant( 1.0 ); //translate mass downward to keep car from rolling ! //mBody->translateMass( opal::Vec3r(0.0, -0.5*size, 0.0) ); ! //mFLWheel->translateMass( opal::Vec3r(0.0, -0.5*size, 0.0) ); ! //mFRWheel->translateMass( opal::Vec3r(0.0, -0.5*size, 0.0) ); ! //mRLWheel->translateMass( opal::Vec3r(0.0, -0.5*size, 0.0) ); ! //mRRWheel->translateMass( opal::Vec3r(0.0, -0.5*size, 0.0) ); ! //mFLHinge->setBreakParams( opal::THRESHOLD, 2000.0, 0.0 ); ! //mFRHinge->setBreakParams( opal::THRESHOLD, 2000.0, 0.0 ); ! //mRLHinge->setBreakParams( opal::THRESHOLD, 2000.0, 0.0 ); ! //mRRHinge->setBreakParams( opal::THRESHOLD, 2000.0, 0.0 ); ! mFLMotor = sim->createLimitedForceMotor( mFLJoint, 1, 65.0, 3000.0, false ); ! mFRMotor = sim->createLimitedForceMotor( mFRJoint, 1, 65.0, 3000.0, false ); ! //mBody->setTransform( transform ); } CarObject::~CarObject() { ! mSim->destroySolid( mBody ); ! mSim->destroySolid( mFLWheel ); ! mSim->destroySolid( mFRWheel ); ! mSim->destroySolid( mRLWheel ); ! mSim->destroySolid( mRRWheel ); } void CarObject::forward() { ! mFLMotor->setThrottle( 1.0 ); ! mFRMotor->setThrottle( 1.0 ); //opal::Vec3r vel = mBody->getLocalLinearVel(); --- 21,125 ---- //opal::Matrix44r M = transform; ! opal::Point3r flPoint(-mBodyDimensions[0]*0.5 + 0.4 * mWheelRadius, ! -mBodyDimensions[1]*0.5, -mBodyDimensions[2]*0.5 + 1.3 * mWheelRadius); //flPoint = transform * flPoint; ! opal::Point3r frPoint(mBodyDimensions[0]*0.5 - 0.4 * mWheelRadius, ! -mBodyDimensions[1]*0.5, -mBodyDimensions[2]*0.5 + 1.3 * mWheelRadius); //frPoint = transform * frPoint; ! opal::Point3r rlPoint(-mBodyDimensions[0]*0.5 + 0.4 * mWheelRadius, ! -mBodyDimensions[1]*0.5, mBodyDimensions[2]*0.5 - 1.3 * mWheelRadius); //rlPoint = transform * rlPoint; ! opal::Point3r rrPoint(mBodyDimensions[0]*0.5 - 0.4 * mWheelRadius, ! -mBodyDimensions[1]*0.5, mBodyDimensions[2]*0.5 - 1.3 * mWheelRadius); //rrPoint = transform * rrPoint; //add shapes and joints opal::Matrix44r M = transform; ! M.translate(flPoint[0], flPoint[1], flPoint[2]); ! mFLWheel = sim->createSolid(); ! mFLWheel->setTransform(M); ! mFLWheel->addSphere(mWheelRadius, opal::Matrix44r(), opal::globals::rubberMaterial); ! mFLJoint = sim->createHinge2Joint(); ! mFLJoint->setSolids(mBody, mFLWheel); ! mFLJoint->setAnchor(M.getPosition()); ! mFLJoint->setAxis(0, opal::Vec3r(0,1,0)); ! mFLJoint->setAxis(1, opal::Vec3r(1,0,0)); ! mFLJoint->setLimits(mSteeringAngle, mSteeringAngle, 0); ! //mFLJoint->setDamping(0.4); M = transform; ! M.translate(frPoint[0], frPoint[1], frPoint[2]); ! mFRWheel = sim->createSolid(); ! mFRWheel->setTransform(M); ! mFRWheel->addSphere(mWheelRadius, opal::Matrix44r(), opal::globals::rubberMaterial); ! mFRJoint = sim->createHinge2Joint(); ! mFRJoint->setSolids(mBody, mFRWheel); ! mFRJoint->setAnchor(M.getPosition()); ! mFRJoint->setAxis(0, opal::Vec3r(0,1,0)); ! mFRJoint->setAxis(1, opal::Vec3r(1,0,0)); ! mFRJoint->setLimits(mSteeringAngle, mSteeringAngle, 0); ! //mFRJoint->setDamping(0.4); M = transform; ! M.translate(rlPoint[0], rlPoint[1], rlPoint[2]); ! mRLWheel = sim->createSolid(); ! mRLWheel->setTransform(M); ! mRLWheel->addSphere(mWheelRadius, opal::Matrix44r(), opal::globals::rubberMaterial); ! mRLJoint = sim->createHingeJoint(); ! mRLJoint->setSolids(mBody, mRLWheel); ! mRLJoint->setAnchor(M.getPosition()); ! mRLJoint->setAxis(0, opal::Vec3r(-1,0,0)); ! mRLJoint->setDampingConstant(0.0); ! mRLJoint->setSpringConstant(1.0); M = transform; ! M.translate(rrPoint[0], rrPoint[1], rrPoint[2]); ! mRRWheel = sim->createSolid(); ! mRRWheel->setTransform(M); ! mRRWheel->addSphere(mWheelRadius, opal::Matrix44r(), opal::globals::rubberMaterial); ! mRRJoint = sim->createHingeJoint(); ! mRRJoint->setSolids(mBody, mRRWheel); ! mRRJoint->setAnchor(M.getPosition()); ! mRRJoint->setAxis(0, opal::Vec3r(-1,0,0)); ! mRRJoint->setDampingConstant(0.0); ! mRRJoint->setSpringConstant(1.0); //translate mass downward to keep car from rolling ! //mBody->translateMass(opal::Vec3r(0.0, -0.5*size, 0.0)); ! //mFLWheel->translateMass(opal::Vec3r(0.0, -0.5*size, 0.0)); ! //mFRWheel->translateMass(opal::Vec3r(0.0, -0.5*size, 0.0)); ! //mRLWheel->translateMass(opal::Vec3r(0.0, -0.5*size, 0.0)); ! //mRRWheel->translateMass(opal::Vec3r(0.0, -0.5*size, 0.0)); ! //mFLHinge->setBreakParams(opal::THRESHOLD, 2000.0, 0.0); ! //mFRHinge->setBreakParams(opal::THRESHOLD, 2000.0, 0.0); ! //mRLHinge->setBreakParams(opal::THRESHOLD, 2000.0, 0.0); ! //mRRHinge->setBreakParams(opal::THRESHOLD, 2000.0, 0.0); ! mFLMotor = sim->createGearedMotor(); ! mFLMotor->init(mFLJoint, 1); ! mFLMotor->setMaxTorque(65); ! mFLMotor->setMaxVelocity(3000); ! mFRMotor = sim->createGearedMotor(); ! mFRMotor->init(mFRJoint, 1); ! mFRMotor->setMaxTorque(65); ! mFRMotor->setMaxVelocity(3000); ! //mBody->setTransform(transform); } CarObject::~CarObject() { ! mSim->destroySolid(mBody); ! mSim->destroySolid(mFLWheel); ! mSim->destroySolid(mFRWheel); ! mSim->destroySolid(mRLWheel); ! mSim->destroySolid(mRRWheel); } void CarObject::forward() { ! mFLMotor->setThrottle(1.0); ! mFRMotor->setThrottle(1.0); //opal::Vec3r vel = mBody->getLocalLinearVel(); *************** *** 107,118 **** void CarObject::idle() { ! mFLMotor->setThrottle( 0.0 ); ! mFRMotor->setThrottle( 0.0 ); } void CarObject::reverse() { ! mFLMotor->setThrottle( -1.0 ); ! mFRMotor->setThrottle( -1.0 ); } --- 128,139 ---- void CarObject::idle() { ! mFLMotor->setThrottle(0.0); ! mFRMotor->setThrottle(0.0); } void CarObject::reverse() { ! mFLMotor->setThrottle(-1.0); ! mFRMotor->setThrottle(-1.0); } *************** *** 121,127 **** mSteeringAngle = -mSteeringLimit; //mSteeringAngle -= 1.0; ! //clamp( mSteeringAngle, -mSteeringLimit, mSteeringLimit ); ! mFLJoint->setLimits( mSteeringAngle, mSteeringAngle, 0 ); ! mFRJoint->setLimits( mSteeringAngle, mSteeringAngle, 0 ); //if (mFLMotor->getThrottle() > 0.0) //doesn't matter which motor we check --- 142,148 ---- mSteeringAngle = -mSteeringLimit; //mSteeringAngle -= 1.0; ! //clamp(mSteeringAngle, -mSteeringLimit, mSteeringLimit); ! mFLJoint->setLimits(mSteeringAngle, mSteeringAngle, 0); ! mFRJoint->setLimits(mSteeringAngle, mSteeringAngle, 0); //if (mFLMotor->getThrottle() > 0.0) //doesn't matter which motor we check *************** *** 129,133 **** // //throttle is on // //outside wheel should turn faster than the inside wheel ! // mFLMotor->setThrottle( turnConstant * mFRMotor->getThrottle() ); //} } --- 150,154 ---- // //throttle is on // //outside wheel should turn faster than the inside wheel ! // mFLMotor->setThrottle(turnConstant * mFRMotor->getThrottle()); //} } *************** *** 137,143 **** mSteeringAngle = mSteeringLimit; //mSteeringAngle += 1.0; ! //clamp( mSteeringAngle, -mSteeringLimit, mSteeringLimit ); ! mFLJoint->setLimits( mSteeringAngle, mSteeringAngle, 0 ); ! mFRJoint->setLimits( mSteeringAngle, mSteeringAngle, 0 ); //if (mFLMotor->getThrottle() > 0.0) //doesn't matter which motor we check --- 158,164 ---- mSteeringAngle = mSteeringLimit; //mSteeringAngle += 1.0; ! //clamp(mSteeringAngle, -mSteeringLimit, mSteeringLimit); ! mFLJoint->setLimits(mSteeringAngle, mSteeringAngle, 0); ! mFRJoint->setLimits(mSteeringAngle, mSteeringAngle, 0); //if (mFLMotor->getThrottle() > 0.0) //doesn't matter which motor we check *************** *** 145,158 **** // //throttle is on // //outside wheel should turn faster than the inside wheel ! // mFRMotor->setThrottle( turnConstant * mFLMotor->getThrottle() ); //} } ! void CarObject::setSteering( opal::real value ) { ! assert( value >= -1.0 && value <= 1.0 ); mSteeringAngle = value * mSteeringLimit; ! mFLJoint->setLimits( mSteeringAngle, mSteeringAngle, 0 ); ! mFRJoint->setLimits( mSteeringAngle, mSteeringAngle, 0 ); } --- 166,179 ---- // //throttle is on // //outside wheel should turn faster than the inside wheel ! // mFRMotor->setThrottle(turnConstant * mFLMotor->getThrottle()); //} } ! void CarObject::setSteering(opal::real value) { ! assert(value >= -1.0 && value <= 1.0); mSteeringAngle = value * mSteeringLimit; ! mFLJoint->setLimits(mSteeringAngle, mSteeringAngle, 0); ! mFRJoint->setLimits(mSteeringAngle, mSteeringAngle, 0); } *************** *** 173,202 **** glPushMatrix(); glMultMatrixf(mBody->getTransform().getData()); ! DrawBox( mBodyDimensions ); glPopMatrix(); ! glPolygonMode( GL_FRONT, GL_LINE ); glPushMatrix(); glMultMatrixf(mFLWheel->getTransform().getData()); ! DrawSphere( mWheelRadius ); glPopMatrix(); glPushMatrix(); glMultMatrixf(mFRWheel->getTransform().getData()); ! DrawSphere( mWheelRadius ); glPopMatrix(); glPushMatrix(); glMultMatrixf(mRLWheel->getTransform().getData()); ! DrawSphere( mWheelRadius ); glPopMatrix(); glPushMatrix(); glMultMatrixf(mRRWheel->getTransform().getData()); ! DrawSphere( mWheelRadius ); glPopMatrix(); ! glPolygonMode( GL_FRONT, GL_FILL ); } --- 194,223 ---- glPushMatrix(); glMultMatrixf(mBody->getTransform().getData()); ! DrawBox(mBodyDimensions); glPopMatrix(); ! glPolygonMode(GL_FRONT, GL_LINE); glPushMatrix(); glMultMatrixf(mFLWheel->getTransform().getData()); ! DrawSphere(mWheelRadius); glPopMatrix(); glPushMatrix(); glMultMatrixf(mFRWheel->getTransform().getData()); ! DrawSphere(mWheelRadius); glPopMatrix(); glPushMatrix(); glMultMatrixf(mRLWheel->getTransform().getData()); ! DrawSphere(mWheelRadius); glPopMatrix(); glPushMatrix(); glMultMatrixf(mRRWheel->getTransform().getData()); ! DrawSphere(mWheelRadius); glPopMatrix(); ! glPolygonMode(GL_FRONT, GL_FILL); } Index: SphereObject.h =================================================================== RCS file: /cvsroot/opal/opal/samples/src/SphereObject.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SphereObject.h 13 Oct 2004 20:12:51 -0000 1.2 --- SphereObject.h 9 Feb 2005 07:12:45 -0000 1.3 *************** *** 7,13 **** { public: ! SphereObject( opal::Simulator* sim, bool isStatic, opal::real radius, ! opal::Material material=opal::defaults::material, opal::Matrix44r transform=opal::Matrix44r(), ! opal::Space* parentSpace=NULL); ~SphereObject(); --- 7,13 ---- { public: ! SphereObject(opal::Simulator* sim, bool isStatic, opal::real radius, ! opal::Material material=opal::defaults::material, ! opal::Matrix44r transform=opal::Matrix44r()); ~SphereObject(); Index: BoxObject.h =================================================================== RCS file: /cvsroot/opal/opal/samples/src/BoxObject.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BoxObject.h 13 Oct 2004 20:12:51 -0000 1.2 --- BoxObject.h 9 Feb 2005 07:12:45 -0000 1.3 *************** *** 8,13 **** public: BoxObject(opal::Simulator* sim, bool isStatic, opal::Vec3r size, ! opal::Material material=opal::defaults::material, opal::Matrix44r transform=opal::Matrix44r(), ! opal::Space* parentSpace=NULL); ~BoxObject(); --- 8,13 ---- public: BoxObject(opal::Simulator* sim, bool isStatic, opal::Vec3r size, ! opal::Material material=opal::defaults::material, ! opal::Matrix44r transform=opal::Matrix44r()); ~BoxObject(); *************** *** 15,19 **** virtual void Draw(); ! virtual void setSleeping( bool sleeping ); virtual opal::Solid* getSolid(); --- 15,19 ---- virtual void Draw(); ! virtual void setSleeping(bool sleeping); virtual opal::Solid* getSolid(); Index: CarObject.h =================================================================== RCS file: /cvsroot/opal/opal/samples/src/CarObject.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** CarObject.h 9 Dec 2004 18:14:10 -0000 1.10 --- CarObject.h 9 Feb 2005 07:12:45 -0000 1.11 *************** *** 10,15 **** public: ! CarObject( opal::Simulator* sim, opal::real size, ! const opal::Matrix44r& transform=opal::Matrix44r() ); ~CarObject(); --- 10,15 ---- public: ! CarObject(opal::Simulator* sim, opal::real size, ! const opal::Matrix44r& transform=opal::Matrix44r()); ~CarObject(); *************** *** 26,30 **** //takes a value between -1.0 and 1.0; -1.0 is full left, 1.0 is full right ! void setSteering( opal::real value ); void turnLeft(); --- 26,30 ---- //takes a value between -1.0 and 1.0; -1.0 is full left, 1.0 is full right ! void setSteering(opal::real value); void turnLeft(); *************** *** 51,56 **** opal::HingeJoint* mRRJoint; ! opal::LimitedForceMotor* mFLMotor; ! opal::LimitedForceMotor* mFRMotor; opal::real mSteeringLimit; --- 51,56 ---- opal::HingeJoint* mRRJoint; ! opal::GearedMotor* mFLMotor; ! opal::GearedMotor* mFRMotor; opal::real mSteeringLimit; Index: BoxObject.cpp =================================================================== RCS file: /cvsroot/opal/opal/samples/src/BoxObject.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** BoxObject.cpp 13 Oct 2004 20:12:50 -0000 1.3 --- BoxObject.cpp 9 Feb 2005 07:12:45 -0000 1.4 *************** *** 1,17 **** #include "BoxObject.h" ! BoxObject::BoxObject( opal::Simulator* sim, bool isStatic, opal::Vec3r size, ! opal::Material material, opal::Matrix44r transform, opal::Space* parentSpace ) : Base3DObject() { mSim = sim; mDimensions = size; ! mSolid = sim->createSolid( isStatic, transform, parentSpace ); ! mSolid->addBox( size, opal::Matrix44r(), material ); } BoxObject::~BoxObject() { ! mSim->destroySolid( mSolid ); } --- 1,19 ---- #include "BoxObject.h" ! BoxObject::BoxObject(opal::Simulator* sim, bool isStatic, opal::Vec3r size, ! opal::Material material, opal::Matrix44r transform) : Base3DObject() { mSim = sim; mDimensions = size; ! mSolid = sim->createSolid(); ! mSolid->setStatic(isStatic); ! mSolid->setTransform(transform); ! mSolid->addBox(size, opal::Matrix44r(), material); } BoxObject::~BoxObject() { ! mSim->destroySolid(mSolid); } *************** *** 32,42 **** glPushMatrix();; glMultMatrixf(mSolid->getTransform().getData()); ! DrawBox( mDimensions ); glPopMatrix(); } ! void BoxObject::setSleeping( bool sleeping ) { ! mSolid->setSleeping( sleeping ); } --- 34,44 ---- glPushMatrix();; glMultMatrixf(mSolid->getTransform().getData()); ! DrawBox(mDimensions); glPopMatrix(); } ! void BoxObject::setSleeping(bool sleeping) { ! mSolid->setSleeping(sleeping); } |
From: tylerstreeter <tyl...@us...> - 2005-02-09 07:13:27
|
Update of /cvsroot/opal/opal/samples/car In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14586/samples/car Modified Files: car.vcproj main.cpp Log Message: removed destroy functions and made destructors public again Index: main.cpp =================================================================== RCS file: /cvsroot/opal/opal/samples/car/main.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** main.cpp 26 Jan 2005 23:10:42 -0000 1.17 --- main.cpp 9 Feb 2005 07:12:45 -0000 1.18 *************** *** 42,46 **** void InitializeVariables(); void MainLoop(); ! void BuildWall( const opal::Matrix44r& transform, const opal::Vec3r& blockSize, int length, int height ); /* Inline Random Functions */ --- 42,46 ---- void InitializeVariables(); void MainLoop(); ! void BuildWall(const opal::Matrix44r& transform, const opal::Vec3r& blockSize, int length, int height); /* Inline Random Functions */ *************** *** 64,83 **** gCameraZoom = -100.0; gCameraYPos = 10.0; ! gSimulator = opal::createSimulator( opal::Vec3r( (opal::real)0.0, (opal::real)-9.81, ! (opal::real)0.0 ) ); ! //gSimulator->setAccuracy( opal::ACCURACY_VERY_LOW ); ! //gSimulator->setDefaultLinearDamping( 0.3 ); ! //gSimulator->setDefaultAngularDamping( 80.0 ); ! gGround = gSimulator->createSolid( true ); ! gGround->addPlane( gGroundParams ); //create ramp opal::Matrix44r rampTransform; ! rampTransform.translate( 0.0, 0.0, -60.0 ); ! rampTransform.rotate( -78.0, 1.0, 0.0, 0.0 ); ! BoxObject* box = new BoxObject( gSimulator, true, opal::Vec3r( 6.0, 65.0, 1.0 ), ! opal::defaults::material, rampTransform ); ! gObjects.push_back( box ); //create 4-sided building --- 64,83 ---- gCameraZoom = -100.0; gCameraYPos = 10.0; ! gSimulator = opal::createSimulator(); ! //gSimulator->setAccuracy(opal::ACCURACY_VERY_LOW); ! //gSimulator->setDefaultLinearDamping(0.3); ! //gSimulator->setDefaultAngularDamping(80.0); ! gGround = gSimulator->createSolid(); ! gGround->setStatic(true); ! gGround->addPlane(gGroundParams); //create ramp opal::Matrix44r rampTransform; ! rampTransform.translate(0.0, 0.0, -60.0); ! rampTransform.rotate(-78.0, 1.0, 0.0, 0.0); ! BoxObject* box = new BoxObject(gSimulator, true, opal::Vec3r(6.0, 65.0, 1.0), ! opal::defaults::material, rampTransform); ! gObjects.push_back(box); //create 4-sided building *************** *** 86,122 **** int h = 25; opal::real blockLength = 2.0; ! opal::Vec3r blockSize( 1.0*blockLength, 0.5*blockLength, 0.5*blockLength ); opal::Matrix44r wallTransform; ! wallTransform.translate( 0.0, 0.0, -50.0 ); ////front wall ! BuildWall( wallTransform, blockSize, w, h ); ////rear wall ! //wallTransform.translate( blockSize[0]*0.5, 0.0, -l*blockSize[0] ); ! //wallTransform.rotate( 180.0, 0.0, 1.0, 0.0 ); ! //BuildWall( wallTransform, blockSize, w, h ); ! //wallTransform.rotate( -180.0, 0.0, 1.0, 0.0 ); ////right wall ! //wallTransform.translate( -blockSize[0]*0.5, 0.0, l*0.5*blockSize[0] ); ! //wallTransform.rotate( 90.0, 0.0, 1.0, 0.0 ); ! //wallTransform.translate( -0.25*blockSize[0], 0.0, w*0.5*blockSize[0] + 0.5*blockSize[2] ); ! //BuildWall( wallTransform, blockSize, l, h ); ////left wall ! //wallTransform.translate( blockSize[0]*0.5, 0.0, -l*0.5*blockSize[0] ); ! //wallTransform.rotate( 180.0, 0.0, 1.0, 0.0 ); ! //wallTransform.translate( 0.0, 0.0, w*0.5*blockSize[0] );//+ 0.5*blockSize[2] ); ! //BuildWall( wallTransform, blockSize, l, h ); ! //wallTransform.translate( 0.0, 0.0, -102.0 ); ! //wallTransform.rotate( 90.0, 0.0, 1.0, 0.0 ); ! //BuildWall( wallTransform, opal::Vec3r(2.0,1.0,5.0), 10, 7 ); opal::Matrix44r carTransform; ! carTransform.makeTranslation( 0.0, 3.8, 50.0 ); ! gCar = new CarObject( gSimulator, 1.0, carTransform ); ! gObjects.push_back( gCar ); std::cout << "==============================================" << std::endl; --- 86,122 ---- int h = 25; opal::real blockLength = 2.0; ! opal::Vec3r blockSize(1.0*blockLength, 0.5*blockLength, 0.5*blockLength); opal::Matrix44r wallTransform; ! wallTransform.translate(0.0, 0.0, -50.0); ////front wall ! BuildWall(wallTransform, blockSize, w, h); ////rear wall ! //wallTransform.translate(blockSize[0]*0.5, 0.0, -l*blockSize[0]); ! //wallTransform.rotate(180.0, 0.0, 1.0, 0.0); ! //BuildWall(wallTransform, blockSize, w, h); ! //wallTransform.rotate(-180.0, 0.0, 1.0, 0.0); ////right wall ! //wallTransform.translate(-blockSize[0]*0.5, 0.0, l*0.5*blockSize[0]); ! //wallTransform.rotate(90.0, 0.0, 1.0, 0.0); ! //wallTransform.translate(-0.25*blockSize[0], 0.0, w*0.5*blockSize[0] + 0.5*blockSize[2]); ! //BuildWall(wallTransform, blockSize, l, h); ////left wall ! //wallTransform.translate(blockSize[0]*0.5, 0.0, -l*0.5*blockSize[0]); ! //wallTransform.rotate(180.0, 0.0, 1.0, 0.0); ! //wallTransform.translate(0.0, 0.0, w*0.5*blockSize[0]);//+ 0.5*blockSize[2]); ! //BuildWall(wallTransform, blockSize, l, h); ! //wallTransform.translate(0.0, 0.0, -102.0); ! //wallTransform.rotate(90.0, 0.0, 1.0, 0.0); ! //BuildWall(wallTransform, opal::Vec3r(2.0,1.0,5.0), 10, 7); opal::Matrix44r carTransform; ! carTransform.makeTranslation(0.0, 3.8, 50.0); ! gCar = new CarObject(gSimulator, 1.0, carTransform); ! gObjects.push_back(gCar); std::cout << "==============================================" << std::endl; *************** *** 137,141 **** ShutdownSDL(); ! glDeleteLists( gGroundDispList, 1 ); while (!gObjects.empty()) --- 137,141 ---- ShutdownSDL(); ! glDeleteLists(gGroundDispList, 1); while (!gObjects.empty()) *************** *** 150,154 **** } ! void BuildWall( const opal::Matrix44r& transform, const opal::Vec3r& blockSize, int length, int height ) { opal::Matrix44r M; --- 150,154 ---- } ! void BuildWall(const opal::Matrix44r& transform, const opal::Vec3r& blockSize, int length, int height) { opal::Matrix44r M; *************** *** 165,172 **** } ! //M.makeTranslation( pos[0], pos[1], pos[2] ); //base wall transform M = transform; ! M.translate( l*blockSize[0] + 0.5*blockSize[0] - 0.5*length*blockSize[0] + offset, ! h*blockSize[1] + 0.5*blockSize[1], 0.0 ); //if (randbit()) --- 165,172 ---- } ! //M.makeTranslation(pos[0], pos[1], pos[2]); //base wall transform M = transform; ! M.translate(l*blockSize[0] + 0.5*blockSize[0] - 0.5*length*blockSize[0] + offset, ! h*blockSize[1] + 0.5*blockSize[1], 0.0); //if (randbit()) *************** *** 174,181 **** { //normal size ! BoxObject* newBox = new BoxObject( gSimulator, false, blockSize, ! opal::globals::metalMaterial, M, NULL ); ! newBox->setSleeping( true ); ! gObjects.push_back( newBox ); } else --- 174,181 ---- { //normal size ! BoxObject* newBox = new BoxObject(gSimulator, false, blockSize, ! opal::globals::metalMaterial, M); ! newBox->setSleeping(true); ! gObjects.push_back(newBox); } else *************** *** 187,216 **** //block 1 - lower left ! M.translate( -0.25*blockSize[0], -0.25*blockSize[1], 0.0 ); ! BoxObject* newBox = new BoxObject( gSimulator, false, newSize, ! opal::globals::metalMaterial, M, NULL ); ! newBox->setSleeping( true ); ! gObjects.push_back( newBox ); //block 2 - lower right ! M.translate( 0.5*blockSize[0], 0.0, 0.0 ); ! newBox = new BoxObject( gSimulator, false, newSize, ! opal::globals::metalMaterial, M, NULL ); ! newBox->setSleeping( true ); ! gObjects.push_back( newBox ); //block 3 - upper right ! M.translate( 0.0, 0.5*blockSize[1], 0.0 ); ! newBox = new BoxObject( gSimulator, false, newSize, ! opal::globals::metalMaterial, M, NULL ); ! newBox->setSleeping( true ); ! gObjects.push_back( newBox ); //block 4 - upper left ! M.translate( -0.5*blockSize[0], 0.0, 0.0 ); ! newBox = new BoxObject( gSimulator, false, newSize, ! opal::globals::metalMaterial, M, NULL ); ! newBox->setSleeping( true ); ! gObjects.push_back( newBox ); } } --- 187,216 ---- //block 1 - lower left ! M.translate(-0.25*blockSize[0], -0.25*blockSize[1], 0.0); ! BoxObject* newBox = new BoxObject(gSimulator, false, newSize, ! opal::globals::metalMaterial, M); ! newBox->setSleeping(true); ! gObjects.push_back(newBox); //block 2 - lower right ! M.translate(0.5*blockSize[0], 0.0, 0.0); ! newBox = new BoxObject(gSimulator, false, newSize, ! opal::globals::metalMaterial, M); ! newBox->setSleeping(true); ! gObjects.push_back(newBox); //block 3 - upper right ! M.translate(0.0, 0.5*blockSize[1], 0.0); ! newBox = new BoxObject(gSimulator, false, newSize, ! opal::globals::metalMaterial, M); ! newBox->setSleeping(true); ! gObjects.push_back(newBox); //block 4 - upper left ! M.translate(-0.5*blockSize[0], 0.0, 0.0); ! newBox = new BoxObject(gSimulator, false, newSize, ! opal::globals::metalMaterial, M); ! newBox->setSleeping(true); ! gObjects.push_back(newBox); } } *************** *** 326,330 **** //create ground display list gGroundDispList = glGenLists(1); ! glNewList( gGroundDispList, GL_COMPILE ); glBegin(GL_QUADS); glVertex3f(-2000.0, gGroundParams[3], -2000.0); --- 326,330 ---- //create ground display list gGroundDispList = glGenLists(1); ! glNewList(gGroundDispList, GL_COMPILE); glBegin(GL_QUADS); glVertex3f(-2000.0, gGroundParams[3], -2000.0); *************** *** 480,489 **** { opal::Matrix44r M = gCar->getTransform(); ! M.translate( 0.0, 1.0, -3.0 ); ! SphereObject* projectile = new SphereObject( gSimulator, false, ! 0.6, opal::defaults::material, M ); ! projectile->getSolid()->addLocalForce( ! opal::Vec3r(0.0,3000.0,-12000.0), 0.01 ); ! gObjects.push_back( projectile ); break; } --- 480,492 ---- { opal::Matrix44r M = gCar->getTransform(); ! M.translate(0.0, 1.0, -3.0); ! SphereObject* projectile = new SphereObject(gSimulator, false, ! 0.6, opal::defaults::material, M); ! opal::Force f; ! f.vec = opal::Vec3r(0, 3000, -12000); ! f.type = opal::LOCAL_FORCE; ! f.timeLeft = (opal::real)0.01; ! projectile->getSolid()->addForce(f); ! gObjects.push_back(projectile); break; } *************** *** 504,511 **** break; case SDLK_LEFT: ! gCar->setSteering( 0.0 ); break; case SDLK_RIGHT: ! gCar->setSteering( 0.0 ); break; default: --- 507,514 ---- break; case SDLK_LEFT: ! gCar->setSteering(0.0); break; case SDLK_RIGHT: ! gCar->setSteering(0.0); break; default: *************** *** 545,549 **** if (!gPaused) { ! gSimulator->simulate( dt ); } --- 548,552 ---- if (!gPaused) { ! gSimulator->simulate(dt); } *************** *** 561,575 **** opal::Matrix44r carTransform = gCar->getTransform(); opal::Matrix44r cameraOffset = carTransform; ! cameraOffset.translate( 0.0, 1.5, 25.0 ); opal::Point3r carPos = carTransform.getPosition(); opal::Point3r cameraPos = cameraOffset.getPosition(); ! if (cameraPos[1] < 1.0 ) { cameraPos[1] = 1.0; } ! gluLookAt( cameraPos[0], cameraPos[1], cameraPos[2], carPos[0], carPos[1]+3.0, carPos[2], ! 0.0, 1.0, 0.0 ); } else --- 564,578 ---- opal::Matrix44r carTransform = gCar->getTransform(); opal::Matrix44r cameraOffset = carTransform; ! cameraOffset.translate(0.0, 1.5, 25.0); opal::Point3r carPos = carTransform.getPosition(); opal::Point3r cameraPos = cameraOffset.getPosition(); ! if (cameraPos[1] < 1.0) { cameraPos[1] = 1.0; } ! gluLookAt(cameraPos[0], cameraPos[1], cameraPos[2], carPos[0], carPos[1]+3.0, carPos[2], ! 0.0, 1.0, 0.0); } else *************** *** 580,584 **** } ! glCallList( gGroundDispList ); std::vector<Base3DObject*>::iterator iter; --- 583,587 ---- } ! glCallList(gGroundDispList); std::vector<Base3DObject*>::iterator iter; Index: car.vcproj =================================================================== RCS file: /cvsroot/opal/opal/samples/car/car.vcproj,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** car.vcproj 3 Feb 2005 19:44:11 -0000 1.10 --- car.vcproj 9 Feb 2005 07:12:45 -0000 1.11 *************** *** 38,42 **** OutputFile="$(OutDir)/car.exe" LinkIncremental="2" ! AdditionalLibraryDirectories="..\..\external\lib\win32" GenerateDebugInformation="TRUE" ProgramDatabaseFile="$(OutDir)/car.pdb" --- 38,42 ---- OutputFile="$(OutDir)/car.exe" LinkIncremental="2" ! AdditionalLibraryDirectories="" GenerateDebugInformation="TRUE" ProgramDatabaseFile="$(OutDir)/car.pdb" *************** *** 87,92 **** OutputFile="$(OutDir)/car.exe" LinkIncremental="1" ! AdditionalLibraryDirectories="..\..\external\lib\win32" ! GenerateDebugInformation="TRUE" SubSystem="1" OptimizeReferences="2" --- 87,92 ---- OutputFile="$(OutDir)/car.exe" LinkIncremental="1" ! AdditionalLibraryDirectories="" ! GenerateDebugInformation="FALSE" SubSystem="1" OptimizeReferences="2" |
From: tylerstreeter <tyl...@us...> - 2005-02-09 07:13:27
|
Update of /cvsroot/opal/opal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14586 Modified Files: SConstruct todo.txt Log Message: removed destroy functions and made destructors public again Index: SConstruct =================================================================== RCS file: /cvsroot/opal/opal/SConstruct,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SConstruct 2 Feb 2005 07:13:10 -0000 1.3 --- SConstruct 9 Feb 2005 07:12:44 -0000 1.4 *************** *** 50,54 **** LIBPATH = []) if env['debug'] == True: ! env.Append(CXXFLAGS = ['/MD', '/Od'], CPPDEFINES = ['/D_DEBUG']) else: --- 50,54 ---- LIBPATH = []) if env['debug'] == True: ! env.Append(CXXFLAGS = ['/MDd', '/Od'], CPPDEFINES = ['/D_DEBUG']) else: Index: todo.txt =================================================================== RCS file: /cvsroot/opal/opal/todo.txt,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** todo.txt 8 Feb 2005 21:54:25 -0000 1.28 --- todo.txt 9 Feb 2005 07:12:44 -0000 1.29 *************** *** 31,35 **** - most structs - custom motors - Immediate --- 31,34 ---- *************** *** 38,71 **** * add 'web' and 'doc' modules to repos - * fix SCons files (rename source files) - - * Questions - - do all class member functions need to specify calling convention? just public - - does event handler interface need to specify calling convention? does it need a destroy function? - - since the Simulator handles all memory internally, do we even need special destroy functions for everything? no, just things that get deleted on the user's end - - * remove destroy functions from most objects; make their destructors public again - * for most objects (e.g. joints, sensors, motors) should we have multiple create functions that each return different types, or just one create function (which returns a single type ptr), then call init in different ways to create different types? - * remove huge parameter lists from constructors / simulator construction methods - - Simulator (done) - - Solid (done) - - Joint (done) - - Motor (done) - - Sensor - - - solution: empty constructors, set params to default values - - if there are necessary params, use an init function - - internal-only constructors (e.g. ODESolid) can still take params - - * all objects have enable/disable functionality - - solids: disabled -> ??? disable collision detection? disable simulation? - - joints: disabled -> doesn't affect solids (already implemented) - - motors: disabled -> doesn't affect solids or joints (update() does nothing) (already implemented) - - sensors: disabled -> updates do nothing - * almost every member function should check if (enabled) at the beginning? * "desc" (description) classes - overloaded init functions (or "loadFromDesc") can take these instead of individual params --- 37,46 ---- * add 'web' and 'doc' modules to repos * for most objects (e.g. joints, sensors, motors) should we have multiple create functions that each return different types, or just one create function (which returns a single type ptr), then call init in different ways to create different types? * almost every member function should check if (enabled) at the beginning? + * remove params from Space creation + * "desc" (description) classes - overloaded init functions (or "loadFromDesc") can take these instead of individual params *************** *** 79,83 **** - SensorDesc: refers to SolidDescs ! * add "sensors"; could the event handler be replaced with these? - need an update function - types: --- 54,58 ---- - SensorDesc: refers to SolidDescs ! * sensors - need an update function - types: *************** *** 88,98 **** - InclineSensor (i.e. "inclinometer"): measures angle between initial and current orientation ! * shape class - solution: yes - user-created (not requested from simulator or solid) - * Solids: - - add a "setSpace" function that moves all shapes from the old space to the new space - * separate Solid options for sleeping (wakeUp, putToSleep, disable/enable sleeping) - per-object sleepiness --- 63,70 ---- - InclineSensor (i.e. "inclinometer"): measures angle between initial and current orientation ! * shape class/struct - solution: yes - user-created (not requested from simulator or solid) * separate Solid options for sleeping (wakeUp, putToSleep, disable/enable sleeping) - per-object sleepiness *************** *** 128,134 **** --- 100,110 ---- * add SConstructs to samples + * put headers in separate dir from source? + Possible Ideas ============== + * trigger Solids - set a boolean that makes contacts always ignored + * move includes from headers to cpp files wherever possible |
From: tylerstreeter <tyl...@us...> - 2005-02-09 07:13:27
|
Update of /cvsroot/opal/opal/samples/simple_objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14586/samples/simple_objects Modified Files: main.cpp simple_objects.vcproj Log Message: removed destroy functions and made destructors public again Index: main.cpp =================================================================== RCS file: /cvsroot/opal/opal/samples/simple_objects/main.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** main.cpp 26 Jan 2005 23:10:42 -0000 1.12 --- main.cpp 9 Feb 2005 07:12:45 -0000 1.13 *************** *** 57,75 **** { InitializeVariables(); ! gCameraRotX = 0.0; ! gCameraRotY = 0.0; ! gCameraZoom = -20.0; ! gCameraYPos = 0.0; ! gSimulator = opal::createSimulator( opal::Vec3r( (opal::real)0.0, (opal::real)-9.81, ! (opal::real)0.0 ) ); ! //gSimulator = new_ODESimulator( opal::Vec3r( (opal::real)0.0, (opal::real)-90.81, ! //(opal::real)0.0 ), (opal::real)0.01 ); //gSimulator->setAccuracy(opal::ACCURACY_VERY_HIGH); ! //gSimulator->setDefaultLinearDamping( 0.5 ); ! //gSimulator->setDefaultAngularDamping( 0.5 ); gTimer.Reset(); ! gGround = gSimulator->createSolid( true ); ! gGround->addPlane( gGroundParams, gGroundMaterial ); std::cout << "==============================================" << std::endl; --- 57,75 ---- { InitializeVariables(); ! gCameraRotX = 0; ! gCameraRotY = 0; ! gCameraZoom = -20; ! gCameraYPos = 0; ! gSimulator = opal::createSimulator(); ! //gSimulator = new_ODESimulator(opal::Vec3r((opal::real)0.0, (opal::real)-90.81, ! //(opal::real)0.0), (opal::real)0.01); //gSimulator->setAccuracy(opal::ACCURACY_VERY_HIGH); ! //gSimulator->setDefaultLinearDamping(0.5); ! //gSimulator->setDefaultAngularDamping(0.5); gTimer.Reset(); ! gGround = gSimulator->createSolid(); ! gGround->setStatic(true); ! gGround->addPlane(gGroundParams, gGroundMaterial); std::cout << "==============================================" << std::endl; *************** *** 310,314 **** break; case SDLK_m: ! if ( METAL == gObjectMaterialType ) { std::cout << "New object material is wood" << std::endl; --- 310,314 ---- break; case SDLK_m: ! if (METAL == gObjectMaterialType) { std::cout << "New object material is wood" << std::endl; *************** *** 316,320 **** gObjectMaterial = opal::globals::woodMaterial; } ! else if ( WOOD == gObjectMaterialType ) { std::cout << "New object material is rubber" << std::endl; --- 316,320 ---- gObjectMaterial = opal::globals::woodMaterial; } ! else if (WOOD == gObjectMaterialType) { std::cout << "New object material is rubber" << std::endl; *************** *** 322,326 **** gObjectMaterial = opal::globals::rubberMaterial; } ! else if ( RUBBER == gObjectMaterialType ) { std::cout << "New object material is ice" << std::endl; --- 322,326 ---- gObjectMaterial = opal::globals::rubberMaterial; } ! else if (RUBBER == gObjectMaterialType) { std::cout << "New object material is ice" << std::endl; *************** *** 328,332 **** gObjectMaterial = opal::globals::iceMaterial; } ! else if ( ICE == gObjectMaterialType ) { std::cout << "New object material is metal" << std::endl; --- 328,332 ---- gObjectMaterial = opal::globals::iceMaterial; } ! else if (ICE == gObjectMaterialType) { std::cout << "New object material is metal" << std::endl; *************** *** 336,380 **** break; case SDLK_g: ! if ( METAL == gGroundMaterialType ) { std::cout << "New ground material is wood" << std::endl; gGroundMaterialType = WOOD; gGroundMaterial = opal::globals::woodMaterial; ! gSimulator->destroySolid( gGround ); ! gGround = gSimulator->createSolid( true ); ! gGround->addPlane( gGroundParams, gGroundMaterial ); } ! else if ( WOOD == gGroundMaterialType ) { std::cout << "New ground material is rubber" << std::endl; gGroundMaterialType = RUBBER; gGroundMaterial = opal::globals::rubberMaterial; ! gSimulator->destroySolid( gGround ); ! gGround = gSimulator->createSolid( true ); ! gGround->addPlane( gGroundParams, gGroundMaterial ); } ! else if ( RUBBER == gGroundMaterialType ) { std::cout << "New ground material is ice" << std::endl; gGroundMaterialType = ICE; gGroundMaterial = opal::globals::iceMaterial; ! gSimulator->destroySolid( gGround ); ! gGround = gSimulator->createSolid( true ); ! gGround->addPlane( gGroundParams, gGroundMaterial ); } ! else if ( ICE == gGroundMaterialType ) { std::cout << "New ground material is metal" << std::endl; gGroundMaterialType = METAL; gGroundMaterial = opal::globals::metalMaterial; ! gSimulator->destroySolid( gGround ); ! gGround = gSimulator->createSolid( true ); ! gGround->addPlane( gGroundParams, gGroundMaterial ); } break; case SDLK_1: { ! BoxObject* newBox = new BoxObject( gSimulator, false, opal::Vec3r(0.1,0.1,0.1), ! gObjectMaterial ); gObjects.push_back(newBox); break; --- 336,385 ---- break; case SDLK_g: ! if (METAL == gGroundMaterialType) { std::cout << "New ground material is wood" << std::endl; gGroundMaterialType = WOOD; gGroundMaterial = opal::globals::woodMaterial; ! gSimulator->destroySolid(gGround); ! gGround = gSimulator->createSolid(); ! gGround->setStatic(true); ! gGround->addPlane(gGroundParams, gGroundMaterial); } ! else if (WOOD == gGroundMaterialType) { std::cout << "New ground material is rubber" << std::endl; gGroundMaterialType = RUBBER; gGroundMaterial = opal::globals::rubberMaterial; ! gSimulator->destroySolid(gGround); ! gGround = gSimulator->createSolid(); ! gGround->setStatic(true); ! gGround->addPlane(gGroundParams, gGroundMaterial); } ! else if (RUBBER == gGroundMaterialType) { std::cout << "New ground material is ice" << std::endl; gGroundMaterialType = ICE; gGroundMaterial = opal::globals::iceMaterial; ! gSimulator->destroySolid(gGround); ! gGround = gSimulator->createSolid(); ! gGround->setStatic(true); ! gGround->addPlane(gGroundParams, gGroundMaterial); } ! else if (ICE == gGroundMaterialType) { std::cout << "New ground material is metal" << std::endl; gGroundMaterialType = METAL; gGroundMaterial = opal::globals::metalMaterial; ! gSimulator->destroySolid(gGround); ! gGround = gSimulator->createSolid(); ! gGround->setStatic(true); ! gGround->addPlane(gGroundParams, gGroundMaterial); } break; case SDLK_1: { ! BoxObject* newBox = new BoxObject(gSimulator, false, ! opal::Vec3r((opal::real)0.1, (opal::real)0.1, (opal::real)0.1), ! gObjectMaterial); gObjects.push_back(newBox); break; *************** *** 382,387 **** case SDLK_2: { ! BoxObject* newBox = new BoxObject( gSimulator, false, opal::Vec3r(0.4,0.4,0.4), ! gObjectMaterial ); gObjects.push_back(newBox); break; --- 387,393 ---- case SDLK_2: { ! BoxObject* newBox = new BoxObject(gSimulator, false, ! opal::Vec3r((opal::real)0.4, (opal::real)0.4, (opal::real)0.4), ! gObjectMaterial); gObjects.push_back(newBox); break; *************** *** 389,394 **** case SDLK_3: { ! BoxObject* newBox = new BoxObject( gSimulator, false, opal::Vec3r(1.5,1.5,1.5), ! gObjectMaterial ); gObjects.push_back(newBox); break; --- 395,401 ---- case SDLK_3: { ! BoxObject* newBox = new BoxObject(gSimulator, false, ! opal::Vec3r((opal::real)1.5, (opal::real)1.5, (opal::real)1.5), ! gObjectMaterial); gObjects.push_back(newBox); break; *************** *** 396,401 **** case SDLK_4: { ! BoxObject* newBox = new BoxObject( gSimulator, false, opal::Vec3r(5,1,1), ! gObjectMaterial ); gObjects.push_back(newBox); break; --- 403,408 ---- case SDLK_4: { ! BoxObject* newBox = new BoxObject(gSimulator, false, ! opal::Vec3r(5, 1, 1), gObjectMaterial); gObjects.push_back(newBox); break; *************** *** 403,408 **** case SDLK_5: { ! BoxObject* newBox = new BoxObject( gSimulator, false, opal::Vec3r(5, 0.05, 5), ! gObjectMaterial ); gObjects.push_back(newBox); break; --- 410,416 ---- case SDLK_5: { ! BoxObject* newBox = new BoxObject(gSimulator, false, ! opal::Vec3r(5, (opal::real)0.05, 5), ! gObjectMaterial); gObjects.push_back(newBox); break; *************** *** 431,435 **** case SDLK_9: { ! CarObject* newCar = new CarObject(gSimulator, 1.0); gObjects.push_back(newCar); break; --- 439,443 ---- case SDLK_9: { ! CarObject* newCar = new CarObject(gSimulator, (opal::real)1.0); gObjects.push_back(newCar); break; *************** *** 485,489 **** if (!gPaused) { ! gSimulator->simulate( dt ); } --- 493,497 ---- if (!gPaused) { ! gSimulator->simulate(dt); } Index: simple_objects.vcproj =================================================================== RCS file: /cvsroot/opal/opal/samples/simple_objects/simple_objects.vcproj,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** simple_objects.vcproj 26 Jan 2005 23:10:42 -0000 1.8 --- simple_objects.vcproj 9 Feb 2005 07:12:45 -0000 1.9 *************** *** 23,28 **** PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" MinimalRebuild="TRUE" ! BasicRuntimeChecks="0" ! RuntimeLibrary="2" UsePrecompiledHeader="0" WarningLevel="3" --- 23,28 ---- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" MinimalRebuild="TRUE" ! BasicRuntimeChecks="3" ! RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="3" *************** *** 36,40 **** OutputFile="$(OutDir)/simple_objects.exe" LinkIncremental="2" ! AdditionalLibraryDirectories="..\..\external\lib\win32" GenerateDebugInformation="TRUE" ProgramDatabaseFile="$(OutDir)/simple_objects.pdb" --- 36,40 ---- OutputFile="$(OutDir)/simple_objects.exe" LinkIncremental="2" ! AdditionalLibraryDirectories="" GenerateDebugInformation="TRUE" ProgramDatabaseFile="$(OutDir)/simple_objects.pdb" *************** *** 87,91 **** OutputFile="$(OutDir)/simple_objects.exe" LinkIncremental="1" ! AdditionalLibraryDirectories="..\..\external\lib\win32" GenerateDebugInformation="TRUE" SubSystem="1" --- 87,91 ---- OutputFile="$(OutDir)/simple_objects.exe" LinkIncremental="1" ! AdditionalLibraryDirectories="" GenerateDebugInformation="TRUE" SubSystem="1" |
From: tylerstreeter <tyl...@us...> - 2005-02-08 21:55:35
|
Update of /cvsroot/opal/opal/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18602/src Modified Files: Defines.h DesiredPosMotor.cpp Motor.cpp Motor.h SConscript Simulator.cpp Simulator.h Solid.cpp Solid.h Added Files: Sensor.cpp Sensor.h Log Message: added a Sensor class --- NEW FILE: Sensor.h --- /************************************************************************* * * * Open Physics Abstraction Layer * * Copyright (C) 2004-2005 * * Alan Fischer ala...@gm... * * Andres Reinot an...@re... * * Tyler Streeter tyl...@gm... * * All rights reserved. * * Web: opal.sourceforge.net * * * * 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-LGPL.txt. * * (2) The BSD-style license that is included with this library in * * the file license-BSD.txt. * * * * 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-LGPL.txt and license-BSD.txt for more details. * * * *************************************************************************/ #ifndef OPAL_SENSOR_H #define OPAL_SENSOR_H #include "Defines.h" namespace opal { class Sensor { public: Sensor(); virtual ~Sensor(); /// Called regularly to update the Sensor. virtual void OPAL_CALL internal_update() = 0; /// Returns true if the Motor is enabled. virtual bool OPAL_CALL isEnabled()const; /// Sets whether the Motor can affect anything. virtual void OPAL_CALL setEnabled(bool e); /// Returns true if this Sensor depends on the given Solid. virtual bool OPAL_CALL internal_dependsOn(Solid* solid); protected: bool mEnabled; private: }; } #endif Index: Solid.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/Solid.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Solid.cpp 8 Feb 2005 04:59:05 -0000 1.13 --- Solid.cpp 8 Feb 2005 21:54:21 -0000 1.14 *************** *** 35,42 **** mEventHandler = NULL; setUserData(NULL); ! mPrevGlobalLinearVel.set(0.0, 0.0, 0.0); ! mPrevGlobalAngularVel.set(0.0, 0.0, 0.0); ! mGlobalLinearAccel.set(0.0, 0.0, 0.0); ! mGlobalAngularAccel.set(0.0, 0.0, 0.0); setLinearDamping(defaults::linearDamping); setAngularDamping(defaults::linearDamping); --- 35,42 ---- mEventHandler = NULL; setUserData(NULL); ! //mPrevGlobalLinearVel.set(0.0, 0.0, 0.0); ! //mPrevGlobalAngularVel.set(0.0, 0.0, 0.0); ! //mGlobalLinearAccel.set(0.0, 0.0, 0.0); ! //mGlobalAngularAccel.set(0.0, 0.0, 0.0); setLinearDamping(defaults::linearDamping); setAngularDamping(defaults::linearDamping); *************** *** 58,82 **** //} ! void Solid::internal_updateAcceleration(real dt) ! { ! Vec3r currentGlobalLinearVel = getGlobalLinearVel(); ! Vec3r currentGlobalAngularVel = getGlobalAngularVel(); ! mGlobalLinearAccel = (currentGlobalLinearVel - ! mPrevGlobalLinearVel) / dt; ! mGlobalAngularAccel = (currentGlobalAngularVel - ! mPrevGlobalAngularVel) / dt; ! mPrevGlobalLinearVel = currentGlobalLinearVel; ! mPrevGlobalAngularVel = currentGlobalAngularVel; ! } ! Vec3r Solid::getGlobalLinearAccel()const ! { ! return mGlobalLinearAccel; ! } ! Vec3r Solid::getGlobalAngularAccel()const ! { ! return mGlobalAngularAccel; ! } bool Solid::getStatic() --- 58,82 ---- //} ! //void Solid::internal_updateAcceleration(real dt) ! //{ ! // Vec3r currentGlobalLinearVel = getGlobalLinearVel(); ! // Vec3r currentGlobalAngularVel = getGlobalAngularVel(); ! // mGlobalLinearAccel = (currentGlobalLinearVel - ! // mPrevGlobalLinearVel) / dt; ! // mGlobalAngularAccel = (currentGlobalAngularVel - ! // mPrevGlobalAngularVel) / dt; ! // mPrevGlobalLinearVel = currentGlobalLinearVel; ! // mPrevGlobalAngularVel = currentGlobalAngularVel; ! //} ! //Vec3r Solid::getGlobalLinearAccel()const ! //{ ! // return mGlobalLinearAccel; ! //} ! //Vec3r Solid::getGlobalAngularAccel()const ! //{ ! // return mGlobalAngularAccel; ! //} bool Solid::getStatic() Index: Motor.h =================================================================== RCS file: /cvsroot/opal/opal/src/Motor.h,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** Motor.h 8 Feb 2005 04:59:05 -0000 1.26 --- Motor.h 8 Feb 2005 21:54:19 -0000 1.27 *************** *** 47,50 **** --- 47,51 ---- //bool getGlobal(); + /// Called regularly to update the Motor. virtual void OPAL_CALL internal_update() = 0; *************** *** 52,56 **** virtual bool OPAL_CALL isEnabled()const; ! /// Set whether the Motor can affect anything. virtual void OPAL_CALL setEnabled(bool e); --- 53,57 ---- virtual bool OPAL_CALL isEnabled()const; ! /// Sets whether the Motor can affect anything. virtual void OPAL_CALL setEnabled(bool e); *************** *** 61,68 **** --- 62,77 ---- virtual bool OPAL_CALL internal_dependsOn(Joint* joint); + /// Sets whether this is a custom Motor. Used internally to + /// track custom Motors which must not be destroyed by OPAL. + virtual void OPAL_CALL internal_setCustom(bool c); + + /// Returns true if this is a custom Motor. + virtual bool OPAL_CALL internal_isCustom(); + protected: virtual ~Motor(); bool mEnabled; + bool mIsCustom; private: Index: SConscript =================================================================== RCS file: /cvsroot/opal/opal/src/SConscript,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SConscript 4 Feb 2005 04:52:29 -0000 1.4 --- SConscript 8 Feb 2005 21:54:19 -0000 1.5 *************** *** 8,20 **** Blueprint.h BlueprintManager.h - ConstForceMotor.h Defines.h DesiredPosMotor.h EventHandler.h FixedJoint.h Hinge2Joint.h HingeJoint.h Joint.h - LimitedForceMotor.h Matrix44r.h Motor.h --- 8,19 ---- Blueprint.h BlueprintManager.h Defines.h DesiredPosMotor.h EventHandler.h FixedJoint.h + GearedMotor.h Hinge2Joint.h HingeJoint.h Joint.h Matrix44r.h Motor.h *************** *** 25,28 **** --- 24,28 ---- Quaternion.h Rayr.h + Sensor.h ServoMotor.h Simulator.h *************** *** 31,34 **** --- 31,35 ---- Solid.h Space.h + ThrusterMotor.h UniversalJoint.h Vec3r.h *************** *** 40,51 **** Blueprint.cpp BlueprintManager.cpp - ConstForceMotor.cpp DesiredPosMotor.cpp Joint.cpp - LimitedForceMotor.cpp Motor.cpp ServoMotor.cpp Simulator.cpp Solid.cpp """) --- 41,53 ---- Blueprint.cpp BlueprintManager.cpp DesiredPosMotor.cpp + GearedMotor.cpp Joint.cpp Motor.cpp + Sensor.cpp ServoMotor.cpp Simulator.cpp Solid.cpp + ThrusterMotor.cpp """) Index: DesiredPosMotor.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/DesiredPosMotor.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** DesiredPosMotor.cpp 8 Feb 2005 04:59:05 -0000 1.10 --- DesiredPosMotor.cpp 8 Feb 2005 21:54:18 -0000 1.11 *************** *** 54,57 **** --- 54,58 ---- mSolid = solid; mMode = m; + mEnabled = true; } Index: Simulator.h =================================================================== RCS file: /cvsroot/opal/opal/src/Simulator.h,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** Simulator.h 8 Feb 2005 04:59:05 -0000 1.64 --- Simulator.h 8 Feb 2005 21:54:21 -0000 1.65 *************** *** 45,48 **** --- 45,49 ---- #include "DesiredPosMotor.h" #include "Blueprint.h" + #include "Sensor.h" namespace opal *************** *** 109,119 **** virtual void OPAL_CALL setMaxLinearVel(real max); ! virtual real OPAL_CALL getMaxLinearVel(); virtual void OPAL_CALL setMaxAngularVel(real max); ! virtual real OPAL_CALL getMaxAngularVel(); ! // solids virtual Solid* OPAL_CALL createSolid( const Matrix44r& transform=Matrix44r(), --- 110,122 ---- virtual void OPAL_CALL setMaxLinearVel(real max); ! virtual real OPAL_CALL getMaxLinearVel()const; virtual void OPAL_CALL setMaxAngularVel(real max); ! virtual real OPAL_CALL getMaxAngularVel()const; ! // SOLIDS ! ! /// Creates and returns a pointer to a Solid. virtual Solid* OPAL_CALL createSolid( const Matrix44r& transform=Matrix44r(), *************** *** 121,125 **** /// Marks the given Solid as garbage. ! virtual void OPAL_CALL destroySolid(Solid * solid); /// Marks all Solids in the Simulator as garbage. --- 124,128 ---- /// Marks the given Solid as garbage. ! virtual void OPAL_CALL destroySolid(Solid* s); /// Marks all Solids in the Simulator as garbage. *************** *** 128,135 **** virtual const std::vector<Solid*>& OPAL_CALL getSolids()const; ! // spaces ! virtual Space* OPAL_CALL createSpace(Space* parentSpace = NULL) = 0; - // joints virtual HingeJoint* OPAL_CALL createHingeJoint(Solid* solid1, Solid* solid2,const Point3r& anchor, const Vec3r& axis) = 0; --- 131,136 ---- virtual const std::vector<Solid*>& OPAL_CALL getSolids()const; ! // JOINTS virtual HingeJoint* OPAL_CALL createHingeJoint(Solid* solid1, Solid* solid2,const Point3r& anchor, const Vec3r& axis) = 0; *************** *** 154,163 **** /// Marks the given Joint as garbage. ! virtual void OPAL_CALL destroyJoint(Joint * joint); /// Marks all Joints in the Simulator as garbage. virtual void OPAL_CALL destroyAllJoints(); ! //motors virtual ThrusterMotor* OPAL_CALL createThrusterMotor(); --- 155,165 ---- /// Marks the given Joint as garbage. ! virtual void OPAL_CALL destroyJoint(Joint* j); /// Marks all Joints in the Simulator as garbage. virtual void OPAL_CALL destroyAllJoints(); ! // MOTORS ! virtual ThrusterMotor* OPAL_CALL createThrusterMotor(); *************** *** 170,202 **** virtual DesiredPosMotor* OPAL_CALL createDesiredPosMotor(); ! // custom motors must be created in a special way that uses this ! // function ! virtual void OPAL_CALL addCustomMotor(Motor* motor); /// Marks the given Motor as garbage. ! virtual void OPAL_CALL destroyMotor(Motor* motor); /// Marks all Motors in the Simulator as garbage. virtual void OPAL_CALL destroyAllMotors(); protected: virtual ~Simulator(); ! void addSolid(Solid * s); ! void removeSolid(Solid * s); ! void addJoint(Joint * j); ! void removeJoint(Joint * j); ! void addMotor(Motor * m); ! void removeMotor(Motor * m); ! void addSpace(Space * s); ! /// Destroys all objects in the Simulator marked as garbage. ! void collectGarbage(); real mStepSize; --- 172,222 ---- virtual DesiredPosMotor* OPAL_CALL createDesiredPosMotor(); ! /// Inform the Simulator of a custom Motor. Custom Motors are ! /// allocated and deallocated by the user ! virtual void OPAL_CALL registerCustomMotor(Motor* m); /// Marks the given Motor as garbage. ! virtual void OPAL_CALL destroyMotor(Motor* m); /// Marks all Motors in the Simulator as garbage. virtual void OPAL_CALL destroyAllMotors(); + // SENSORS + + /// Creates and returns a pointer to a Sensor. + virtual Solid* OPAL_CALL createSensor(); + + /// Marks the given Sensor as garbage. + virtual void OPAL_CALL destroySensor(Sensor* s); + + /// Marks all Sensors in the Simulator as garbage. + virtual void OPAL_CALL destroyAllSensors(); + + // SPACES + virtual Space* OPAL_CALL createSpace(Space* parentSpace = NULL) = 0; + protected: virtual ~Simulator(); ! /// Destroys all objects in the Simulator marked as garbage. ! void internal_collectGarbage(); ! void addSolid(Solid* s); ! void removeSolid(Solid* s); ! void addJoint(Joint* j); ! void removeJoint(Joint* j); ! void addMotor(Motor* m); ! void removeMotor(Motor* m); ! void addSensor(Sensor* s); ! ! void removeSensor(Sensor* s); ! ! void addSpace(Space* s); real mStepSize; *************** *** 214,228 **** std::vector<Joint*> mJointList; std::vector<Motor*> mMotorList; std::vector<Solid*> mSolidGarbageList; std::vector<Joint*> mJointGarbageList; std::vector<Motor*> mMotorGarbageList; ! /// Spaces are stored so the user doesn't have to destroy them; they ! /// get destroyed in Simulator::destroy. std::vector<Space*> mSpaceList; private: - }; } --- 234,249 ---- std::vector<Joint*> mJointList; std::vector<Motor*> mMotorList; + std::vector<Sensor*> mSensorList; std::vector<Solid*> mSolidGarbageList; std::vector<Joint*> mJointGarbageList; std::vector<Motor*> mMotorGarbageList; + std::vector<Sensor*> mSensorGarbageList; ! /// Spaces are stored here so the user doesn't have to destroy them; ! /// they get destroyed in Simulator::destroy. std::vector<Space*> mSpaceList; private: }; } --- NEW FILE: Sensor.cpp --- /************************************************************************* * * * Open Physics Abstraction Layer * * Copyright (C) 2004-2005 * * Alan Fischer ala...@gm... * * Andres Reinot an...@re... * * Tyler Streeter tyl...@gm... * * All rights reserved. * * Web: opal.sourceforge.net * * * * 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-LGPL.txt. * * (2) The BSD-style license that is included with this library in * * the file license-BSD.txt. * * * * 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-LGPL.txt and license-BSD.txt for more details. * * * *************************************************************************/ #include "Sensor.h" namespace opal { Sensor::Sensor() { mEnabled = false; } Sensor::~Sensor() { } bool Sensor::isEnabled()const { return mEnabled; } void Sensor::setEnabled(bool e) { mEnabled = e; } bool Sensor::internal_dependsOn(Solid* solid) { return false; } } Index: Defines.h =================================================================== RCS file: /cvsroot/opal/opal/src/Defines.h,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** Defines.h 8 Feb 2005 04:59:05 -0000 1.46 --- Defines.h 8 Feb 2005 21:54:09 -0000 1.47 *************** *** 85,88 **** --- 85,89 ---- }; + // TODO: replace with SolidDesc struct struct BodyState { Index: Solid.h =================================================================== RCS file: /cvsroot/opal/opal/src/Solid.h,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** Solid.h 8 Feb 2005 04:59:05 -0000 1.65 --- Solid.h 8 Feb 2005 21:54:21 -0000 1.66 *************** *** 57,65 **** virtual void OPAL_CALL internal_uploadTransformChanges() = 0; ! virtual void OPAL_CALL internal_updateAcceleration(real dt); ! virtual Vec3r OPAL_CALL getGlobalLinearAccel()const; ! virtual Vec3r OPAL_CALL getGlobalAngularAccel()const; virtual bool OPAL_CALL getStatic(); --- 57,65 ---- virtual void OPAL_CALL internal_uploadTransformChanges() = 0; ! //virtual void OPAL_CALL internal_updateAcceleration(real dt); ! //virtual Vec3r OPAL_CALL getGlobalLinearAccel()const; ! //virtual Vec3r OPAL_CALL getGlobalAngularAccel()const; virtual bool OPAL_CALL getStatic(); *************** *** 233,240 **** void* mUserData; ! Vec3r mPrevGlobalLinearVel; ! Vec3r mPrevGlobalAngularVel; ! Vec3r mGlobalLinearAccel; ! Vec3r mGlobalAngularAccel; real mLinearDamping; --- 233,240 ---- void* mUserData; ! //Vec3r mPrevGlobalLinearVel; ! //Vec3r mPrevGlobalAngularVel; ! //Vec3r mGlobalLinearAccel; ! //Vec3r mGlobalAngularAccel; real mLinearDamping; Index: Simulator.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/Simulator.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Simulator.cpp 8 Feb 2005 04:59:05 -0000 1.20 --- Simulator.cpp 8 Feb 2005 21:54:20 -0000 1.21 *************** *** 60,64 **** } ! collectGarbage(); while (!mSpaceList.empty()) --- 60,69 ---- } ! for (size_t i=0; i<mSensorList.size(); ++i) ! { ! mSensorGarbageList.push_back(mSensorList[i]); ! } ! ! internal_collectGarbage(); while (!mSpaceList.empty()) *************** *** 72,77 **** bool Simulator::simulate(real dt) { ! // go through all solids and see if their transforms have been ! // changed manually; if so, upload the changes to the system. for (size_t i = 0; i < mSolidList.size(); ++i) { --- 77,83 ---- bool Simulator::simulate(real dt) { ! // Go through all Solids and see if their transforms have been ! // changed manually; if so, upload the changes to the physics ! // engine. for (size_t i = 0; i < mSolidList.size(); ++i) { *************** *** 85,88 **** --- 91,95 ---- mTimeBuffer += dt; + // Use this to return true if at least one step occurred. bool stepOccurred = false; if (mTimeBuffer >= mStepSize) *************** *** 100,104 **** // TODO: Call some user-defined function here... ! // Update motors std::vector<Motor*>::iterator motorIter; for (motorIter = mMotorList.begin(); --- 107,119 ---- // TODO: Call some user-defined function here... ! // Update sensors. ! std::vector<Sensor*>::iterator sensorIter; ! for (sensorIter = mSensorList.begin(); ! sensorIter != mSensorList.end(); ++sensorIter) ! { ! (*sensorIter)->internal_update(); ! } ! ! // Update motors. std::vector<Motor*>::iterator motorIter; for (motorIter = mMotorList.begin(); *************** *** 108,112 **** } ! // Apply forces/torques std::vector<Solid*>::iterator solidIter; for (solidIter = mSolidList.begin(); --- 123,127 ---- } ! // Apply forces/torques to Solids. std::vector<Solid*>::iterator solidIter; for (solidIter = mSolidList.begin(); *************** *** 116,120 **** } ! // Update joints, check for broken joints std::vector<Joint*>::iterator jointIter; for (jointIter = mJointList.begin(); --- 131,135 ---- } ! // Update joints, check for broken joints. std::vector<Joint*>::iterator jointIter; for (jointIter = mJointList.begin(); *************** *** 126,130 **** if (j->internal_isBroken()) { ! // send joint break event j->internal_handleJointBreakEvent(); --- 141,145 ---- if (j->internal_isBroken()) { ! // Send a Joint break event. j->internal_handleJointBreakEvent(); *************** *** 152,156 **** internal_stepPhysics(); ! // loop over solids again for (solidIter = mSolidList.begin(); solidIter != mSolidList.end(); ++solidIter) --- 167,171 ---- internal_stepPhysics(); ! // Loop over Solids again. for (solidIter = mSolidList.begin(); solidIter != mSolidList.end(); ++solidIter) *************** *** 158,162 **** Solid* solid = *solidIter; ! // cap velocities Vec3r linearVel = solid->getGlobalLinearVel(); if (linearVel[0] > mMaxLinearVel) --- 173,177 ---- Solid* solid = *solidIter; ! // Cap velocities. Vec3r linearVel = solid->getGlobalLinearVel(); if (linearVel[0] > mMaxLinearVel) *************** *** 189,197 **** solid->setGlobalAngularVel(angularVel); ! // get each solid's new transform from the physics engine solid->internal_updateTransform(); ! // update accelerations ! solid->internal_updateAcceleration(dt); } --- 204,212 ---- solid->setGlobalAngularVel(angularVel); ! // Get each solid's new transform from the physics engine. solid->internal_updateTransform(); ! //// Update accelerations ! //solid->internal_updateAcceleration(dt); } *************** *** 315,318 **** --- 330,334 ---- Vec3r axis2 = (*jointIter).second.axis2; + // TODO: finish this... switch((*jointIter).second.type) { *************** *** 415,419 **** } ! real Simulator::getMaxLinearVel() { return mMaxLinearVel; --- 431,435 ---- } ! real Simulator::getMaxLinearVel()const { return mMaxLinearVel; *************** *** 426,437 **** } ! real Simulator::getMaxAngularVel() { return mMaxAngularVel; } ! void Simulator::destroySolid(Solid * solid) { ! mSolidGarbageList.push_back(solid); } --- 442,453 ---- } ! real Simulator::getMaxAngularVel()const { return mMaxAngularVel; } ! void Simulator::destroySolid(Solid* s) { ! mSolidGarbageList.push_back(s); } *************** *** 452,458 **** } ! void Simulator::destroyJoint(Joint * joint) { ! mJointGarbageList.push_back(joint); } --- 468,474 ---- } ! void Simulator::destroyJoint(Joint* j) { ! mJointGarbageList.push_back(j); } *************** *** 496,508 **** } ! //custom motors must be created in a special way that uses this function ! void Simulator::addCustomMotor(Motor* motor) { ! addMotor(motor); } ! void Simulator::destroyMotor(Motor* motor) { ! mMotorGarbageList.push_back(motor); } --- 512,523 ---- } ! void Simulator::registerCustomMotor(Motor* m) { ! addMotor(m); } ! void Simulator::destroyMotor(Motor* m) { ! mMotorGarbageList.push_back(m); } *************** *** 518,521 **** --- 533,562 ---- } + Solid* Simulator::createSensor() + { + //Sensor* newSensor = new Sensor(); + //addSensor(newSensor); + //return newSensor; + + // Temporary... + return NULL; + } + + void Simulator::destroySensor(Sensor* s) + { + mSensorGarbageList.push_back(s); + } + + void Simulator::destroyAllSensors() + { + // Just mark everything as garbage; it'll get destroyed at the end of + // the current step. + + for (size_t i=0; i<mSensorList.size(); ++i) + { + mSensorGarbageList.push_back(mSensorList[i]); + } + } + void Simulator::setSleepiness(real value) { *************** *** 538,547 **** } ! void Simulator::addSolid(Solid * s) { mSolidList.push_back(s); } ! void Simulator::removeSolid(Solid * s) { // TODO: make this more efficient by not iterating through all Motors --- 579,588 ---- } ! void Simulator::addSolid(Solid* s) { mSolidList.push_back(s); } ! void Simulator::removeSolid(Solid* s) { // TODO: make this more efficient by not iterating through all Motors *************** *** 569,572 **** --- 610,623 ---- } + // Disable Sensors that depend on the given Solid. + std::vector<Sensor*>::iterator iter3; + for (iter3 = mSensorList.begin(); iter3 != mSensorList.end(); ++iter3) + { + if ((*iter3)->internal_dependsOn(s)) + { + (*iter3)->setEnabled(false); + } + } + // Now remove the Solid. for(size_t i = 0; i<mSolidList.size(); ++i) *************** *** 584,593 **** } ! void Simulator::addJoint(Joint * j) { mJointList.push_back(j); } ! void Simulator::removeJoint(Joint * j) { // TODO: make this more efficient by not iterating through all Motors --- 635,644 ---- } ! void Simulator::addJoint(Joint* j) { mJointList.push_back(j); } ! void Simulator::removeJoint(Joint* j) { // TODO: make this more efficient by not iterating through all Motors *************** *** 620,629 **** } ! void Simulator::addMotor(Motor * m) { mMotorList.push_back(m); } ! void Simulator::removeMotor(Motor * m) { for(size_t i = 0; i<mMotorList.size(); ++i) --- 671,680 ---- } ! void Simulator::addMotor(Motor* m) { mMotorList.push_back(m); } ! void Simulator::removeMotor(Motor* m) { for(size_t i = 0; i<mMotorList.size(); ++i) *************** *** 631,636 **** if(mMotorList[i] == m) { ! //delete m; ! m->internal_destroy(); mMotorList[i] = mMotorList.back(); mMotorList.pop_back(); --- 682,690 ---- if(mMotorList[i] == m) { ! if (!m->internal_isCustom()) ! { ! //delete m; ! m->internal_destroy(); ! } mMotorList[i] = mMotorList.back(); mMotorList.pop_back(); *************** *** 641,650 **** } ! void Simulator::addSpace(Space * s) { mSpaceList.push_back(s); } ! void Simulator::collectGarbage() { for (size_t i=0; i<mSolidGarbageList.size(); ++i) --- 695,725 ---- } ! void Simulator::addSensor(Sensor* s) ! { ! mSensorList.push_back(s); ! } ! ! void Simulator::removeSensor(Sensor* s) ! { ! for(size_t i = 0; i<mSensorList.size(); ++i) ! { ! if(mSensorList[i] == s) ! { ! delete s; ! //s->internal_destroy(); ! mSensorList[i] = mSensorList.back(); ! mSensorList.pop_back(); ! ! return; ! } ! } ! } ! ! void Simulator::addSpace(Space* s) { mSpaceList.push_back(s); } ! void Simulator::internal_collectGarbage() { for (size_t i=0; i<mSolidGarbageList.size(); ++i) Index: Motor.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/Motor.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Motor.cpp 8 Feb 2005 04:59:05 -0000 1.8 --- Motor.cpp 8 Feb 2005 21:54:18 -0000 1.9 *************** *** 32,37 **** Motor::Motor() { - //mGlobal = isGlobal; mEnabled = false; } --- 32,37 ---- Motor::Motor() { mEnabled = false; + mIsCustom = false; } *************** *** 59,61 **** --- 59,71 ---- return false; } + + void Motor::internal_setCustom(bool c) + { + mIsCustom = c; + } + + bool Motor::internal_isCustom() + { + return mIsCustom; + } } |
From: tylerstreeter <tyl...@us...> - 2005-02-08 21:55:07
|
Update of /cvsroot/opal/opal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18602 Modified Files: todo.txt Log Message: added a Sensor class Index: todo.txt =================================================================== RCS file: /cvsroot/opal/opal/todo.txt,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** todo.txt 8 Feb 2005 04:59:07 -0000 1.27 --- todo.txt 8 Feb 2005 21:54:25 -0000 1.28 *************** *** 18,21 **** --- 18,36 ---- - Force + Object Properties + - user managed vs. OPAL managed + + Document + ======== + * objects with init functions - call init immediately after construction + + * init functions enable objects + + * most objects are created and destroyed by the Simulator, but some are user-managed + - examples of user-managed: + - most structs + - custom motors + + Immediate ========= *************** *** 23,29 **** * add 'web' and 'doc' modules to repos * Questions ! - do all class member functions need to specify calling convention? - does event handler interface need to specify calling convention? does it need a destroy function? * remove huge parameter lists from constructors / simulator construction methods --- 38,51 ---- * add 'web' and 'doc' modules to repos + * fix SCons files (rename source files) + * Questions ! - do all class member functions need to specify calling convention? just public - does event handler interface need to specify calling convention? does it need a destroy function? + - since the Simulator handles all memory internally, do we even need special destroy functions for everything? no, just things that get deleted on the user's end + + * remove destroy functions from most objects; make their destructors public again + + * for most objects (e.g. joints, sensors, motors) should we have multiple create functions that each return different types, or just one create function (which returns a single type ptr), then call init in different ways to create different types? * remove huge parameter lists from constructors / simulator construction methods *************** *** 34,38 **** - Sensor ! - solution: empty constructors, set params to default valFues - if there are necessary params, use an init function - internal-only constructors (e.g. ODESolid) can still take params --- 56,60 ---- - Sensor ! - solution: empty constructors, set params to default values - if there are necessary params, use an init function - internal-only constructors (e.g. ODESolid) can still take params *************** *** 51,68 **** - how do different descs refer to other objects? by name? by int id? - examples: ! - SolidDesc (contains many ShapeDescs) ! - ShapeDesc ! - JointDesc ! - MotorDesc ! - SensorDesc * add "sensors"; could the event handler be replaced with these? ! - ray casting/rangefinder: measures distance from sensor to first intersection (attach to a solid [be sure to ignore collisions with the attached solid] or nothing) ! - contact: holds a queue of contact events (attach to a solid, to a single shape, or to nothing?) ! - velocimeter: linear vel sensor ! - linear accelerometer: linear accel sensor ! - inclinometer: angular pos sensor; measures angle between initial and current orientation ! - gyroscope: angular vel sensor ! - angular accelerometer: angular accel sensor * shape class --- 73,90 ---- - how do different descs refer to other objects? by name? by int id? - examples: ! - SolidDesc (contains many ShapeDescs, or maybe just references to them) ! - ShapeDesc ! - JointDesc: refers to SolidDescs ! - MotorDesc: refers to SolidDescs and/or JointDescs ! - SensorDesc: refers to SolidDescs * add "sensors"; could the event handler be replaced with these? ! - need an update function ! - types: ! - RayCastSensor (i.e. "PSD (position sensitive detector)" or "rangefinder"): measures distance from sensor to first intersection (attach to a solid [be sure to ignore collisions with the attached solid] or nothing) ! - ContactSensor: holds a queue of contact events (attach to a solid, to a single shape, or to nothing?) ! - VelocitySensor: linear vel (i.e. "velocimeter") and/or angular vel ("gyroscope") sensor ! - AccelerationSensor (i.e. "accelerometer"): linear and/or angular acceleration sensor ! - InclineSensor (i.e. "inclinometer"): measures angle between initial and current orientation * shape class *************** *** 86,94 **** * Add a boolean to Solid that determines if it generates contacts at all (the docking volume shouldn't collide with anything but should generate collision events still). ! * rename motors? ! - "effectors" ! - "actuators" ! ! * remove address accessor to matrix (too dangerous for new users?) - solution: keep and document, or remove? --- 108,112 ---- * Add a boolean to Solid that determines if it generates contacts at all (the docking volume shouldn't collide with anything but should generate collision events still). ! * remove address accessor to Solid transform (too dangerous for new users?) - solution: keep and document, or remove? *************** *** 97,100 **** --- 115,123 ---- - update instantiation functions + * event handling/callbacks + - collisions + - broken joints + - beginning of step + Build System ============ *************** *** 108,114 **** --- 131,147 ---- ============== + * move includes from headers to cpp files wherever possible + + * change the internal_dependsOn functions -> have bidirectional references (dependency lists) so we don't have to search lists for dependencies + * Joints: - add a JointAxis struct? + * Put BlueprintManager stuff into the Simulator itself and remove BlueprintManager? + + * contact filtering + - averaging + - other methods? + * in the cases where overloaded functions call the original function (e.g. derived setParam calls parent class setParam function), should we keep it this way? or should the overloaded version just do everything? |
From: tylerstreeter <tyl...@us...> - 2005-02-08 21:55:05
|
Update of /cvsroot/opal/opal/src/ODE In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18602/src/ODE Modified Files: ODESimulator.h Log Message: added a Sensor class Index: ODESimulator.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESimulator.h,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** ODESimulator.h 8 Feb 2005 04:59:06 -0000 1.47 --- ODESimulator.h 8 Feb 2005 21:54:23 -0000 1.48 *************** *** 62,73 **** virtual void OPAL_CALL internal_stepPhysics(); ! //solids virtual Solid* OPAL_CALL createSolid( const Matrix44r& transform=Matrix44r(), Space* parentSpace = NULL); ! //spaces ! virtual Space* OPAL_CALL createSpace(Space* parentSpace = NULL); - //joints virtual HingeJoint* OPAL_CALL createHingeJoint(Solid* solid1, Solid* solid2, const Point3r& anchor, const Vec3r& axis); --- 62,72 ---- virtual void OPAL_CALL internal_stepPhysics(); ! // SOLIDS ! virtual Solid* OPAL_CALL createSolid( const Matrix44r& transform=Matrix44r(), Space* parentSpace = NULL); ! // JOINTS virtual HingeJoint* OPAL_CALL createHingeJoint(Solid* solid1, Solid* solid2, const Point3r& anchor, const Vec3r& axis); *************** *** 89,95 **** virtual FixedJoint* OPAL_CALL createFixedJoint(Solid* solid1, Solid* solid2); ! // motors virtual ServoMotor* OPAL_CALL createServoMotor(); //convenience collision check function virtual void OPAL_CALL collide(const Solid* solid, --- 88,99 ---- virtual FixedJoint* OPAL_CALL createFixedJoint(Solid* solid1, Solid* solid2); ! // MOTORS ! virtual ServoMotor* OPAL_CALL createServoMotor(); + // SPACES + + virtual Space* OPAL_CALL createSpace(Space* parentSpace = NULL); + //convenience collision check function virtual void OPAL_CALL collide(const Solid* solid, |
From: tylerstreeter <tyl...@us...> - 2005-02-08 21:54:58
|
Update of /cvsroot/opal/opal/vc7 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18602/vc7 Modified Files: opal-ode.vcproj Log Message: added a Sensor class Index: opal-ode.vcproj =================================================================== RCS file: /cvsroot/opal/opal/vc7/opal-ode.vcproj,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** opal-ode.vcproj 8 Feb 2005 04:59:07 -0000 1.4 --- opal-ode.vcproj 8 Feb 2005 21:54:27 -0000 1.5 *************** *** 137,140 **** --- 137,143 ---- </File> <File + RelativePath="..\src\Sensor.cpp"> + </File> + <File RelativePath="..\src\ServoMotor.cpp"> </File> *************** *** 198,201 **** --- 201,207 ---- </File> <File + RelativePath="..\src\Sensor.h"> + </File> + <File RelativePath="..\src\ServoMotor.h"> </File> |
Update of /cvsroot/opal/opal/src/ODE In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4996/src/ODE Modified Files: ODEBallJoint.cpp ODEBallJoint.h ODEFixedJoint.cpp ODEFixedJoint.h ODEHinge2Joint.cpp ODEHinge2Joint.h ODEHingeJoint.cpp ODEHingeJoint.h ODEJoint.cpp ODEServoMotor.cpp ODEServoMotor.h ODESimulator.cpp ODESimulator.h ODESliderJoint.cpp ODESliderJoint.h ODESolid.cpp ODESolid.h ODEUniversalJoint.cpp ODEUniversalJoint.h Log Message: reworked Solid setForce functions; renamed some Motors; removed parameters from Joint and Motor constructors Index: ODEHingeJoint.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEHingeJoint.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** ODEHingeJoint.cpp 7 Feb 2005 02:08:23 -0000 1.29 --- ODEHingeJoint.cpp 8 Feb 2005 04:59:05 -0000 1.30 *************** *** 30,46 **** namespace opal { ! ODEHingeJoint::ODEHingeJoint(dWorldID worldID, Solid* solid1, ! Solid* solid2, const Point3r& anchor) ! : HingeJoint(solid1, solid2), ODEJoint() { - dBodyID body1 = ((ODESolid*)solid1)->internal_getBodyID(); - dBodyID body2 = ((ODESolid*)solid2)->internal_getBodyID(); - if(solid1->getStatic()) body1 = 0; - if(solid2->getStatic()) body2 = 0; - mJointID = dJointCreateHinge(worldID, 0); ! dJointAttach(mJointID, body1, body2); ! dJointSetHingeAnchor(mJointID, anchor[0], anchor[1], anchor[2]); ! //dJointSetHingeAxis(mJointID, axis[0], axis[1], axis[2]); dJointSetHingeParam(mJointID, dParamFudgeFactor, --- 30,42 ---- namespace opal { ! ODEHingeJoint::ODEHingeJoint(dWorldID worldID) ! : HingeJoint(), ODEJoint() { mJointID = dJointCreateHinge(worldID, 0); ! ! setSolids(mSolid0, mSolid1); ! ! setAnchor(mAnchor); ! setAxis(0, mAxis0); dJointSetHingeParam(mJointID, dParamFudgeFactor, *************** *** 62,66 **** } ! void ODEHingeJoint::setLimits(real low, real high, int axisNum) { assert(high >= low); --- 58,62 ---- } ! void ODEHingeJoint::setLimits(int axisNum, real low, real high) { assert(high >= low); *************** *** 70,80 **** real highRad = degToRad(high); ! //must be set twice because of ODE bug in setting function ! dJointSetHingeParam(mJointID, dParamLoStop, lowRad); ! dJointSetHingeParam(mJointID, dParamHiStop, highRad); ! dJointSetHingeParam(mJointID, dParamLoStop, lowRad); ! dJointSetHingeParam(mJointID, dParamHiStop, highRad); ! Joint::setLimits(low, high, axisNum); } --- 66,80 ---- real highRad = degToRad(high); ! // Only set the ODE limits if this limit is enabled. ! if (mLimit0Enabled) ! { ! //must be set twice because of ODE bug in setting function ! dJointSetHingeParam(mJointID, dParamLoStop, lowRad); ! dJointSetHingeParam(mJointID, dParamHiStop, highRad); ! dJointSetHingeParam(mJointID, dParamLoStop, lowRad); ! dJointSetHingeParam(mJointID, dParamHiStop, highRad); ! } ! Joint::setLimits(axisNum, low, high); } *************** *** 147,155 **** } - void ODEHingeJoint::setSolids(Solid* solid1, Solid* solid2) { Joint::setSolids(solid1, solid2); ! setupODEBodies((ODESolid*)mSolid1, (ODESolid*)mSolid2); } --- 147,154 ---- } void ODEHingeJoint::setSolids(Solid* solid1, Solid* solid2) { Joint::setSolids(solid1, solid2); ! setupODEBodies((ODESolid*)mSolid0, (ODESolid*)mSolid1); } *************** *** 172,178 **** } void ODEHingeJoint::setEnabled(bool e) { ! if (NULL == mSolid1 && NULL == mSolid2) { return; --- 171,209 ---- } + void ODEHingeJoint::setAnchor(const Point3r& anchor) + { + Joint::setAnchor(anchor); + dJointSetHingeAnchor(mJointID, anchor[0], anchor[1], anchor[2]); + } + + void ODEHingeJoint::setLimitEnabled(int axisNum, bool e) + { + assert(0 == axisNum); + Joint::setLimitEnabled(axisNum, e); + + if (e) + { + real lowRad = degToRad(mLowLimit0); + real highRad = degToRad(mHighLimit0); + + //must be set twice because of ODE bug in setting function + dJointSetHingeParam(mJointID, dParamLoStop, lowRad); + dJointSetHingeParam(mJointID, dParamHiStop, highRad); + dJointSetHingeParam(mJointID, dParamLoStop, lowRad); + dJointSetHingeParam(mJointID, dParamHiStop, highRad); + } + else + { + //must be set twice because of ODE bug in setting function + dJointSetHingeParam(mJointID, dParamLoStop, -dInfinity); + dJointSetHingeParam(mJointID, dParamHiStop, dInfinity); + dJointSetHingeParam(mJointID, dParamLoStop, -dInfinity); + dJointSetHingeParam(mJointID, dParamHiStop, dInfinity); + } + } + void ODEHingeJoint::setEnabled(bool e) { ! if (NULL == mSolid0 && NULL == mSolid1) { return; *************** *** 185,189 **** { // Enable the joint. ! setupODEBodies((ODESolid*)mSolid1, (ODESolid*)mSolid2); } else --- 216,220 ---- { // Enable the joint. ! setupODEBodies((ODESolid*)mSolid0, (ODESolid*)mSolid1); } else Index: ODEHinge2Joint.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEHinge2Joint.h,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** ODEHinge2Joint.h 7 Feb 2005 02:08:23 -0000 1.25 --- ODEHinge2Joint.h 8 Feb 2005 04:59:05 -0000 1.26 *************** *** 38,47 **** { public: ! ODEHinge2Joint(dWorldID worldID, Solid* solid1, Solid* solid2, ! const Point3r& anchor); virtual void OPAL_CALL internal_destroy(); ! virtual void OPAL_CALL setLimits(real low, real high, int axisNum); virtual void OPAL_CALL setDampingConstant(real kd); --- 38,46 ---- { public: ! ODEHinge2Joint(dWorldID worldID); virtual void OPAL_CALL internal_destroy(); ! virtual void OPAL_CALL setLimits(int axisNum, real low, real high); virtual void OPAL_CALL setDampingConstant(real kd); *************** *** 65,68 **** --- 64,71 ---- virtual void OPAL_CALL setAxis(int axisNum, const Vec3r& axis); + virtual void OPAL_CALL setAnchor(const Point3r& anchor); + + virtual void OPAL_CALL setLimitEnabled(int axisNum, bool e); + /// If both of the Solids are NULL, this will have no effect. virtual void OPAL_CALL setEnabled(bool e); Index: ODESliderJoint.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESliderJoint.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** ODESliderJoint.cpp 7 Feb 2005 02:08:23 -0000 1.28 --- ODESliderJoint.cpp 8 Feb 2005 04:59:06 -0000 1.29 *************** *** 30,45 **** namespace opal { ! ODESliderJoint::ODESliderJoint(dWorldID worldID, Solid* solid1, ! Solid* solid2) ! : SliderJoint(solid1, solid2), ODEJoint() { - dBodyID body1 = ((ODESolid*)solid1)->internal_getBodyID(); - dBodyID body2 = ((ODESolid*)solid2)->internal_getBodyID(); - if(solid1->getStatic()) body1 = 0; - if(solid2->getStatic()) body2 = 0; - mJointID = dJointCreateSlider(worldID, 0); ! dJointAttach(mJointID, body1, body2); ! //dJointSetSliderAxis(mJointID, axis[0], axis[1], axis[2]); dJointSetSliderParam(mJointID, dParamFudgeFactor, --- 30,41 ---- namespace opal { ! ODESliderJoint::ODESliderJoint(dWorldID worldID) ! : SliderJoint(), ODEJoint() { mJointID = dJointCreateSlider(worldID, 0); ! ! setSolids(mSolid0, mSolid1); ! ! setAxis(0, mAxis0); dJointSetSliderParam(mJointID, dParamFudgeFactor, *************** *** 61,79 **** } ! void ODESliderJoint::setLimits(real low, real high, int axisNum) { assert(high >= low); assert(0 == axisNum); ! real lowRad = degToRad(low); ! real highRad = degToRad(high); ! ! //must be set twice because of ODE bug in setting function ! dJointSetSliderParam(mJointID, dParamLoStop, lowRad); ! dJointSetSliderParam(mJointID, dParamHiStop, highRad); ! dJointSetSliderParam(mJointID, dParamLoStop, lowRad); ! dJointSetSliderParam(mJointID, dParamHiStop, highRad); ! Joint::setLimits(low, high, axisNum); } --- 57,76 ---- } ! void ODESliderJoint::setLimits(int axisNum, real low, real high) { assert(high >= low); assert(0 == axisNum); ! // Only set the ODE limits if this limit is enabled. ! if (mLimit0Enabled) ! { ! //must be set twice because of ODE bug in setting function ! dJointSetSliderParam(mJointID, dParamLoStop, low); ! dJointSetSliderParam(mJointID, dParamHiStop, high); ! dJointSetSliderParam(mJointID, dParamLoStop, low); ! dJointSetSliderParam(mJointID, dParamHiStop, high); ! } ! Joint::setLimits(axisNum, low, high); } *************** *** 145,153 **** } - void ODESliderJoint::setSolids(Solid* solid1, Solid* solid2) { Joint::setSolids(solid1, solid2); ! setupODEBodies((ODESolid*)mSolid1, (ODESolid*)mSolid2); } --- 142,149 ---- } void ODESliderJoint::setSolids(Solid* solid1, Solid* solid2) { Joint::setSolids(solid1, solid2); ! setupODEBodies((ODESolid*)mSolid0, (ODESolid*)mSolid1); } *************** *** 170,176 **** } void ODESliderJoint::setEnabled(bool e) { ! if (NULL == mSolid1 && NULL == mSolid2) { return; --- 166,195 ---- } + void ODESliderJoint::setLimitEnabled(int axisNum, bool e) + { + assert(0 == axisNum); + Joint::setLimitEnabled(axisNum, e); + + if (e) + { + //must be set twice because of ODE bug in setting function + dJointSetSliderParam(mJointID, dParamLoStop, mLowLimit0); + dJointSetSliderParam(mJointID, dParamHiStop, mHighLimit0); + dJointSetSliderParam(mJointID, dParamLoStop, mLowLimit0); + dJointSetSliderParam(mJointID, dParamHiStop, mHighLimit0); + } + else + { + //must be set twice because of ODE bug in setting function + dJointSetHingeParam(mJointID, dParamLoStop, -dInfinity); + dJointSetHingeParam(mJointID, dParamHiStop, dInfinity); + dJointSetHingeParam(mJointID, dParamLoStop, -dInfinity); + dJointSetHingeParam(mJointID, dParamHiStop, dInfinity); + } + } + void ODESliderJoint::setEnabled(bool e) { ! if (NULL == mSolid0 && NULL == mSolid1) { return; *************** *** 183,187 **** { // Enable the joint. ! setupODEBodies((ODESolid*)mSolid1, (ODESolid*)mSolid2); } else --- 202,206 ---- { // Enable the joint. ! setupODEBodies((ODESolid*)mSolid0, (ODESolid*)mSolid1); } else Index: ODEUniversalJoint.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEUniversalJoint.h,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** ODEUniversalJoint.h 7 Feb 2005 02:08:23 -0000 1.25 --- ODEUniversalJoint.h 8 Feb 2005 04:59:06 -0000 1.26 *************** *** 38,47 **** { public: ! ODEUniversalJoint(dWorldID world, Solid* solid1, Solid* solid2, ! const Point3r& anchor); virtual void OPAL_CALL internal_destroy(); ! virtual void OPAL_CALL setLimits(real low, real high, int axisNum); virtual void OPAL_CALL setDampingConstant(real kd); --- 38,46 ---- { public: ! ODEUniversalJoint(dWorldID world); virtual void OPAL_CALL internal_destroy(); ! virtual void OPAL_CALL setLimits(int axisNum, real low, real high); virtual void OPAL_CALL setDampingConstant(real kd); *************** *** 63,66 **** --- 62,69 ---- virtual void OPAL_CALL setAxis(int axisNum, const Vec3r& axis); + virtual void OPAL_CALL setAnchor(const Point3r& anchor); + + virtual void OPAL_CALL setLimitEnabled(int axisNum, bool e); + /// If both of the Solids are NULL, this will have no effect. virtual void OPAL_CALL setEnabled(bool e); Index: ODEBallJoint.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEBallJoint.h,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** ODEBallJoint.h 7 Feb 2005 02:08:23 -0000 1.25 --- ODEBallJoint.h 8 Feb 2005 04:59:05 -0000 1.26 *************** *** 38,47 **** { public: ! ODEBallJoint(dWorldID worldID, Solid* solid1, Solid* solid2, ! const Point3r& anchor); virtual void OPAL_CALL internal_destroy(); ! virtual void OPAL_CALL setLimits(real low, real high, int axisNum); virtual void OPAL_CALL setDampingConstant(real kd); --- 38,46 ---- { public: ! ODEBallJoint(dWorldID worldID); virtual void OPAL_CALL internal_destroy(); ! virtual void OPAL_CALL setLimits(int axisNum, real low, real high); virtual void OPAL_CALL setDampingConstant(real kd); *************** *** 63,66 **** --- 62,69 ---- virtual void OPAL_CALL setAxis(int axisNum, const Vec3r& axis); + virtual void OPAL_CALL setAnchor(const Point3r& anchor); + + virtual void OPAL_CALL setLimitEnabled(int axisNum, bool e); + /// If both of the Solids are NULL, this will have no effect. virtual void OPAL_CALL setEnabled(bool e); Index: ODESolid.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESolid.h,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** ODESolid.h 7 Feb 2005 02:08:23 -0000 1.52 --- ODESolid.h 8 Feb 2005 04:59:06 -0000 1.53 *************** *** 58,63 **** { public: ! ODESolid(dWorldID worldID, dSpaceID spaceID, ! const Matrix44r& transform); virtual void OPAL_CALL internal_destroy(); --- 58,62 ---- { public: ! ODESolid(dWorldID worldID, dSpaceID spaceID); virtual void OPAL_CALL internal_destroy(); Index: ODEServoMotor.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEServoMotor.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ODEServoMotor.cpp 7 Feb 2005 02:08:23 -0000 1.12 --- ODEServoMotor.cpp 8 Feb 2005 04:59:05 -0000 1.13 *************** *** 32,38 **** namespace opal { ! ODEServoMotor::ODEServoMotor(Joint* joint, int jointAxis, ServoType type, ! real velMultiplier) ! : ServoMotor(joint, jointAxis, type, velMultiplier) { } --- 32,37 ---- namespace opal { ! ODEServoMotor::ODEServoMotor() ! : ServoMotor() { } *************** *** 57,97 **** if (mEnabled) { mJoint->wakeSolids(); ! switch(mType) { ! case LINEAR_POS_SERVO: { ! real velocity = mDesiredPos - mJoint->getLinearPos( mJointAxis); ! mJoint->setDesiredVel(mJointAxis, ! mVelMultiplier*velocity); ! break; } ! case ANGULAR_POS_SERVO: { ! real velocity = mDesiredPos - mJoint->getAngle( mJointAxis); ! mJoint->setDesiredVel(mJointAxis, mVelMultiplier * velocity); - break; } ! case LINEAR_VEL_SERVO: ! //nothing to do ! break; ! case ANGULAR_VEL_SERVO: ! //nothing to do ! break; ! default: ! assert(false); ! break; } } } - //void ODEServoMotor::updateGlobal(const std::vector<Solid*>* solidList) - //{ - //} - void ODEServoMotor::setDesiredVel(real vel) { --- 56,88 ---- if (mEnabled) { + // Make sure both Solids are awake at this point. mJoint->wakeSolids(); ! if (DESIRED_POS_MODE == mMode) { ! if (true == mJoint->isAxisRotational(mJointAxis)) { ! real velocity = mDesiredPos - mJoint->getAngle( mJointAxis); ! mJoint->setDesiredVel(mJointAxis, mMultiplier * ! velocity); } ! else { ! // This axis must be a linear degree of freedom. ! real velocity = mDesiredPos - mJoint->getLinearPos( mJointAxis); ! mJoint->setDesiredVel(mJointAxis, mMultiplier * velocity); } ! } ! else ! { ! // nothing to do for desired velocity mode; ODE already ! // updates things internally } } } void ODEServoMotor::setDesiredVel(real vel) { Index: ODEFixedJoint.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEFixedJoint.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** ODEFixedJoint.h 7 Feb 2005 02:08:23 -0000 1.17 --- ODEFixedJoint.h 8 Feb 2005 04:59:05 -0000 1.18 *************** *** 38,42 **** { public: ! ODEFixedJoint(dWorldID worldID, Solid* solid1, Solid* solid2); virtual void OPAL_CALL internal_destroy(); --- 38,42 ---- { public: ! ODEFixedJoint(dWorldID worldID); virtual void OPAL_CALL internal_destroy(); Index: ODEFixedJoint.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEFixedJoint.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** ODEFixedJoint.cpp 7 Feb 2005 02:08:23 -0000 1.20 --- ODEFixedJoint.cpp 8 Feb 2005 04:59:05 -0000 1.21 *************** *** 30,44 **** namespace opal { ! ODEFixedJoint::ODEFixedJoint(dWorldID worldID, Solid* solid1, ! Solid* solid2) ! : FixedJoint(solid1, solid2), ODEJoint() { - dBodyID body1 = ((ODESolid*)solid1)->internal_getBodyID(); - dBodyID body2 = ((ODESolid*)solid2)->internal_getBodyID(); - if(solid1->getStatic()) body1 = 0; - if(solid2->getStatic()) body2 = 0; - mJointID = dJointCreateFixed(worldID, 0); ! dJointAttach(mJointID, body1, body2); dJointSetFixed(mJointID); --- 30,40 ---- namespace opal { ! ODEFixedJoint::ODEFixedJoint(dWorldID worldID) ! : FixedJoint(), ODEJoint() { mJointID = dJointCreateFixed(worldID, 0); ! ! setSolids(mSolid0, mSolid1); ! dJointSetFixed(mJointID); *************** *** 78,91 **** } - void ODEFixedJoint::setSolids(Solid* solid1, Solid* solid2) { Joint::setSolids(solid1, solid2); ! setupODEBodies((ODESolid*)mSolid1, (ODESolid*)mSolid2); } void ODEFixedJoint::setEnabled(bool e) { ! if (NULL == mSolid1 && NULL == mSolid2) { return; --- 74,86 ---- } void ODEFixedJoint::setSolids(Solid* solid1, Solid* solid2) { Joint::setSolids(solid1, solid2); ! setupODEBodies((ODESolid*)mSolid0, (ODESolid*)mSolid1); } void ODEFixedJoint::setEnabled(bool e) { ! if (NULL == mSolid0 && NULL == mSolid1) { return; *************** *** 98,102 **** { // Enable the joint. ! setupODEBodies((ODESolid*)mSolid1, (ODESolid*)mSolid2); } else --- 93,97 ---- { // Enable the joint. ! setupODEBodies((ODESolid*)mSolid0, (ODESolid*)mSolid1); } else Index: ODEServoMotor.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEServoMotor.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ODEServoMotor.h 7 Feb 2005 02:08:23 -0000 1.12 --- ODEServoMotor.h 8 Feb 2005 04:59:05 -0000 1.13 *************** *** 38,43 **** public: ! ODEServoMotor(Joint* joint, int jointAxis, ServoType type, ! real velMultiplier); virtual void OPAL_CALL internal_destroy(); --- 38,42 ---- public: ! ODEServoMotor(); virtual void OPAL_CALL internal_destroy(); *************** *** 45,50 **** virtual void OPAL_CALL internal_update(); - //virtual void updateGlobal)const std::vector<Solid*>* solidList); - virtual void OPAL_CALL setDesiredVel(real vel); --- 44,47 ---- Index: ODEHinge2Joint.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEHinge2Joint.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** ODEHinge2Joint.cpp 7 Feb 2005 02:08:23 -0000 1.31 --- ODEHinge2Joint.cpp 8 Feb 2005 04:59:05 -0000 1.32 *************** *** 30,47 **** namespace opal { ! ODEHinge2Joint::ODEHinge2Joint(dWorldID worldID, Solid* solid1, ! Solid* solid2, const Point3r& anchor) ! : Hinge2Joint(solid1, solid2), ODEJoint() { - dBodyID body1 = ((ODESolid*)solid1)->internal_getBodyID(); - dBodyID body2 = ((ODESolid*)solid2)->internal_getBodyID(); - if(solid1->getStatic()) body1 = 0; - if(solid2->getStatic()) body2 = 0; - mJointID = dJointCreateHinge2(worldID, 0); ! dJointAttach(mJointID, body1, body2); ! dJointSetHinge2Anchor(mJointID, anchor[0], anchor[1], anchor[2]); ! //dJointSetHinge2Axis1(mJointID, axis0[0], axis0[1], axis0[2]); ! //dJointSetHinge2Axis2(mJointID, axis1[0], axis1[1], axis1[2]); dJointSetHinge2Param(mJointID, dParamFudgeFactor, --- 30,43 ---- namespace opal { ! ODEHinge2Joint::ODEHinge2Joint(dWorldID worldID) ! : Hinge2Joint(), ODEJoint() { mJointID = dJointCreateHinge2(worldID, 0); ! ! setSolids(mSolid0, mSolid1); ! ! setAnchor(mAnchor); ! setAxis(0, mAxis0); ! setAxis(1, mAxis1); dJointSetHinge2Param(mJointID, dParamFudgeFactor, *************** *** 65,69 **** } ! void ODEHinge2Joint::setLimits(real low, real high, int axisNum) { assert(high >= low); --- 61,65 ---- } ! void ODEHinge2Joint::setLimits(int axisNum, real low, real high) { assert(high >= low); *************** *** 73,85 **** real highRad = degToRad(high); ! //must be set twice because of ODE bug in setting function ! dJointSetHinge2Param(mJointID, dParamLoStop, lowRad); ! dJointSetHinge2Param(mJointID, dParamHiStop, highRad); ! dJointSetHinge2Param(mJointID, dParamLoStop, lowRad); ! dJointSetHinge2Param(mJointID, dParamHiStop, highRad); //note: only axis0 can have joint limits ! Joint::setLimits(low, high, axisNum); } --- 69,85 ---- real highRad = degToRad(high); ! // Only set the ODE limits if this limit is enabled. ! if (mLimit0Enabled) ! { ! //must be set twice because of ODE bug in setting function ! dJointSetHinge2Param(mJointID, dParamLoStop, lowRad); ! dJointSetHinge2Param(mJointID, dParamHiStop, highRad); ! dJointSetHinge2Param(mJointID, dParamLoStop, lowRad); ! dJointSetHinge2Param(mJointID, dParamHiStop, highRad); ! } //note: only axis0 can have joint limits ! Joint::setLimits(axisNum, low, high); } *************** *** 123,127 **** real ODEHinge2Joint::getAngle(int axisNum)const { ! real angle = 0.0; switch(axisNum) --- 123,127 ---- real ODEHinge2Joint::getAngle(int axisNum)const { ! real angle = 0; switch(axisNum) *************** *** 145,149 **** real ODEHinge2Joint::getAngleRate(int axisNum)const { ! real rate = 0.0; switch(axisNum) --- 145,149 ---- real ODEHinge2Joint::getAngleRate(int axisNum)const { ! real rate = 0; switch(axisNum) *************** *** 204,212 **** } - void ODEHinge2Joint::setSolids(Solid* solid1, Solid* solid2) { Joint::setSolids(solid1, solid2); ! setupODEBodies((ODESolid*)mSolid1, (ODESolid*)mSolid2); } --- 204,211 ---- } void ODEHinge2Joint::setSolids(Solid* solid1, Solid* solid2) { Joint::setSolids(solid1, solid2); ! setupODEBodies((ODESolid*)mSolid0, (ODESolid*)mSolid1); } *************** *** 233,239 **** } void ODEHinge2Joint::setEnabled(bool e) { ! if (NULL == mSolid1 && NULL == mSolid2) { return; --- 232,271 ---- } + void ODEHinge2Joint::setAnchor(const Point3r& anchor) + { + Joint::setAnchor(anchor); + dJointSetHinge2Anchor(mJointID, anchor[0], anchor[1], anchor[2]); + } + + void ODEHinge2Joint::setLimitEnabled(int axisNum, bool e) + { + //note: only axis0 can have joint limits + assert(0 == axisNum); + Joint::setLimitEnabled(axisNum, e); + + if (e) + { + real lowRad = degToRad(mLowLimit0); + real highRad = degToRad(mHighLimit0); + + //must be set twice because of ODE bug in setting function + dJointSetHinge2Param(mJointID, dParamLoStop, lowRad); + dJointSetHinge2Param(mJointID, dParamHiStop, highRad); + dJointSetHinge2Param(mJointID, dParamLoStop, lowRad); + dJointSetHinge2Param(mJointID, dParamHiStop, highRad); + } + else + { + //must be set twice because of ODE bug in setting function + dJointSetHinge2Param(mJointID, dParamLoStop, -dInfinity); + dJointSetHinge2Param(mJointID, dParamHiStop, dInfinity); + dJointSetHinge2Param(mJointID, dParamLoStop, -dInfinity); + dJointSetHinge2Param(mJointID, dParamHiStop, dInfinity); + } + } + void ODEHinge2Joint::setEnabled(bool e) { ! if (NULL == mSolid0 && NULL == mSolid1) { return; *************** *** 246,250 **** { // Enable the joint. ! setupODEBodies((ODESolid*)mSolid1, (ODESolid*)mSolid2); } else --- 278,282 ---- { // Enable the joint. ! setupODEBodies((ODESolid*)mSolid0, (ODESolid*)mSolid1); } else Index: ODEHingeJoint.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEHingeJoint.h,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** ODEHingeJoint.h 7 Feb 2005 02:08:23 -0000 1.25 --- ODEHingeJoint.h 8 Feb 2005 04:59:05 -0000 1.26 *************** *** 38,47 **** { public: ! ODEHingeJoint(dWorldID worldID, Solid* solid1, Solid* solid2, ! const Point3r& anchor); virtual void OPAL_CALL internal_destroy(); ! virtual void OPAL_CALL setLimits(real low, real high, int axisNum); virtual void OPAL_CALL setDampingConstant(real kd); --- 38,46 ---- { public: ! ODEHingeJoint(dWorldID worldID); virtual void OPAL_CALL internal_destroy(); ! virtual void OPAL_CALL setLimits(int axisNum, real low, real high); virtual void OPAL_CALL setDampingConstant(real kd); *************** *** 63,66 **** --- 62,69 ---- virtual void OPAL_CALL setAxis(int axisNum, const Vec3r& axis); + virtual void OPAL_CALL setAnchor(const Point3r& anchor); + + virtual void OPAL_CALL setLimitEnabled(int axisNum, bool e); + /// If both of the Solids are NULL, this will have no effect. virtual void OPAL_CALL setEnabled(bool e); Index: ODESimulator.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESimulator.cpp,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** ODESimulator.cpp 7 Feb 2005 02:08:23 -0000 1.68 --- ODESimulator.cpp 8 Feb 2005 04:59:05 -0000 1.69 *************** *** 374,378 **** // the ratio is too high, mass1 is too large; if // the ratio is too low, mass2 is too large ! real massRatio = 0.0; dMass mass1, mass2; dBodyGetMass(o1BodyID, &mass1); --- 374,378 ---- // the ratio is too high, mass1 is too large; if // the ratio is too low, mass2 is too large ! real massRatio = 0; dMass mass1, mass2; dBodyGetMass(o1BodyID, &mass1); *************** *** 616,625 **** if (NULL == parentSpace) { ! newSolid = new ODESolid(mWorldID, mRootSpaceID, transform); } else { newSolid = new ODESolid(mWorldID, ! ((ODESpace*)parentSpace)->internal_getSpaceID(), transform); } --- 616,625 ---- if (NULL == parentSpace) { ! newSolid = new ODESolid(mWorldID, mRootSpaceID); } else { newSolid = new ODESolid(mWorldID, ! ((ODESpace*)parentSpace)->internal_getSpaceID()); } *************** *** 660,665 **** } ! HingeJoint* newJoint = new ODEHingeJoint(mWorldID, solid1, solid2, ! anchor); addJoint(newJoint); return newJoint; --- 660,664 ---- } ! HingeJoint* newJoint = new ODEHingeJoint(mWorldID); addJoint(newJoint); return newJoint; *************** *** 680,685 **** } ! UniversalJoint* newJoint = new ODEUniversalJoint(mWorldID, solid1, ! solid2, anchor); addJoint(newJoint); return newJoint; --- 679,683 ---- } ! UniversalJoint* newJoint = new ODEUniversalJoint(mWorldID); addJoint(newJoint); return newJoint; *************** *** 700,705 **** } ! BallJoint* newJoint = new ODEBallJoint(mWorldID, solid1, solid2, ! anchor); addJoint(newJoint); return newJoint; --- 698,702 ---- } ! BallJoint* newJoint = new ODEBallJoint(mWorldID); addJoint(newJoint); return newJoint; *************** *** 719,723 **** } ! SliderJoint* newJoint = new ODESliderJoint(mWorldID, solid1, solid2); addJoint(newJoint); return newJoint; --- 716,720 ---- } ! SliderJoint* newJoint = new ODESliderJoint(mWorldID); addJoint(newJoint); return newJoint; *************** *** 737,742 **** } ! Hinge2Joint* newJoint = new ODEHinge2Joint(mWorldID, solid1, solid2, ! anchor); addJoint(newJoint); return newJoint; --- 734,738 ---- } ! Hinge2Joint* newJoint = new ODEHinge2Joint(mWorldID); addJoint(newJoint); return newJoint; *************** *** 756,769 **** } ! FixedJoint* newJoint = new ODEFixedJoint(mWorldID, solid1, solid2); addJoint(newJoint); return newJoint; } ! ServoMotor* ODESimulator::createServoMotor(Joint* joint, int jointAxis, ! ServoType type, real velMultiplier) { ! ServoMotor* newMotor = new ODEServoMotor(joint, jointAxis, type, ! velMultiplier); addMotor(newMotor); return newMotor; --- 752,763 ---- } ! FixedJoint* newJoint = new ODEFixedJoint(mWorldID); addJoint(newJoint); return newJoint; } ! ServoMotor* ODESimulator::createServoMotor() { ! ServoMotor* newMotor = new ODEServoMotor(); addMotor(newMotor); return newMotor; Index: ODESolid.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESolid.cpp,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** ODESolid.cpp 7 Feb 2005 02:08:23 -0000 1.58 --- ODESolid.cpp 8 Feb 2005 04:59:06 -0000 1.59 *************** *** 31,36 **** namespace opal { ! ODESolid::ODESolid(dWorldID worldID, dSpaceID spaceID, ! const Matrix44r& transform) : Solid() { --- 31,35 ---- namespace opal { ! ODESolid::ODESolid(dWorldID worldID, dSpaceID spaceID) : Solid() { *************** *** 44,48 **** } ! setTransform(transform); internal_uploadTransformChanges(); mCollisionCount = 0; --- 43,47 ---- } ! setTransform(Matrix44r()); internal_uploadTransformChanges(); mCollisionCount = 0; *************** *** 859,867 **** void ODESolid::applyForce(const Force& f) { - //if (f.vec.length() < globals::minForceMagnitude) - //{ - // return; - //} - switch(f.type) { --- 858,861 ---- Index: ODESimulator.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESimulator.h,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** ODESimulator.h 7 Feb 2005 02:08:23 -0000 1.46 --- ODESimulator.h 8 Feb 2005 04:59:06 -0000 1.47 *************** *** 44,59 **** namespace opal { - enum SolverType - { - //time O(m^3), memory O(m^2); m = # of constraints - SOLVER_WORLDSTEP, - - //time O(m*N), memory O(m); m = # of constraints, N = # of iterations - SOLVER_QUICKSTEP - }; - class ODESimulator : public Simulator { public: ODESimulator(); --- 44,59 ---- namespace opal { class ODESimulator : public Simulator { public: + enum SolverType + { + //time O(m^3), memory O(m^2); m = # of constraints + SOLVER_WORLDSTEP, + + //time O(m*N), memory O(m); m = # of constraints, N = # of iterations + SOLVER_QUICKSTEP + }; + ODESimulator(); *************** *** 90,96 **** // motors ! virtual ServoMotor* OPAL_CALL createServoMotor(Joint* joint, ! int jointAxis, ServoType type, ! real velMultiplier=1.0); //convenience collision check function --- 90,94 ---- // motors ! virtual ServoMotor* OPAL_CALL createServoMotor(); //convenience collision check function Index: ODEBallJoint.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEBallJoint.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** ODEBallJoint.cpp 7 Feb 2005 02:08:23 -0000 1.30 --- ODEBallJoint.cpp 8 Feb 2005 04:59:05 -0000 1.31 *************** *** 30,61 **** namespace opal { ! ODEBallJoint::ODEBallJoint(dWorldID worldID, Solid* solid1, Solid* solid2, ! const Point3r& anchor) ! : BallJoint(solid1, solid2), ODEJoint() { - dBodyID body1 = ((ODESolid*)solid1)->internal_getBodyID(); - dBodyID body2 = ((ODESolid*)solid2)->internal_getBodyID(); - if(solid1->getStatic()) body1 = 0; - if(solid2->getStatic()) body2 = 0; - mJointID = dJointCreateBall(worldID, 0); - dJointAttach(mJointID, body1, body2); - dJointSetBallAnchor(mJointID, anchor[0], anchor[1], anchor[2]); ! //ball joints need this special "angular motor" to restrain movement mAMotorID = dJointCreateAMotor(worldID, 0); - dJointAttach(mAMotorID, body1, body2); dJointSetAMotorMode(mAMotorID, dAMotorEuler); ! ////From ODE docs... ! ////For dAMotorEuler mode: ! ////1. Only axes 0 and 2 need to be set. Axis 1 will be determined automatically ! //// at each time step. ! ////2. Axes 0 and 2 must be perpendicular to each other. ! ////3. Axis 0 must be anchored to the first body, axis 2 must be anchored to the ! //// second body. ! //dJointSetAMotorAxis(mAMotorID, 0, 1, axis0[0], axis0[1], axis0[2]); ! //dJointSetAMotorAxis(mAMotorID, 2, 2, axis2[0], axis2[1], axis2[2]); dJointSetAMotorParam(mAMotorID, dParamFudgeFactor, --- 30,47 ---- namespace opal { ! ODEBallJoint::ODEBallJoint(dWorldID worldID) ! : BallJoint(), ODEJoint() { mJointID = dJointCreateBall(worldID, 0); ! // ball joints need this special "angular motor" to restrain movement mAMotorID = dJointCreateAMotor(worldID, 0); dJointSetAMotorMode(mAMotorID, dAMotorEuler); ! setSolids(mSolid0, mSolid1); ! setAnchor(mAnchor); ! setAxis(0, mAxis0); ! setAxis(2, mAxis2); dJointSetAMotorParam(mAMotorID, dParamFudgeFactor, *************** *** 82,89 **** } ! void ODEBallJoint::setLimits(real low, real high, int axisNum) { assert(high >= low); real lowRad = degToRad(low); real highRad = degToRad(high); --- 68,77 ---- } ! void ODEBallJoint::setLimits(int axisNum, real low, real high) { assert(high >= low); + Joint::setLimits(axisNum, low, high); + real lowRad = degToRad(low); real highRad = degToRad(high); *************** *** 92,120 **** { case 0: ! //must be set twice because of ODE bug in setting function ! dJointSetAMotorParam(mAMotorID, dParamLoStop, lowRad); ! dJointSetAMotorParam(mAMotorID, dParamHiStop, highRad); ! dJointSetAMotorParam(mAMotorID, dParamLoStop, lowRad); ! dJointSetAMotorParam(mAMotorID, dParamHiStop, highRad); break; case 1: ! //must be set twice because of ODE bug in setting function ! dJointSetAMotorParam(mAMotorID, dParamLoStop2, lowRad); ! dJointSetAMotorParam(mAMotorID, dParamHiStop2, highRad); ! dJointSetAMotorParam(mAMotorID, dParamLoStop2, lowRad); ! dJointSetAMotorParam(mAMotorID, dParamHiStop2, highRad); break; case 2: ! //must be set twice because of ODE bug in setting function ! dJointSetAMotorParam(mAMotorID, dParamLoStop3, lowRad); ! dJointSetAMotorParam(mAMotorID, dParamHiStop3, highRad); ! dJointSetAMotorParam(mAMotorID, dParamLoStop3, lowRad); ! dJointSetAMotorParam(mAMotorID, dParamHiStop3, highRad); break; default: break; } - - Joint::setLimits(low, high, axisNum); } --- 80,118 ---- { case 0: ! // Only set the ODE limits if this limit is enabled. ! if (mLimit0Enabled) ! { ! //must be set twice because of ODE bug in setting function ! dJointSetAMotorParam(mAMotorID, dParamLoStop, lowRad); ! dJointSetAMotorParam(mAMotorID, dParamHiStop, highRad); ! dJointSetAMotorParam(mAMotorID, dParamLoStop, lowRad); ! dJointSetAMotorParam(mAMotorID, dParamHiStop, highRad); ! } break; case 1: ! // Only set the ODE limits if this limit is enabled. ! if (mLimit1Enabled) ! { ! //must be set twice because of ODE bug in setting function ! dJointSetAMotorParam(mAMotorID, dParamLoStop2, lowRad); ! dJointSetAMotorParam(mAMotorID, dParamHiStop2, highRad); ! dJointSetAMotorParam(mAMotorID, dParamLoStop2, lowRad); ! dJointSetAMotorParam(mAMotorID, dParamHiStop2, highRad); ! } break; case 2: ! // Only set the ODE limits if this limit is enabled. ! if (mLimit2Enabled) ! { ! //must be set twice because of ODE bug in setting function ! dJointSetAMotorParam(mAMotorID, dParamLoStop3, lowRad); ! dJointSetAMotorParam(mAMotorID, dParamHiStop3, highRad); ! dJointSetAMotorParam(mAMotorID, dParamLoStop3, lowRad); ! dJointSetAMotorParam(mAMotorID, dParamHiStop3, highRad); ! } break; default: break; } } *************** *** 214,221 **** } ! void ODEBallJoint::setSolids(Solid* solid1, Solid* solid2) { ! Joint::setSolids(solid1, solid2); ! setupODEBodies((ODESolid*)mSolid1, (ODESolid*)mSolid2); } --- 212,219 ---- } ! void ODEBallJoint::setSolids(Solid* solid0, Solid* solid1) { ! Joint::setSolids(solid0, solid1); ! setupODEBodies((ODESolid*)mSolid0, (ODESolid*)mSolid1); } *************** *** 253,259 **** } void ODEBallJoint::setEnabled(bool e) { ! if (NULL == mSolid1 && NULL == mSolid2) { return; --- 251,342 ---- } + void ODEBallJoint::setAnchor(const Point3r& anchor) + { + Joint::setAnchor(anchor); + dJointSetBallAnchor(mJointID, anchor[0], anchor[1], anchor[2]); + } + + void ODEBallJoint::setLimitEnabled(int axisNum, bool e) + { + Joint::setLimitEnabled(axisNum, e); + + if (e) + { + switch(axisNum) + { + case 0: + { + real lowRad = degToRad(mLowLimit0); + real highRad = degToRad(mHighLimit0); + + //must be set twice because of ODE bug in setting function + dJointSetAMotorParam(mAMotorID, dParamLoStop, lowRad); + dJointSetAMotorParam(mAMotorID, dParamHiStop, highRad); + dJointSetAMotorParam(mAMotorID, dParamLoStop, lowRad); + dJointSetAMotorParam(mAMotorID, dParamHiStop, highRad); + break; + } + case 1: + { + real lowRad = degToRad(mLowLimit1); + real highRad = degToRad(mHighLimit1); + + //must be set twice because of ODE bug in setting function + dJointSetAMotorParam(mAMotorID, dParamLoStop2, lowRad); + dJointSetAMotorParam(mAMotorID, dParamHiStop2, highRad); + dJointSetAMotorParam(mAMotorID, dParamLoStop2, lowRad); + dJointSetAMotorParam(mAMotorID, dParamHiStop2, highRad); + break; + } + case 2: + { + real lowRad = degToRad(mLowLimit2); + real highRad = degToRad(mHighLimit2); + + //must be set twice because of ODE bug in setting function + dJointSetAMotorParam(mAMotorID, dParamLoStop3, lowRad); + dJointSetAMotorParam(mAMotorID, dParamHiStop3, highRad); + dJointSetAMotorParam(mAMotorID, dParamLoStop3, lowRad); + dJointSetAMotorParam(mAMotorID, dParamHiStop3, highRad); + break; + } + default: + break; + } + } + else + { + switch(axisNum) + { + case 0: + //must be set twice because of ODE bug in setting function + dJointSetAMotorParam(mAMotorID, dParamLoStop, -dInfinity); + dJointSetAMotorParam(mAMotorID, dParamHiStop, dInfinity); + dJointSetAMotorParam(mAMotorID, dParamLoStop, -dInfinity); + dJointSetAMotorParam(mAMotorID, dParamHiStop, dInfinity); + break; + case 1: + //must be set twice because of ODE bug in setting function + dJointSetAMotorParam(mAMotorID, dParamLoStop2, -dInfinity); + dJointSetAMotorParam(mAMotorID, dParamHiStop2, dInfinity); + dJointSetAMotorParam(mAMotorID, dParamLoStop2, -dInfinity); + dJointSetAMotorParam(mAMotorID, dParamHiStop2, dInfinity); + break; + case 2: + //must be set twice because of ODE bug in setting function + dJointSetAMotorParam(mAMotorID, dParamLoStop3, -dInfinity); + dJointSetAMotorParam(mAMotorID, dParamHiStop3, dInfinity); + dJointSetAMotorParam(mAMotorID, dParamLoStop3, -dInfinity); + dJointSetAMotorParam(mAMotorID, dParamHiStop3, dInfinity); + break; + default: + break; + } + } + } + void ODEBallJoint::setEnabled(bool e) { ! if (NULL == mSolid0 && NULL == mSolid1) { return; *************** *** 266,270 **** { // Enable the joint. ! setupODEBodies((ODESolid*)mSolid1, (ODESolid*)mSolid2); } else --- 349,353 ---- { // Enable the joint. ! setupODEBodies((ODESolid*)mSolid0, (ODESolid*)mSolid1); } else *************** *** 280,283 **** --- 363,367 ---- if (NULL == solid1 && NULL == solid1) { + dJointAttach(mJointID, 0, 0); dJointAttach(mAMotorID, 0, 0); } *************** *** 286,297 **** --- 370,385 ---- if (NULL == solid1) { + dJointAttach(mJointID, 0, solid2->internal_getBodyID()); dJointAttach(mAMotorID, 0, solid2->internal_getBodyID()); } else if (NULL == solid2) { + dJointAttach(mJointID, solid1->internal_getBodyID(), 0); dJointAttach(mAMotorID, solid1->internal_getBodyID(), 0); } else { + dJointAttach(mJointID, solid1->internal_getBodyID(), + solid2->internal_getBodyID()); dJointAttach(mAMotorID, solid1->internal_getBodyID(), solid2->internal_getBodyID()); Index: ODEUniversalJoint.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEUniversalJoint.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** ODEUniversalJoint.cpp 7 Feb 2005 02:08:23 -0000 1.29 --- ODEUniversalJoint.cpp 8 Feb 2005 04:59:06 -0000 1.30 *************** *** 30,47 **** namespace opal { ! ODEUniversalJoint::ODEUniversalJoint(dWorldID worldID, Solid* solid1, ! Solid* solid2, const Point3r& anchor) ! : UniversalJoint(solid1, solid2), ODEJoint() { - dBodyID body1 = ((ODESolid*)solid1)->internal_getBodyID(); - dBodyID body2 = ((ODESolid*)solid2)->internal_getBodyID(); - if(solid1->getStatic()) body1 = 0; - if(solid2->getStatic()) body2 = 0; - mJointID = dJointCreateUniversal(worldID, 0); ! dJointAttach(mJointID, body1, body2); ! dJointSetUniversalAnchor(mJointID, anchor[0], anchor[1], anchor[2]); ! //dJointSetUniversalAxis1(mJointID, axis0[0], axis0[1], axis0[2]); ! //dJointSetUniversalAxis2(mJointID, axis1[0], axis1[1], axis1[2]); dJointSetUniversalParam(mJointID, dParamFudgeFactor, --- 30,43 ---- namespace opal { ! ODEUniversalJoint::ODEUniversalJoint(dWorldID worldID) ! : UniversalJoint(), ODEJoint() { mJointID = dJointCreateUniversal(worldID, 0); ! ! setSolids(mSolid0, mSolid1); ! ! setAnchor(mAnchor); ! setAxis(0, mAxis0); ! setAxis(1, mAxis1); dJointSetUniversalParam(mJointID, dParamFudgeFactor, *************** *** 65,69 **** } ! void ODEUniversalJoint::setLimits(real low, real high, int axisNum) { assert(high >= low); --- 61,65 ---- } ! void ODEUniversalJoint::setLimits(int axisNum, real low, real high) { assert(high >= low); *************** *** 75,91 **** { case 0: ! //must be set twice because of ODE bug in setting function ! dJointSetUniversalParam(mJointID, dParamLoStop, lowRad); ! dJointSetUniversalParam(mJointID, dParamHiStop, highRad); ! dJointSetUniversalParam(mJointID, dParamLoStop, lowRad); ! dJointSetUniversalParam(mJointID, dParamHiStop, highRad); ! break; case 1: ! //must be set twice because of ODE bug in setting function ! dJointSetUniversalParam(mJointID, dParamLoStop2, lowRad); ! dJointSetUniversalParam(mJointID, dParamHiStop2, highRad); ! dJointSetUniversalParam(mJointID, dParamLoStop2, lowRad); ! dJointSetUniversalParam(mJointID, dParamHiStop2, highRad); ! break; case 2: //fall through default: --- 71,95 ---- { case 0: ! // Only set the ODE limits if this limit is enabled. ! if (mLimit0Enabled) ! { ! //must be set twice because of ODE bug in setting function ! dJointSetUniversalParam(mJointID, dParamLoStop, lowRad); ! dJointSetUniversalParam(mJointID, dParamHiStop, highRad); ! dJointSetUniversalParam(mJointID, dParamLoStop, lowRad); ! dJointSetUniversalParam(mJointID, dParamHiStop, highRad); ! break; ! } case 1: ! // Only set the ODE limits if this limit is enabled. ! if (mLimit1Enabled) ! { ! //must be set twice because of ODE bug in setting function ! dJointSetUniversalParam(mJointID, dParamLoStop2, lowRad); ! dJointSetUniversalParam(mJointID, dParamHiStop2, highRad); ! dJointSetUniversalParam(mJointID, dParamLoStop2, lowRad); ! dJointSetUniversalParam(mJointID, dParamHiStop2, highRad); ! break; ! } case 2: //fall through default: *************** *** 93,97 **** } ! Joint::setLimits(low, high, axisNum); } --- 97,101 ---- } ! Joint::setLimits(axisNum, low, high); } *************** *** 135,139 **** real ODEUniversalJoint::getAngle(int axisNum)const { ! real angle = 0.0; switch(axisNum) --- 139,143 ---- real ODEUniversalJoint::getAngle(int axisNum)const { ! real angle = 0; switch(axisNum) *************** *** 155,159 **** real ODEUniversalJoint::getAngleRate(int axisNum)const { ! real rate = 0.0; switch(axisNum) --- 159,163 ---- real ODEUniversalJoint::getAngleRate(int axisNum)const { ! real rate = 0; switch(axisNum) *************** *** 214,222 **** } - void ODEUniversalJoint::setSolids(Solid* solid1, Solid* solid2) { Joint::setSolids(solid1, solid2); ! setupODEBodies((ODESolid*)mSolid1, (ODESolid*)mSolid2); } --- 218,225 ---- } void ODEUniversalJoint::setSolids(Solid* solid1, Solid* solid2) { Joint::setSolids(solid1, solid2); ! setupODEBodies((ODESolid*)mSolid0, (ODESolid*)mSolid1); } *************** *** 243,249 **** } void ODEUniversalJoint::setEnabled(bool e) { ! if (NULL == mSolid1 && NULL == mSolid2) { return; --- 246,320 ---- } + void ODEUniversalJoint::setAnchor(const Point3r& anchor) + { + Joint::setAnchor(anchor); + dJointSetUniversalAnchor(mJointID, anchor[0], anchor[1], anchor[2]); + } + + void ODEUniversalJoint::setLimitEnabled(int axisNum, bool e) + { + Joint::setLimitEnabled(axisNum, e); + + if (e) + { + switch(axisNum) + { + case 0: + { + real lowRad = degToRad(mLowLimit0); + real highRad = degToRad(mHighLimit0); + + //must be set twice because of ODE bug in setting function + dJointSetUniversalParam(mJointID, dParamLoStop, lowRad); + dJointSetUniversalParam(mJointID, dParamHiStop, highRad); + dJointSetUniversalParam(mJointID, dParamLoStop, lowRad); + dJointSetUniversalParam(mJointID, dParamHiStop, highRad); + break; + } + case 1: + { + real lowRad = degToRad(mLowLimit1); + real highRad = degToRad(mHighLimit1); + + //must be set twice because of ODE bug in setting function + dJointSetUniversalParam(mJointID, dParamLoStop2, lowRad); + dJointSetUniversalParam(mJointID, dParamHiStop2, highRad); + dJointSetUniversalParam(mJointID, dParamLoStop2, lowRad); + dJointSetUniversalParam(mJointID, dParamHiStop2, highRad); + break; + } + case 2: // fall-through... + default: + break; + } + } + else + { + switch(axisNum) + { + case 0: + //must be set twice because of ODE bug in setting function + dJointSetUniversalParam(mJointID, dParamLoStop, -dInfinity); + dJointSetUniversalParam(mJointID, dParamHiStop, dInfinity); + dJointSetUniversalParam(mJointID, dParamLoStop, -dInfinity); + dJointSetUniversalParam(mJointID, dParamHiStop, dInfinity); + break; + case 1: + //must be set twice because of ODE bug in setting function + dJointSetUniversalParam(mJointID, dParamLoStop2, -dInfinity); + dJointSetUniversalParam(mJointID, dParamHiStop2, dInfinity); + dJointSetUniversalParam(mJointID, dParamLoStop2, -dInfinity); + dJointSetUniversalParam(mJointID, dParamHiStop2, dInfinity); + break; + case 2: // fall-through... + default: + break; + } + } + } + void ODEUniversalJoint::setEnabled(bool e) { ! if (NULL == mSolid0 && NULL == mSolid1) { return; *************** *** 256,260 **** { // Enable the joint. ! setupODEBodies((ODESolid*)mSolid1, (ODESolid*)mSolid2); } else --- 327,331 ---- { // Enable the joint. ! setupODEBodies((ODESolid*)mSolid0, (ODESolid*)mSolid1); } else Index: ODESliderJoint.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESliderJoint.h,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** ODESliderJoint.h 7 Feb 2005 02:08:23 -0000 1.24 --- ODESliderJoint.h 8 Feb 2005 04:59:06 -0000 1.25 *************** *** 38,46 **** { public: ! ODESliderJoint(dWorldID worldID, Solid* solid1, Solid* solid2); virtual void OPAL_CALL internal_destroy(); ! virtual void OPAL_CALL setLimits(real low, real high, int axisNum); virtual void OPAL_CALL setDampingConstant(real kd); --- 38,46 ---- { public: ! ODESliderJoint(dWorldID worldID); virtual void OPAL_CALL internal_destroy(); ! virtual void OPAL_CALL setLimits(int axisNum, real low, real high); virtual void OPAL_CALL setDampingConstant(real kd); *************** *** 62,65 **** --- 62,67 ---- virtual void OPAL_CALL setAxis(int axisNum, const Vec3r& axis); + virtual void OPAL_CALL setLimitEnabled(int axisNum, bool e); + /// If both of the Solids are NULL, this will have no effect. virtual void OPAL_CALL setEnabled(bool e); Index: ODEJoint.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEJoint.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** ODEJoint.cpp 7 Feb 2005 02:08:23 -0000 1.16 --- ODEJoint.cpp 8 Feb 2005 04:59:05 -0000 1.17 *************** *** 72,76 **** //TODO: the damage calculations here should probably be sped up somehow ! real currentStress = 0.0; switch(mode) --- 72,76 ---- //TODO: the damage calculations here should probably be sped up somehow ! real currentStress = 0; switch(mode) |
Update of /cvsroot/opal/opal/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4996/src Modified Files: AttractorMotor.cpp AttractorMotor.h BallJoint.h BlueprintManager.cpp Defines.h DesiredPosMotor.cpp DesiredPosMotor.h FixedJoint.h Hinge2Joint.h HingeJoint.h Joint.cpp Joint.h Motor.cpp Motor.h ServoMotor.cpp ServoMotor.h Simulator.cpp Simulator.h SliderJoint.h Solid.cpp Solid.h UniversalJoint.h opal.h Added Files: GearedMotor.cpp GearedMotor.h ThrusterMotor.cpp ThrusterMotor.h Removed Files: ConstForceMotor.cpp ConstForceMotor.h LimitedForceMotor.cpp LimitedForceMotor.h Log Message: reworked Solid setForce functions; renamed some Motors; removed parameters from Joint and Motor constructors Index: opal.h =================================================================== RCS file: /cvsroot/opal/opal/src/opal.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** opal.h 6 Feb 2005 05:59:26 -0000 1.9 --- opal.h 8 Feb 2005 04:59:05 -0000 1.10 *************** *** 34,39 **** #include "AttractorMotor.h" #include "ServoMotor.h" ! #include "ConstForceMotor.h" ! #include "LimitedForceMotor.h" #include "Joint.h" #include "BallJoint.h" --- 34,39 ---- #include "AttractorMotor.h" #include "ServoMotor.h" ! #include "ThrusterMotor.h" ! #include "GearedMotor.h" #include "Joint.h" #include "BallJoint.h" Index: Joint.h =================================================================== RCS file: /cvsroot/opal/opal/src/Joint.h,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** Joint.h 7 Feb 2005 02:08:22 -0000 1.37 --- Joint.h 8 Feb 2005 04:59:05 -0000 1.38 *************** *** 31,35 **** #include "Defines.h" #include "EventHandler.h" - #include "Solid.h" namespace opal --- 31,34 ---- *************** *** 38,42 **** { public: ! Joint(Solid* solid1, Solid* solid2); virtual void OPAL_CALL internal_destroy() = 0; --- 37,42 ---- { public: ! /// All Joints start out disabled. ! Joint(); virtual void OPAL_CALL internal_destroy() = 0; *************** *** 67,78 **** virtual void OPAL_CALL internal_handleJointBreakEvent(); /// Sets the Joint's limit angles in degrees. No limits are applied /// if this is not called. ! virtual void OPAL_CALL setLimits(real low, real high, int axisNum); ! /// Returns the low limit angle in degrees for a given axis. virtual real OPAL_CALL getLowLimit(int axisNum); ! /// Returns the high limit angle in degrees for a given axis. virtual real OPAL_CALL getHighLimit(int axisNum); --- 67,86 ---- virtual void OPAL_CALL internal_handleJointBreakEvent(); + /// Enables or disables the given Joint axis' limits. + virtual void OPAL_CALL setLimitEnabled(int axisNum, bool e); + + /// Returns true if the given Joint axis' limits are enabled. + virtual bool OPAL_CALL getLimitEnabled(int axisNum); + /// Sets the Joint's limit angles in degrees. No limits are applied /// if this is not called. ! virtual void OPAL_CALL setLimits(int axisNum, real low, real high); ! /// Returns the low limit for a given axis (angle in degrees for ! /// rotational Joints, distance for linear Joints). virtual real OPAL_CALL getLowLimit(int axisNum); ! /// Returns the high limit for a given axis (angle in degrees for ! /// rotational Joints, distance for linear Joints). virtual real OPAL_CALL getHighLimit(int axisNum); *************** *** 80,96 **** virtual real OPAL_CALL getAngle(int axisNum)const; /// Returns the current angular rate in degrees per second for a /// given axis. virtual real OPAL_CALL getAngleRate(int axisNum)const; - virtual real OPAL_CALL getLinearPos(int axisNum)const; - virtual real OPAL_CALL getLinearPosRate(int axisNum)const; ! virtual void OPAL_CALL addForce(real force, int jointAxisNum, ! real duration=-1.0); ! virtual void OPAL_CALL addTorque(real torque, int jointAxisNum, ! real duration=-1.0); // Set the desired linear or angular velocity for this joint. --- 88,104 ---- virtual real OPAL_CALL getAngle(int axisNum)const; + virtual real OPAL_CALL getLinearPos(int axisNum)const; + /// Returns the current angular rate in degrees per second for a /// given axis. virtual real OPAL_CALL getAngleRate(int axisNum)const; virtual real OPAL_CALL getLinearPosRate(int axisNum)const; ! virtual void OPAL_CALL addForce(int jointAxisNum, real magnitude, ! real duration, bool singleStep=false); ! virtual void OPAL_CALL addTorque(int jointAxisNum, real magnitude, ! real duration, bool singleStep=false); // Set the desired linear or angular velocity for this joint. *************** *** 109,117 **** /// to the same Solid, the Joint's Solids will be set to NULL and the /// Joint will be automatically disabled. ! virtual void OPAL_CALL setSolids(Solid* solid1, Solid* solid2); ! virtual Solid* OPAL_CALL getSolid1()const; ! virtual Solid* OPAL_CALL getSolid2()const; /// Sets the given axis (i.e. axis 0, 1, or 2) for this Joint. --- 117,125 ---- /// to the same Solid, the Joint's Solids will be set to NULL and the /// Joint will be automatically disabled. ! virtual void OPAL_CALL setSolids(Solid* solid0, Solid* solid1); ! virtual Solid* OPAL_CALL getSolid0()const; ! virtual Solid* OPAL_CALL getSolid1()const; /// Sets the given axis (i.e. axis 0, 1, or 2) for this Joint. *************** *** 125,128 **** --- 133,143 ---- virtual const Vec3r& OPAL_CALL getAxis(int axisNum)const; + /// Sets the anchor point for this Joint. Both Solids must be + /// valid (non-NULL) before this is called for it to affect anything. + virtual void OPAL_CALL setAnchor(const Point3r& anchor); + + /// Returns the anchor point. + virtual const Point3r& OPAL_CALL getAnchor(); + /// Returns true if the Joint is enabled. virtual bool OPAL_CALL isEnabled()const; *************** *** 131,134 **** --- 146,152 ---- virtual void OPAL_CALL setEnabled(bool e); + /// Returns true if the given Joint axis is rotational. + virtual bool OPAL_CALL isAxisRotational(int axisNum); + /// Returns true if this Joint depends on the given Solid. virtual bool OPAL_CALL internal_dependsOn(Solid* solid); *************** *** 151,164 **** real mAccumDamage; //the amount of accumulated damage bool mIsBroken; //set to true when broken EventHandler* mEventHandler; Solid* mSolid1; - Solid* mSolid2; Vec3r mAxis0; Vec3r mAxis1; Vec3r mAxis2; ! //joint limits real mLowLimit0; real mHighLimit0; --- 169,191 ---- real mAccumDamage; //the amount of accumulated damage bool mIsBroken; //set to true when broken + + bool mAxis0Rotational; + bool mAxis1Rotational; + bool mAxis2Rotational; EventHandler* mEventHandler; + Solid* mSolid0; Solid* mSolid1; Vec3r mAxis0; Vec3r mAxis1; Vec3r mAxis2; ! Point3r mAnchor; ! ! // Joint limits. ! bool mLimit0Enabled; ! bool mLimit1Enabled; ! bool mLimit2Enabled; real mLowLimit0; real mHighLimit0; Index: UniversalJoint.h =================================================================== RCS file: /cvsroot/opal/opal/src/UniversalJoint.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** UniversalJoint.h 7 Feb 2005 02:08:22 -0000 1.16 --- UniversalJoint.h 8 Feb 2005 04:59:05 -0000 1.17 *************** *** 37,43 **** { public: ! UniversalJoint(Solid* solid1, Solid* solid2) ! : Joint(solid1, solid2) ! {} virtual void OPAL_CALL internal_destroy() = 0; --- 37,47 ---- { public: ! UniversalJoint() ! : Joint() ! { ! mAxis0Rotational = true; ! mAxis1Rotational = true; ! mAxis2Rotational = false; ! } virtual void OPAL_CALL internal_destroy() = 0; Index: Motor.h =================================================================== RCS file: /cvsroot/opal/opal/src/Motor.h,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** Motor.h 7 Feb 2005 02:08:22 -0000 1.25 --- Motor.h 8 Feb 2005 04:59:05 -0000 1.26 *************** *** 40,43 **** --- 40,44 ---- public: + /// All Motors start out disabled. Motor(); *************** *** 54,71 **** virtual void OPAL_CALL setEnabled(bool e); - //some motors have the capability to apply to all solids - //virtual void updateGlobal)const std::vector<Solid*>* solidList); - /// Returns true if this Motor depends on the given Solid. ! virtual bool OPAL_CALL internal_dependsOn(Solid* solid) = 0; /// Returns true if this Motor depends on the given Joint. ! virtual bool OPAL_CALL internal_dependsOn(Joint* joint) = 0; protected: virtual ~Motor(); - //TODO: decide if the global option is actually useful - //bool mGlobal; bool mEnabled; --- 55,67 ---- virtual void OPAL_CALL setEnabled(bool e); /// Returns true if this Motor depends on the given Solid. ! virtual bool OPAL_CALL internal_dependsOn(Solid* solid); /// Returns true if this Motor depends on the given Joint. ! virtual bool OPAL_CALL internal_dependsOn(Joint* joint); protected: virtual ~Motor(); bool mEnabled; --- LimitedForceMotor.cpp DELETED --- Index: Simulator.h =================================================================== RCS file: /cvsroot/opal/opal/src/Simulator.h,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** Simulator.h 7 Feb 2005 02:08:22 -0000 1.63 --- Simulator.h 8 Feb 2005 04:59:05 -0000 1.64 *************** *** 39,44 **** #include "Solid.h" #include "Space.h" ! #include "ConstForceMotor.h" ! #include "LimitedForceMotor.h" #include "ServoMotor.h" #include "AttractorMotor.h" --- 39,44 ---- #include "Solid.h" #include "Space.h" ! #include "ThrusterMotor.h" ! #include "GearedMotor.h" #include "ServoMotor.h" #include "AttractorMotor.h" *************** *** 160,187 **** //motors ! virtual ConstForceMotor* OPAL_CALL createConstForceMotor(Solid* solid, ! const Vec3r& vec, bool globalDir, bool isLinear); ! ! virtual ConstForceMotor* OPAL_CALL createConstForceMotor(Joint* joint, ! int jointAxis, bool isLinear); ! ! virtual LimitedForceMotor* OPAL_CALL createLimitedForceMotor( ! Solid* solid, const Vec3r& vec, bool globalCoords, real maxForce, ! real maxVelocity, bool isLinear); ! ! virtual LimitedForceMotor* OPAL_CALL createLimitedForceMotor( ! Joint* joint, int jointAxis, real maxForce, real maxVelocity, ! bool isLinear); ! virtual ServoMotor* OPAL_CALL createServoMotor(Joint* joint, ! int jointAxis, ServoType type, real velMultiplier=1.0) = 0; ! virtual AttractorMotor* OPAL_CALL createAttractorMotor(Solid* solid1, ! Solid* solid2, real strength, real exponent); ! virtual AttractorMotor* OPAL_CALL createAttractorMotor(Solid* solid, ! const Point3r& point, real strength, real exponent); ! virtual DesiredPosMotor* OPAL_CALL createDesiredPosMotor(Solid* solid); // custom motors must be created in a special way that uses this --- 160,172 ---- //motors ! virtual ThrusterMotor* OPAL_CALL createThrusterMotor(); ! virtual GearedMotor* OPAL_CALL createGearedMotor(); ! virtual ServoMotor* OPAL_CALL createServoMotor() = 0; ! virtual AttractorMotor* OPAL_CALL createAttractorMotor(); ! virtual DesiredPosMotor* OPAL_CALL createDesiredPosMotor(); // custom motors must be created in a special way that uses this Index: DesiredPosMotor.h =================================================================== RCS file: /cvsroot/opal/opal/src/DesiredPosMotor.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** DesiredPosMotor.h 7 Feb 2005 02:08:22 -0000 1.10 --- DesiredPosMotor.h 8 Feb 2005 04:59:05 -0000 1.11 *************** *** 34,63 **** namespace opal { class DesiredPosMotor : public Motor { - // This is a spring that either 1) operates in 3 dimensions to keep - // a solid in a desired position, or 2) operates in 3 degrees of - // rotational motion to maintain a desired orientation. It can also - // do both modes at once. - public: enum Mode { LINEAR_MODE, ! ANGULAR_MODE }; ! DesiredPosMotor(Solid* solid); ! virtual void OPAL_CALL internal_destroy(); ! virtual void OPAL_CALL init(Mode m); virtual void OPAL_CALL internal_update(); virtual void OPAL_CALL setDesiredTransform(const Matrix44r& transform); virtual void OPAL_CALL setDesiredPos(const Point3r& pos); virtual void OPAL_CALL setDesiredOrientation(const Vec3r& forward, const Vec3r& up, const Vec3r& right); --- 34,69 ---- namespace opal { + /// This is a spring that either 1) operates in 3 dimensions to keep + /// a solid in a desired position, or 2) operates in 3 degrees of + /// rotational motion to maintain a desired orientation. It can also + /// do both modes at once. class DesiredPosMotor : public Motor { public: enum Mode { LINEAR_MODE, ! ANGULAR_MODE, ! LINEAR_AND_ANGULAR_MODE }; ! DesiredPosMotor(); ! /// Sets up the Motor to affect a Solid. Also specifies which ! /// degrees of freedom are affected by the Motor. This will ! /// enable the Motor. ! virtual void OPAL_CALL init(Solid* solid, Mode m); ! virtual void OPAL_CALL internal_destroy(); virtual void OPAL_CALL internal_update(); + /// Sets the desired position and orientation. virtual void OPAL_CALL setDesiredTransform(const Matrix44r& transform); + /// Sets the desired position. virtual void OPAL_CALL setDesiredPos(const Point3r& pos); + /// Sets the desired orientation. virtual void OPAL_CALL setDesiredOrientation(const Vec3r& forward, const Vec3r& up, const Vec3r& right); *************** *** 65,70 **** virtual bool OPAL_CALL internal_dependsOn(Solid* solid); - virtual bool OPAL_CALL internal_dependsOn(Joint* joint); - virtual void OPAL_CALL setLinearKd(real kd); --- 71,74 ---- *************** *** 87,90 **** --- 91,95 ---- Solid* mSolid; + Mode mMode; Point3r mDesiredPos; Vec3r mDesiredForward; *************** *** 95,100 **** real mAngularKd; real mAngularKs; - bool mLinearEnabled; - bool mAngularEnabled; private: --- 100,103 ---- Index: HingeJoint.h =================================================================== RCS file: /cvsroot/opal/opal/src/HingeJoint.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** HingeJoint.h 7 Feb 2005 02:08:22 -0000 1.16 --- HingeJoint.h 8 Feb 2005 04:59:05 -0000 1.17 *************** *** 37,43 **** { public: ! HingeJoint(Solid* solid1, Solid* solid2) ! : Joint(solid1, solid2) ! {} virtual void OPAL_CALL internal_destroy() = 0; --- 37,47 ---- { public: ! HingeJoint() ! : Joint() ! { ! mAxis0Rotational = true; ! mAxis1Rotational = false; ! mAxis2Rotational = false; ! } virtual void OPAL_CALL internal_destroy() = 0; Index: BallJoint.h =================================================================== RCS file: /cvsroot/opal/opal/src/BallJoint.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** BallJoint.h 7 Feb 2005 02:08:22 -0000 1.15 --- BallJoint.h 8 Feb 2005 04:59:05 -0000 1.16 *************** *** 37,43 **** { public: ! BallJoint(Solid* solid1, Solid* solid2) ! : Joint(solid1, solid2) ! {} virtual void OPAL_CALL internal_destroy() = 0; --- 37,47 ---- { public: ! BallJoint() ! : Joint() ! { ! mAxis0Rotational = true; ! mAxis1Rotational = true; ! mAxis2Rotational = true; ! } virtual void OPAL_CALL internal_destroy() = 0; --- ConstForceMotor.h DELETED --- --- NEW FILE: ThrusterMotor.h --- /************************************************************************* * * * Open Physics Abstraction Layer * * Copyright (C) 2004-2005 * * Alan Fischer ala...@gm... * * Andres Reinot an...@re... * * Tyler Streeter tyl...@gm... * * All rights reserved. * * Web: opal.sourceforge.net * * * * 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-LGPL.txt. * * (2) The BSD-style license that is included with this library in * * the file license-BSD.txt. * * * * 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-LGPL.txt and license-BSD.txt for more details. * * * *************************************************************************/ #ifndef OPAL_THRUSTER_MOTOR_H #define OPAL_THRUSTER_MOTOR_H #include "Defines.h" #include "Motor.h" namespace opal { class ThrusterMotor : public Motor { public: ThrusterMotor(); /// Sets up the Motor to affect a Solid. This will enable the Motor. virtual void OPAL_CALL init(Solid* solid); virtual void OPAL_CALL internal_destroy(); virtual void OPAL_CALL internal_update(); /// Sets the Force applied by this Motor every time step. virtual void OPAL_CALL setForce(const Force& f); /// Gets the Force applied by this Motor every time step. virtual const Force& OPAL_CALL getForce()const; virtual bool OPAL_CALL internal_dependsOn(Solid* solid); protected: virtual ~ThrusterMotor(); Solid* mSolid; Force mForce; private: }; } #endif Index: Motor.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/Motor.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Motor.cpp 7 Feb 2005 02:08:22 -0000 1.7 --- Motor.cpp 8 Feb 2005 04:59:05 -0000 1.8 *************** *** 33,37 **** { //mGlobal = isGlobal; ! mEnabled = true; } --- 33,37 ---- { //mGlobal = isGlobal; ! mEnabled = false; } *************** *** 50,61 **** } ! //bool Motor::getGlobal() ! //{ ! // return mGlobal; ! //} ! //some motors have the capability to apply to all solids ! //void Motor::updateGlobal)const std::vector<Solid*>* solidList) ! //{ ! //} } --- 50,61 ---- } ! bool Motor::internal_dependsOn(Solid* solid) ! { ! return false; ! } ! bool Motor::internal_dependsOn(Joint* joint) ! { ! return false; ! } } --- NEW FILE: GearedMotor.cpp --- /************************************************************************* * * * Open Physics Abstraction Layer * * Copyright (C) 2004-2005 * * Alan Fischer ala...@gm... * * Andres Reinot an...@re... * * Tyler Streeter tyl...@gm... * * All rights reserved. * * Web: opal.sourceforge.net * * * * 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-LGPL.txt. * * (2) The BSD-style license that is included with this library in * * the file license-BSD.txt. * * * * 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-LGPL.txt and license-BSD.txt for more details. * * * *************************************************************************/ #include "GearedMotor.h" #include "Joint.h" namespace opal { //solid motor constructor GearedMotor::GearedMotor() : Motor() { mJoint = NULL; mJointAxis = 0; mMaxTorque = 0; mMaxVelInverse = 0; mThrottle = 0; } GearedMotor::~GearedMotor() { } void GearedMotor::init(Joint* joint, int jointAxis, real maxTorque, real maxVelocity) { assert(joint->isAxisRotational(jointAxis)); assert(maxVelocity != 0); mJoint = joint; mJointAxis = jointAxis; mMaxTorque = maxTorque; mMaxVelInverse = (real)1.0 / maxVelocity; mEnabled = true; } void GearedMotor::internal_destroy() { delete this; } void GearedMotor::internal_update() { if (mEnabled) { // Global/local direction makes no difference here since // we simply use the joint axis. real normalizedVel = mJoint->getAngleRate(mJointAxis) * mMaxVelInverse; real magnitude = mMaxTorque * (mThrottle - normalizedVel); mJoint->addTorque(mJointAxis, magnitude, 0, true); } } void GearedMotor::setThrottle(real throttle) { assert(throttle >= -1.0 && throttle <= 1.0); mThrottle = throttle; } real GearedMotor::getThrottle()const { return mThrottle; } //bool GearedMotor::internal_dependsOn(Solid* solid) //{ // if (solid == mSolid) // { // return true; // } // else // { // return false; // } //} bool GearedMotor::internal_dependsOn(Joint* joint) { if (joint == mJoint) { return true; } else { return false; } } } Index: ServoMotor.h =================================================================== RCS file: /cvsroot/opal/opal/src/ServoMotor.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ServoMotor.h 7 Feb 2005 02:08:22 -0000 1.13 --- ServoMotor.h 8 Feb 2005 04:59:05 -0000 1.14 *************** *** 35,52 **** namespace opal { ! enum ServoType ! { ! LINEAR_POS_SERVO, ! ANGULAR_POS_SERVO, ! LINEAR_VEL_SERVO, ! ANGULAR_VEL_SERVO ! }; ! class ServoMotor : public Motor { - public: ! ServoMotor(Joint* joint, int jointAxis, ServoType type, ! real velMultiplier); virtual void OPAL_CALL internal_destroy() = 0; --- 35,57 ---- namespace opal { ! /// This is a Motor with an internal feedback loop, allowing more ! /// precise positioning control. It controls a single Joint axis. ! /// Depending on the desired mode of operation, it tries to achieve ! /// a desired position or velocity using up to a set maximum force. ! /// The Joint axis can be either linear or rotational. class ServoMotor : public Motor { public: ! enum Mode ! { ! DESIRED_POS_MODE, ! DESIRED_VEL_MODE ! }; ! ! ServoMotor(); ! ! /// Sets up the Motor to affect one a Joint's axes. This will ! /// enable the Motor. ! virtual void OPAL_CALL init(Joint* joint, int jointAxis, Mode m); virtual void OPAL_CALL internal_destroy() = 0; *************** *** 54,84 **** virtual void OPAL_CALL internal_update() = 0; ! //virtual void updateGlobal)const std::vector<Solid*>* solidList) ! //{} ! ! //pos should be a value between the joint's limits virtual void OPAL_CALL setDesiredPos(real pos); ! // pos should be a value between 0.0 and 1.0 that will be mapped to ! // the joint's limits virtual void OPAL_CALL setDesiredPosNorm(real pos); virtual void OPAL_CALL setDesiredVel(real vel); virtual void OPAL_CALL setMaxForce(real max); ! virtual bool OPAL_CALL internal_dependsOn(Solid* solid); virtual bool OPAL_CALL internal_dependsOn(Joint* joint); protected: - Solid* mSolid; Joint* mJoint; ! ServoType mType; int mJointAxis; real mDesiredPos; real mDesiredVel; real mMaxForce; ! real mVelMultiplier; private: --- 59,105 ---- virtual void OPAL_CALL internal_update() = 0; ! /// Sets the desired position to a value between the Joint axis' ! /// limits. virtual void OPAL_CALL setDesiredPos(real pos); ! /// Sets the desired position to a value between 0.0 and 1.0 which ! /// will be mapped to the Joint axis' limits. virtual void OPAL_CALL setDesiredPosNorm(real pos); + /// Gets the desired position, a value between the Joint axis' + /// limits. + virtual real OPAL_CALL getDesiredPos(); + + /// Sets the desired velocity. virtual void OPAL_CALL setDesiredVel(real vel); + /// Returns the desired velocity. + virtual real OPAL_CALL getDesiredVel(); + + /// Sets the maximum amount of force/torque this Motor can use. virtual void OPAL_CALL setMaxForce(real max); ! /// Returns the maximum amount of force/torque this Motor can use. ! virtual real OPAL_CALL getMaxForce(); ! ! /// Sets the multiplier used to scale how fast the Motor will ! /// achieve its desired position. Only used in the desired ! /// position mode. ! virtual void OPAL_CALL setMultiplier(real mult); ! ! virtual real OPAL_CALL getMultiplier(); ! ! //virtual bool OPAL_CALL internal_dependsOn(Solid* solid); virtual bool OPAL_CALL internal_dependsOn(Joint* joint); protected: Joint* mJoint; ! Mode mMode; int mJointAxis; real mDesiredPos; real mDesiredVel; real mMaxForce; ! real mMultiplier; private: Index: AttractorMotor.h =================================================================== RCS file: /cvsroot/opal/opal/src/AttractorMotor.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** AttractorMotor.h 7 Feb 2005 02:08:16 -0000 1.15 --- AttractorMotor.h 8 Feb 2005 04:59:05 -0000 1.16 *************** *** 36,48 **** class AttractorMotor : public Motor { - public: ! //2 solids attractor constructor ! AttractorMotor(Solid* solid1, Solid* solid2, real strength, ! real exponent); ! //1 solid, 1 joint attractor constructor ! AttractorMotor(Solid* solid, const Point3r& point, real strength, ! real exponent); virtual void OPAL_CALL internal_destroy(); --- 36,55 ---- class AttractorMotor : public Motor { public: ! enum Mode ! { ! SOLID_SOLID_MODE, ! SOLID_POINT_MODE ! }; ! AttractorMotor(); ! ! /// Sets up the Motor to attract two Solids to each other. This will ! /// enable the Motor. ! virtual void OPAL_CALL init(Solid* solid0, Solid* solid1); ! ! /// Sets up the Motor to attract a single Solid some a given point. ! /// This will enable the Motor. ! virtual void OPAL_CALL init(Solid* solid, const Point3r& point); virtual void OPAL_CALL internal_destroy(); *************** *** 50,64 **** virtual void OPAL_CALL internal_update(); ! //virtual void updateGlobal)const std::vector<Solid*>* solidList); ! virtual bool OPAL_CALL internal_dependsOn(Solid* solid); ! virtual bool OPAL_CALL internal_dependsOn(Joint* joint); protected: virtual ~AttractorMotor(); Solid* mSolid1; - Solid* mSolid2; Point3r mPoint; --- 57,81 ---- virtual void OPAL_CALL internal_update(); ! /// Sets the strength parameter. ! virtual void OPAL_CALL setStrength(real s); ! /// Returns the strength parameter. ! virtual real OPAL_CALL getStrength()const; ! /// Sets the exponent parameter. ! virtual void OPAL_CALL setExponent(real e); ! ! /// Returns the exponent parameter. ! virtual real OPAL_CALL getExponent()const; ! ! virtual bool OPAL_CALL internal_dependsOn(Solid* solid); protected: virtual ~AttractorMotor(); + Mode mMode; + + Solid* mSolid0; Solid* mSolid1; Point3r mPoint; --- NEW FILE: ThrusterMotor.cpp --- /************************************************************************* * * * Open Physics Abstraction Layer * * Copyright (C) 2004-2005 * * Alan Fischer ala...@gm... * * Andres Reinot an...@re... * * Tyler Streeter tyl...@gm... * * All rights reserved. * * Web: opal.sourceforge.net * * * * 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-LGPL.txt. * * (2) The BSD-style license that is included with this library in * * the file license-BSD.txt. * * * * 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-LGPL.txt and license-BSD.txt for more details. * * * *************************************************************************/ #include "ThrusterMotor.h" #include "Solid.h" #include "Joint.h" namespace opal { ThrusterMotor::ThrusterMotor() : Motor() { mSolid = NULL; } ThrusterMotor::~ThrusterMotor() { } void ThrusterMotor::init(Solid* solid) { mSolid = solid; mEnabled = true; } void ThrusterMotor::internal_destroy() { delete this; } void ThrusterMotor::internal_update() { if (mEnabled) { mSolid->addForce(mForce); } } void ThrusterMotor::setForce(const Force& f) { mForce = f; } const Force& ThrusterMotor::getForce()const { return mForce; } bool ThrusterMotor::internal_dependsOn(Solid* solid) { if (solid == mSolid) { return true; } else { return false; } } } Index: Defines.h =================================================================== RCS file: /cvsroot/opal/opal/src/Defines.h,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** Defines.h 7 Feb 2005 02:08:22 -0000 1.45 --- Defines.h 8 Feb 2005 04:59:05 -0000 1.46 *************** *** 58,64 **** --- 58,85 ---- struct Force { + Force() + { + type = LOCAL_FORCE; + timeLeft = 0; + singleStep = false; + } + + /// Specifies the type of force. ForceType type; + + /// Specifies how long to apply to force. real timeLeft; + + /// This is mainly used internally by OPAL. It specifies that + /// the force will be applied across a single time step. If this + /// parameter is true, 'timeLeft' will be ignored. + bool singleStep; + + /// The force direction or torque axis. This parameter encodes the + /// magnitude of the force or torque. Vec3r vec; + + /// Only used when the force is applied at an offset (i.e. not + /// the center of mass). Point3r pos; }; *************** *** 148,152 **** const real woodDensity=(real)0.2; ! const real rubberSolidness=(real)0.0; const real rubberFriction=(real)1.0; const real rubberBounciness=(real)1.0; --- 169,173 ---- const real woodDensity=(real)0.2; ! const real rubberSolidness=0; const real rubberFriction=(real)1.0; const real rubberBounciness=(real)1.0; *************** *** 154,158 **** const real iceSolidness=(real)1.0; ! const real iceFriction=(real)0.0; const real iceBounciness=(real)0.05; const real iceDensity=(real)0.25; --- 175,179 ---- const real iceSolidness=(real)1.0; ! const real iceFriction=0; const real iceBounciness=(real)0.05; const real iceDensity=(real)0.25; *************** *** 189,194 **** const Point3r jointAnchor=Point3r(0, 0, 0); const JointBreakMode jointBreakMode=UNBREAKABLE; ! const real jointBreakThresh=(real)0.0; ! const real jointAccumThresh=(real)0.0; const real linearDamping=(real)0.15; const real angularDamping=(real)0.15; --- 210,215 ---- const Point3r jointAnchor=Point3r(0, 0, 0); const JointBreakMode jointBreakMode=UNBREAKABLE; ! const real jointBreakThresh=0; ! const real jointAccumThresh=0; const real linearDamping=(real)0.15; const real angularDamping=(real)0.15; *************** *** 199,209 **** { //ODE-specific defaults ! const real autoDisableLinearMin=(real)0.0; const real autoDisableLinearMax=(real)0.2; ! const real autoDisableAngularMin=(real)0.0; const real autoDisableAngularMax=(real)0.2; const int autoDisableStepsMin=(int)1; const int autoDisableStepsMax=(int)60; ! const real autoDisableTimeMin=(real)0.0; const real autoDisableTimeMax=(real)0.4; const int maxContactPoints=(int)32; --- 220,230 ---- { //ODE-specific defaults ! const real autoDisableLinearMin=0; const real autoDisableLinearMax=(real)0.2; ! const real autoDisableAngularMin=0; const real autoDisableAngularMax=(real)0.2; const int autoDisableStepsMin=(int)1; const int autoDisableStepsMax=(int)60; ! const real autoDisableTimeMin=0; const real autoDisableTimeMax=(real)0.4; const int maxContactPoints=(int)32; --- NEW FILE: GearedMotor.h --- /************************************************************************* * * * Open Physics Abstraction Layer * * Copyright (C) 2004-2005 * * Alan Fischer ala...@gm... * * Andres Reinot an...@re... * * Tyler Streeter tyl...@gm... * * All rights reserved. * * Web: opal.sourceforge.net * * * * 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-LGPL.txt. * * (2) The BSD-style license that is included with this library in * * the file license-BSD.txt. * * * * 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-LGPL.txt and license-BSD.txt for more details. * * * *************************************************************************/ #ifndef OPAL_GEARED_MOTOR_H #define OPAL_GEARED_MOTOR_H #include "Defines.h" #include "Motor.h" namespace opal { /// This Motor applies to a rotational Joint. It applies a torque to /// one of its degrees of freedom, but the amount of torque decreases /// linearly as the angular velocity increases, similar to an automobile /// engine. The Motor's max torque is applied when angular velocity is /// zero. When the angular velocity reaches the Motor's max velocity, /// zero torque is applied. class GearedMotor : public Motor { public: GearedMotor::GearedMotor(); /// Sets up the Motor to affect one a Joint's axes. This will /// enable the Motor. virtual void OPAL_CALL init(Joint* joint, int jointAxis, real maxTorque, real maxVelocity); virtual void OPAL_CALL internal_destroy(); virtual void OPAL_CALL internal_update(); virtual void OPAL_CALL setThrottle(real throttle); virtual real OPAL_CALL getThrottle()const; //virtual bool OPAL_CALL internal_dependsOn(Solid* solid); virtual bool OPAL_CALL internal_dependsOn(Joint* joint); protected: virtual ~GearedMotor(); //Solid* mSolid; Joint* mJoint; //Vec3r mVector; //bool mGlobalCoords; int mJointAxis; //bool mLinear; //real mMaxForce; real mMaxTorque; real mMaxVelInverse; real mThrottle; private: }; } #endif Index: DesiredPosMotor.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/DesiredPosMotor.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** DesiredPosMotor.cpp 7 Feb 2005 02:08:22 -0000 1.9 --- DesiredPosMotor.cpp 8 Feb 2005 04:59:05 -0000 1.10 *************** *** 31,42 **** namespace opal { ! DesiredPosMotor::DesiredPosMotor(Solid* solid) : Motor() { ! mSolid = solid; mDesiredPos = Point3r(); - //mDesiredAngles = Vec3r(); - //mDesiredOrientation.set(0, 0, 0, 0); - //mDesiredOrientation.makeIdentity(); mDesiredForward = Vec3r(); mDesiredUp = Vec3r(); --- 31,40 ---- namespace opal { ! DesiredPosMotor::DesiredPosMotor() : Motor() { ! mSolid = NULL; ! mMode = LINEAR_MODE; mDesiredPos = Point3r(); mDesiredForward = Vec3r(); mDesiredUp = Vec3r(); *************** *** 46,51 **** mAngularKd = (real)0.1; mAngularKs = (real)1.0; - mLinearEnabled = false; - mAngularEnabled = false; } --- 44,47 ---- *************** *** 54,76 **** } ! void DesiredPosMotor::internal_destroy() { ! delete this; } ! void DesiredPosMotor::init(Mode m) { ! switch(m) ! { ! case LINEAR_MODE: ! mLinearEnabled = true; ! break; ! case ANGULAR_MODE: ! mAngularEnabled = true; ! break; ! default: ! assert(false); ! break; ! } } --- 50,62 ---- } ! void DesiredPosMotor::init(Solid* solid, Mode m) { ! mSolid = solid; ! mMode = m; } ! void DesiredPosMotor::internal_destroy() { ! delete this; } *************** *** 81,92 **** if (mEnabled) { ! if (mLinearEnabled) { Vec3r error = mDesiredPos - mSolid->getPosition(); ! mSolid->addGlobalForce(mLinearKs*error - ! mLinearKd*mSolid->getGlobalLinearVel()); } ! if (mAngularEnabled) { // find cross products of actual and desired forward, up, --- 67,82 ---- if (mEnabled) { ! if (LINEAR_MODE == mMode || LINEAR_AND_ANGULAR_MODE == mMode) { Vec3r error = mDesiredPos - mSolid->getPosition(); ! Force f; ! f.singleStep = true; ! f.type = GLOBAL_FORCE; ! f.vec = mLinearKs * error - ! mLinearKd * mSolid->getGlobalLinearVel(); ! mSolid->addForce(f); } ! if (ANGULAR_MODE == mMode || LINEAR_AND_ANGULAR_MODE == mMode) { // find cross products of actual and desired forward, up, *************** *** 142,147 **** // use the error vector to calculate torque ! mSolid->addGlobalTorque(mAngularKs*errorAxis - ! mAngularKd*mSolid->getGlobalAngularVel()); } } --- 132,141 ---- // use the error vector to calculate torque ! Force f; ! f.singleStep = true; ! f.type = GLOBAL_TORQUE; ! f.vec = mAngularKs * errorAxis - mAngularKd * ! mSolid->getGlobalAngularVel(); ! mSolid->addForce(f); } } *************** *** 249,256 **** } } - - bool DesiredPosMotor::internal_dependsOn(Joint* joint) - { - return false; - } } --- 243,245 ---- Index: SliderJoint.h =================================================================== RCS file: /cvsroot/opal/opal/src/SliderJoint.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** SliderJoint.h 7 Feb 2005 02:08:22 -0000 1.16 --- SliderJoint.h 8 Feb 2005 04:59:05 -0000 1.17 *************** *** 37,43 **** { public: ! SliderJoint(Solid* solid1, Solid* solid2) ! : Joint(solid1, solid2) ! {} virtual void OPAL_CALL internal_destroy() = 0; --- 37,47 ---- { public: ! SliderJoint() ! : Joint() ! { ! mAxis0Rotational = false; ! mAxis1Rotational = false; ! mAxis2Rotational = false; ! } virtual void OPAL_CALL internal_destroy() = 0; Index: AttractorMotor.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/AttractorMotor.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** AttractorMotor.cpp 7 Feb 2005 02:08:15 -0000 1.8 --- AttractorMotor.cpp 8 Feb 2005 04:59:05 -0000 1.9 *************** *** 31,57 **** namespace opal { ! //2 solids attractor constructor ! AttractorMotor::AttractorMotor(Solid* solid1, Solid* solid2, real strength, real exponent) : Motor() { ! mSolid1 = solid1; ! mSolid2 = solid2; ! mStrength = strength; ! mExponent = exponent; } ! //1 solid, 1 joint attractor constructor ! AttractorMotor::AttractorMotor(Solid* solid, const Point3r& point, real strength, real exponent) ! : Motor() { - mSolid1 = solid; - mSolid2 = NULL; - mPoint = point; - mStrength = strength; - mExponent = exponent; } ! AttractorMotor::~AttractorMotor() { } --- 31,64 ---- namespace opal { ! AttractorMotor::AttractorMotor() : Motor() { ! mMode = SOLID_SOLID_MODE; ! mSolid0 = NULL; ! mSolid1 = NULL; ! mPoint = Point3r(); ! mStrength = (real)1.0; ! mExponent = (real)1.0; } ! AttractorMotor::~AttractorMotor() { } ! void AttractorMotor::init(Solid* solid0, Solid* solid1) { + mMode = SOLID_SOLID_MODE; + mSolid0 = solid0; + mSolid1 = solid1; + mEnabled = true; + } + + void AttractorMotor::init(Solid* solid, const Point3r& point) + { + mMode = SOLID_POINT_MODE; + mSolid0 = solid; + mSolid1 = NULL; + mPoint = point; + mEnabled = true; } *************** *** 65,125 **** if (mEnabled) { ! //in the future, maybe try using the solids' masses (i.e. f = gmm/r^2) ! if (NULL != mSolid2) { ! //2 solids case ! Point3r pos1 = mSolid1->getPosition(); ! Point3r pos2 = mSolid2->getPosition(); ! ! Vec3r v = pos1 - pos2; //vector pointing from mSolid2 to mSolid1 ! Vec3r force; ! if (2.0 == mExponent) { ! //this is a little faster ! force = v * mStrength / v.lengthSquared(); } else { ! force = v * mStrength / (pow(v.length(), mExponent)); } ! mSolid2->addGlobalForce(force); ! mSolid1->addGlobalForce(-1.0*force); } ! else { ! //1 solid, 1 point case ! Point3r pos1 = mSolid1->getPosition(); ! ! Vec3r v = mPoint - pos1; //vector pointing from mSolid1 to mPoint ! Vec3r force; if (2.0 == mExponent) { ! //this is a little faster ! force = v * mStrength / v.lengthSquared(); } else { ! force = v * mStrength / (pow(v.length(), mExponent)); } ! mSolid1->addGlobalForce(force); } } } ! //void AttractorMotor::updateGlobal(const std::vector<Solid*>* solidList) ! //{ ! //} bool AttractorMotor::internal_dependsOn(Solid* solid) { ! if (solid == mSolid1 || solid == mSolid2) { return true; --- 72,152 ---- if (mEnabled) { ! // TODO: Try including the solids' masses (i.e. f = gmm/r^2). ! ! if (SOLID_SOLID_MODE == mMode) { ! Point3r pos1 = mSolid0->getPosition(); ! Point3r pos2 = mSolid1->getPosition(); ! // Create a vector pointing from mSolid1 to mSolid0. ! Vec3r v = pos1 - pos2; ! Force f; ! f.singleStep = true; ! f.type = GLOBAL_FORCE; ! if ((real)2.0 == mExponent) { ! // If we know the exponent is 2, this can speed things up. ! f.vec = v * mStrength / v.lengthSquared(); } else { ! f.vec = v * mStrength / (pow(v.length(), mExponent)); } ! mSolid1->addForce(f); ! f.vec *= (real)-1.0; ! mSolid0->addForce(f); } ! else // solid-point mode { ! Point3r pos1 = mSolid0->getPosition(); ! // Create a vector pointing from mSolid1 to mPoint. ! Vec3r v = mPoint - pos1; ! Force f; ! f.singleStep = true; ! f.type = GLOBAL_FORCE; if (2.0 == mExponent) { ! // If we know the exponent is 2, this can speed things up. ! f.vec = v * mStrength / v.lengthSquared(); } else { ! f.vec = v * mStrength / (pow(v.length(), mExponent)); } ! mSolid0->addForce(f); } } } ! void AttractorMotor::setStrength(real s) ! { ! mStrength = s; ! } ! ! real AttractorMotor::getStrength()const ! { ! return mStrength; ! } ! ! void AttractorMotor::setExponent(real e) ! { ! mExponent = e; ! } ! ! real AttractorMotor::getExponent()const ! { ! return mExponent; ! } bool AttractorMotor::internal_dependsOn(Solid* solid) { ! if (solid == mSolid0 || solid == mSolid1) { return true; *************** *** 130,137 **** } } - - bool AttractorMotor::internal_dependsOn(Joint* joint) - { - return false; - } } --- 157,159 ---- Index: Hinge2Joint.h =================================================================== RCS file: /cvsroot/opal/opal/src/Hinge2Joint.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Hinge2Joint.h 7 Feb 2005 02:08:22 -0000 1.17 --- Hinge2Joint.h 8 Feb 2005 04:59:05 -0000 1.18 *************** *** 37,43 **** { public: ! Hinge2Joint(Solid* solid1, Solid* solid2) ! : Joint(solid1, solid2) ! {} virtual void OPAL_CALL internal_destroy() = 0; --- 37,47 ---- { public: ! Hinge2Joint() ! : Joint() ! { ! mAxis0Rotational = true; ! mAxis1Rotational = true; ! mAxis2Rotational = false; ! } virtual void OPAL_CALL internal_destroy() = 0; Index: Solid.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/Solid.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Solid.cpp 7 Feb 2005 02:08:22 -0000 1.12 --- Solid.cpp 8 Feb 2005 04:59:05 -0000 1.13 *************** *** 162,258 **** //} ! void Solid::addLocalForce(const Vec3r& force, real duration) { - Force f; - f.type = LOCAL_FORCE; - f.timeLeft = duration; - f.vec = force; mForceList.push_back(f); } ! void Solid::addGlobalForce(const Vec3r& force, real duration) ! { ! Force f; ! f.type = GLOBAL_FORCE; ! f.timeLeft = duration; ! f.vec = force; ! mForceList.push_back(f); ! } ! void Solid::addLocalForceAtLocalPos(const Vec3r& force, ! const Point3r& pos, real duration) ! { ! Force f; ! f.type = LOCAL_FORCE_AT_LOCAL_POS; ! f.timeLeft = duration; ! f.vec = force; ! f.pos = pos; ! mForceList.push_back(f); ! } ! void Solid::addLocalForceAtGlobalPos(const Vec3r& force, ! const Point3r& pos, real duration) ! { ! Force f; ! f.type = LOCAL_FORCE_AT_GLOBAL_POS; ! f.timeLeft = duration; ! f.vec = force; ! f.pos = pos; ! mForceList.push_back(f); ! } ! void Solid::addGlobalForceAtLocalPos(const Vec3r& force, ! const Point3r& pos, real duration) ! { ! Force f; ! f.type = GLOBAL_FORCE_AT_LOCAL_POS; ! f.timeLeft = duration; ! f.vec = force; ! f.pos = pos; ! mForceList.push_back(f); ! } ! void Solid::addGlobalForceAtGlobalPos(const Vec3r& force, ! const Point3r& pos, real duration) ! { ! Force f; ! f.type = GLOBAL_FORCE_AT_GLOBAL_POS; ! f.timeLeft = duration; ! f.vec = force; ! f.pos = pos; ! mForceList.push_back(f); ! } ! void Solid::addLocalTorque(const Vec3r& axis, real duration) ! { ! Force f; ! f.type = LOCAL_TORQUE; ! f.timeLeft = duration; ! f.vec = axis; ! mForceList.push_back(f); ! } ! void Solid::addGlobalTorque(const Vec3r& axis, real duration) ! { ! Force f; ! f.type = GLOBAL_TORQUE; ! f.timeLeft = duration; ! f.vec = axis; ! mForceList.push_back(f); ! } ! void Solid::addLocalTorque(real amount, Vec3r axis, real duration) ! { ! axis.normalize(); ! axis *= amount; ! addLocalTorque(axis, duration); ! } ! void Solid::addGlobalTorque(real amount, Vec3r axis, real duration) ! { ! axis.normalize(); ! axis *= amount; ! addGlobalTorque(axis, duration); ! } void Solid::internal_applyForces(real stepSize) --- 162,263 ---- //} ! void Solid::addForce(const Force& f) { mForceList.push_back(f); } ! //void Solid::addLocalForce(const Vec3r& force, real duration) ! //{ ! // Force f; ! // f.type = LOCAL_FORCE; ! // f.timeLeft = duration; ! // f.vec = force; ! // mForceList.push_back(f); ! //} ! //void Solid::addGlobalForce(const Vec3r& force, real duration) ! //{ ! // Force f; ! // f.type = GLOBAL_FORCE; ! // f.timeLeft = duration; ! // f.vec = force; ! // mForceList.push_back(f); ! //} ! //void Solid::addLocalForceAtLocalPos(const Vec3r& force, ! // const Point3r& pos, real duration) ! //{ ! // Force f; ! // f.type = LOCAL_FORCE_AT_LOCAL_POS; ! // f.timeLeft = duration; ! // f.vec = force; ! // f.pos = pos; ! // mForceList.push_back(f); ! //} ! //void Solid::addLocalForceAtGlobalPos(const Vec3r& force, ! // const Point3r& pos, real duration) ! //{ ! // Force f; ! // f.type = LOCAL_FORCE_AT_GLOBAL_POS; ! // f.timeLeft = duration; ! // f.vec = force; ! // f.pos = pos; ! // mForceList.push_back(f); ! //} ! //void Solid::addGlobalForceAtLocalPos(const Vec3r& force, ! // const Point3r& pos, real duration) ! //{ ! // Force f; ! // f.type = GLOBAL_FORCE_AT_LOCAL_POS; ! // f.timeLeft = duration; ! // f.vec = force; ! // f.pos = pos; ! // mForceList.push_back(f); ! //} ! //void Solid::addGlobalForceAtGlobalPos(const Vec3r& force, ! // const Point3r& pos, real duration) ! //{ ! // Force f; ! // f.type = GLOBAL_FORCE_AT_GLOBAL_POS; ! // f.timeLeft = duration; ! // f.vec = force; ! // f.pos = pos; ! // mForceList.push_back(f); ! //} ! //void Solid::addLocalTorque(const Vec3r& axis, real duration) ! //{ ! // Force f; ! // f.type = LOCAL_TORQUE; ! // f.timeLeft = duration; ! // f.vec = axis; ! // mForceList.push_back(f); ! //} ! //void Solid::addGlobalTorque(const Vec3r& axis, real duration) ! //{ ! // Force f; ! // f.type = GLOBAL_TORQUE; ! // f.timeLeft = duration; ! // f.vec = axis; ! // mForceList.push_back(f); ! //} ! //void Solid::addLocalTorque(real amount, Vec3r axis, real duration) ! //{ ! // axis.normalize(); ! // axis *= amount; ! // addLocalTorque(axis, duration); ! //} ! ! //void Solid::addGlobalTorque(real amount, Vec3r axis, real duration) ! //{ ! // axis.normalize(); ! // axis *= amount; ! // addGlobalTorque(axis, duration); ! //} void Solid::internal_applyForces(real stepSize) *************** *** 271,277 **** for (forceIter = mForceList.begin(); forceIter != mForceList.end();) { ! if ((*forceIter).timeLeft < (real)-0.5) { - // this must be a single-step force (*forceIter).timeLeft = stepSize; } --- 276,286 ---- for (forceIter = mForceList.begin(); forceIter != mForceList.end();) { ! //if ((*forceIter).timeLeft < (real)-0.5) ! //{ ! // // this must be a single-step force ! // (*forceIter).timeLeft = stepSize; ! //} ! if (true == (*forceIter).singleStep) { (*forceIter).timeLeft = stepSize; } *************** *** 285,293 **** applyForce(*forceIter); ! // The following is ok for all cases (even when ! // timeLeft is < mStepSize). (*forceIter).timeLeft -= stepSize; ! if ((*forceIter).timeLeft <= 0.0) { //delete this force --- 294,302 ---- applyForce(*forceIter); ! // The following is ok for all cases (even when timeLeft is ! // < mStepSize). (*forceIter).timeLeft -= stepSize; ! if ((*forceIter).timeLeft <= 0) { //delete this force --- LimitedForceMotor.h DELETED --- --- ConstForceMotor.cpp DELETED --- Index: Joint.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/Joint.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Joint.cpp 7 Feb 2005 02:08:22 -0000 1.8 --- Joint.cpp 8 Feb 2005 04:59:05 -0000 1.9 *************** *** 27,40 **** #include "Joint.h" namespace opal { ! Joint::Joint(Solid* solid1, Solid* solid2) { ! mSolid1 = solid1; ! mSolid2 = solid2; ! mAxis0 = defaults::jointAxis0; ! mAxis1 = defaults::jointAxis1; ! mAxis2 = defaults::jointAxis2; mLowLimit0 = 0; mHighLimit0 = 0; --- 27,44 ---- #include "Joint.h" + #include "Solid.h" namespace opal { ! Joint::Joint() { ! setSolids(NULL, NULL); ! setAxis(0, defaults::jointAxis0); ! setAxis(1, defaults::jointAxis1); ! setAxis(2, defaults::jointAxis2); ! setAnchor(defaults::jointAnchor); ! mLimit0Enabled = false; ! mLimit1Enabled = false; ! mLimit2Enabled = false; mLowLimit0 = 0; mHighLimit0 = 0; *************** *** 49,53 **** mIsBroken = false; mEventHandler = NULL; ! mEnabled = true; } --- 53,57 ---- mIsBroken = false; mEventHandler = NULL; ! mEnabled = false; } *************** *** 85,89 **** void Joint::restoreDamage() { ! mAccumDamage = 0.0; mIsBroken = false; } --- 89,93 ---- void Joint::restoreDamage() { ! mAccumDamage = 0; mIsBroken = false; } *************** *** 107,112 **** } ! //takes angle limits in degrees ! void Joint::setLimits(real low, real high, int axisNum) { switch(axisNum) --- 111,152 ---- } ! void Joint::setLimitEnabled(int axisNum, bool e) ! { ! switch(axisNum) ! { ! case 0: ! mLimit0Enabled = e; ! break; ! case 1: ! mLimit1Enabled = e; ! break; ! case 2: ! mLimit2Enabled = e; ! break; ! default: ! assert(false); ! } ! } ! ! bool Joint::getLimitEnabled(int axisNum) ! { ! switch(axisNum) ! { ! case 0: ! return mLimit0Enabled; ! break; ! case 1: ! return mLimit1Enabled; ! break; ! case 2: ! return mLimit2Enabled; ! break; ! default: ! assert(false); ! return false; ! } ! } ! ! void Joint::setLimits(int axisNum, real low, real high) { switch(axisNum) *************** *** 130,134 **** } - //returns angle limit in degrees real Joint::getLowLimit(int axisNum) { --- 170,173 ---- *************** *** 146,155 **** default: assert(false); ! return 0.0; break; } } - //returns angle limit in degrees real Joint::getHighLimit(int axisNum) { --- 185,193 ---- default: assert(false); ! return 0; break; } } real Joint::getHighLimit(int axisNum) { *************** *** 167,171 **** default: assert(false); ! return 0.0; break; } --- 205,209 ---- default: assert(false); ! return 0; break; } *************** *** 174,209 **** real Joint::getAngle(int axisNum)const { ! return 0.0; } real Joint::getAngleRate(int axisNum)const { ! return 0.0; } real Joint::getLinearPos(int axisNum)const { ! return 0.0; } real Joint::getLinearPosRate(int axisNum)const { ! return 0.0; } ! void Joint::addForce(real force, int jointAxisNum, real duration) { ! Vec3r newForce = getAxis(jointAxisNum); ! newForce *= force; ! mSolid1->addLocalForce(newForce, duration); ! mSolid2->addLocalForce(-1.0*newForce, duration); } ! void Joint::addTorque(real torque, int jointAxisNum, real duration) { ! Vec3r newTorque = getAxis(jointAxisNum); ! newTorque *= torque; ! mSolid1->addLocalTorque(newTorque, duration); ! mSolid2->addLocalTorque(-1.0*newTorque, duration); } --- 212,273 ---- real Joint::getAngle(int axisNum)const { ! return 0; } real Joint::getAngleRate(int axisNum)const { ! return 0; } real Joint::getLinearPos(int axisNum)const { ! return 0; } real Joint::getLinearPosRate(int axisNum)const { ! return 0; } ! void Joint::addForce(int jointAxisNum, real magnitude, real duration, ! bool singleStep) { ! Force f; ! f.singleStep = singleStep; ! ! // We only care about the duration if this is not a single-step force. ! if (!f.singleStep) ! { ! f.timeLeft = duration; ! } ! ! f.type = LOCAL_FORCE; ! Vec3r direction = getAxis(jointAxisNum); ! f.vec = magnitude * direction; ! ! mSolid0->addForce(f); ! f.vec *= (real)-1.0; ! mSolid1->addForce(f); } ! void Joint::addTorque(int jointAxisNum, real magnitude, real duration, ! bool singleStep) { ! Force f; ! f.singleStep = singleStep; ! ! // We only care about the duration if this is not a single-step force. ! if (!f.singleStep) ! { ! f.timeLeft = duration; ! } ! ! f.type = LOCAL_TORQUE; ! Vec3r axis = getAxis(jointAxisNum); ! f.vec = magnitude * axis; ! ! mSolid0->addForce(f); ! f.vec *= (real)-1.0; ! mSolid1->addForce(f); } *************** *** 218,248 **** void Joint::wakeSolids() { mSolid1->setSleeping(false); - mSolid2->setSleeping(false); } ! void Joint::setSolids(Solid* solid1, Solid* solid2) { ! if (mSolid1 == mSolid2 || (NULL == mSolid1 && NULL == mSolid2)) { mSolid1 = NULL; - mSolid2 = NULL; mEnabled = false; } else { mSolid1 = solid1; - mSolid2 = solid2; } } ! Solid* Joint::getSolid1()const { ! return mSolid1; } ! Solid* Joint::getSolid2()const { ! return mSolid2; } --- 282,312 ---- void Joint::wakeSolids() { + mSolid0->setSleeping(false); mSolid1->setSleeping(false); } ! void Joint::setSolids(Solid* solid0, Solid* solid1) { ! if (mSolid0 == mSolid1 || (NULL == mSolid0 && NULL == mSolid1)) { + mSolid0 = NULL; mSolid1 = NULL; mEnabled = false; } else { + mSolid0 = solid0; mSolid1 = solid1; } } ! Solid* Joint::getSolid0()const { ! return mSolid0; } ! Solid* Joint::getSolid1()const { ! return mSolid1; } *************** *** 285,288 **** --- 349,362 ---- } + void Joint::setAnchor(const Point3r& anchor) + { + mAnchor = anchor; + } + + const Point3r& Joint::getAnchor() + { + return mAnchor; + } + bool Joint::isEnabled()const { *************** *** 295,301 **** } bool Joint::internal_dependsOn(Solid* solid) { ! if (solid == mSolid1 || solid == mSolid2... [truncated message content] |
From: tylerstreeter <tyl...@us...> - 2005-02-08 04:59:15
|
Update of /cvsroot/opal/opal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4996 Modified Files: todo.txt Log Message: reworked Solid setForce functions; renamed some Motors; removed parameters from Joint and Motor constructors Index: todo.txt =================================================================== RCS file: /cvsroot/opal/opal/todo.txt,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** todo.txt 7 Feb 2005 02:08:23 -0000 1.26 --- todo.txt 8 Feb 2005 04:59:07 -0000 1.27 *************** *** 8,33 **** - Blueprint - desc structs (make classes instead?) ! - SolidDesc - JointDesc - ShapeDesc - MotorDesc - SensorDesc ! - other structs (make classes instead?) - Material - RayHit Immediate ========= ! * does event handler interface need to specify calling convention? does it need a destroy function? * remove huge parameter lists from constructors / simulator construction methods - Simulator (done) - Solid (done) ! - Joint: set 2 solids, axes, anchor ! - Motor - Sensor ! - solution: empty constructors, set params to default values - if there are necessary params, use an init function - internal-only constructors (e.g. ODESolid) can still take params --- 8,38 ---- - Blueprint - desc structs (make classes instead?) ! - SolidDesc (replaces SolidState) - JointDesc - ShapeDesc - MotorDesc - SensorDesc ! - other structs - Material - RayHit + - Force Immediate ========= ! * add 'web' and 'doc' modules to repos ! ! * Questions ! - do all class member functions need to specify calling convention? ! - does event handler interface need to specify calling convention? does it need a destroy function? * remove huge parameter lists from constructors / simulator construction methods - Simulator (done) - Solid (done) ! - Joint (done) ! - Motor (done) - Sensor ! - solution: empty constructors, set params to default valFues - if there are necessary params, use an init function - internal-only constructors (e.g. ODESolid) can still take params *************** *** 67,77 **** * Solids: - add a "setSpace" function that moves all shapes from the old space to the new space ! * separate Solid options for sleeping (wakeUp, putToSleep, disable/enable sleeping) - per-object sleepiness ! * Combine DesiredPosMotor with ServoMotor since they do almost the same thing ! ! * Rename ConstForceMotor to something else (e.g. ThrusterMotor)? * Remove ODE-style motor functions from Joint class (e.g. setDesiredVel) --- 72,84 ---- * Solids: - add a "setSpace" function that moves all shapes from the old space to the new space ! * separate Solid options for sleeping (wakeUp, putToSleep, disable/enable sleeping) - per-object sleepiness ! * Motors: ! - Combine DesiredPosMotor with ServoMotor since they do almost the same thing? ! - ServoMotor: PID, doesn't overshoot; linear or angular; joint only ! - SpringMotor (was DesiredPosMotor): kd and ks, can overshoot; linear and/or angular; solid only ! - maybe also add in Attractor stuff to previous? make it really general? * Remove ODE-style motor functions from Joint class (e.g. setDesiredVel) *************** *** 86,89 **** --- 93,100 ---- - solution: keep and document, or remove? + * XML/blueprint + - update parsing + - update instantiation functions + Build System ============ *************** *** 97,100 **** --- 108,116 ---- ============== + * Joints: + - add a JointAxis struct? + + * in the cases where overloaded functions call the original function (e.g. derived setParam calls parent class setParam function), should we keep it this way? or should the overloaded version just do everything? + * materials - have the simulator store a cached list of named materials *************** *** 104,108 **** - another option: don't let users change this for joints: make them use the motors instead ! * try to fix weird inheritance with Joint, ODEJoint, HingeJoint, ODEHingeJoint, etc. * handle blown frame cases: --- 120,124 ---- - another option: don't let users change this for joints: make them use the motors instead ! * try to fix weird inheritance with Joint, ODEJoint, HingeJoint, ODEHingeJoint, etc. (look at Novodex sdk for ideas) * handle blown frame cases: *************** *** 111,114 **** --- 127,132 ---- - complete frame, resulting in a jerky frame rate + * resize-shape function + * small objects rotate weirdly - due to small mass not causing deep enough penetrations, thus they have little friction and just slide around? |
From: tylerstreeter <tyl...@us...> - 2005-02-08 04:59:15
|
Update of /cvsroot/opal/opal/vc7 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4996/vc7 Modified Files: opal-ode.vcproj Log Message: reworked Solid setForce functions; renamed some Motors; removed parameters from Joint and Motor constructors Index: opal-ode.vcproj =================================================================== RCS file: /cvsroot/opal/opal/vc7/opal-ode.vcproj,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** opal-ode.vcproj 2 Feb 2005 07:13:12 -0000 1.3 --- opal-ode.vcproj 8 Feb 2005 04:59:07 -0000 1.4 *************** *** 125,138 **** </File> <File - RelativePath="..\src\ConstForceMotor.cpp"> - </File> - <File RelativePath="..\src\DesiredPosMotor.cpp"> </File> <File ! RelativePath="..\src\Joint.cpp"> </File> <File ! RelativePath="..\src\LimitedForceMotor.cpp"> </File> <File --- 125,135 ---- </File> <File RelativePath="..\src\DesiredPosMotor.cpp"> </File> <File ! RelativePath="..\src\GearedMotor.cpp"> </File> <File ! RelativePath="..\src\Joint.cpp"> </File> <File *************** *** 148,151 **** --- 145,151 ---- RelativePath="..\src\Solid.cpp"> </File> + <File + RelativePath="..\src\ThrusterMotor.cpp"> + </File> </Filter> <Filter *************** *** 165,171 **** </File> <File - RelativePath="..\src\ConstForceMotor.h"> - </File> - <File RelativePath="..\src\Defines.h"> </File> --- 165,168 ---- *************** *** 180,183 **** --- 177,183 ---- </File> <File + RelativePath="..\src\GearedMotor.h"> + </File> + <File RelativePath="..\src\Hinge2Joint.h"> </File> *************** *** 189,195 **** </File> <File - RelativePath="..\src\LimitedForceMotor.h"> - </File> - <File RelativePath="..\src\Motor.h"> </File> --- 189,192 ---- *************** *** 219,222 **** --- 216,222 ---- </File> <File + RelativePath="..\src\ThrusterMotor.h"> + </File> + <File RelativePath="..\src\UniversalJoint.h"> </File> |