[Opal-commits] opal/src AttractorMotorData.h,NONE,1.1 GearedMotorData.h,NONE,1.1 JointData.h,NONE,1.
Status: Inactive
Brought to you by:
tylerstreeter
Update of /cvsroot/opal/opal/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10148/src Modified Files: AttractorMotor.cpp AttractorMotor.h Blueprint.cpp Blueprint.h BlueprintManager.cpp Defines.h GearedMotor.cpp GearedMotor.h Joint.cpp Joint.h Motor.cpp Motor.h ServoMotor.cpp ServoMotor.h ShapeData.h Solid.h SolidData.h SpringMotor.cpp SpringMotor.h ThrusterMotor.cpp ThrusterMotor.h opal.h Added Files: AttractorMotorData.h GearedMotorData.h JointData.h MotorData.h SensorData.h ServoMotorData.h SpringMotorData.h ThrusterMotorData.h Log Message: added MotorData and JointData classes Index: BlueprintManager.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/BlueprintManager.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** BlueprintManager.cpp 22 Feb 2005 01:25:55 -0000 1.24 --- BlueprintManager.cpp 23 Feb 2005 03:58:23 -0000 1.25 *************** *** 473,481 **** // The JointData automatically gets initialized to default values // in its constructor. ! JointData jd; #ifdef OPAL_USE_XML ! //jd.name = getAttributeString(nodePtr, "name"); std::string type = getAttributeString(nodePtr, "type"); --- 473,481 ---- // The JointData automatically gets initialized to default values // in its constructor. ! JointData data; #ifdef OPAL_USE_XML ! //data.name = getAttributeString(nodePtr, "name"); std::string type = getAttributeString(nodePtr, "type"); *************** *** 483,507 **** if ("hinge" == type) { ! jd.type = HINGE_JOINT; } else if ("universal" == type) { ! jd.type = UNIVERSAL_JOINT; } else if ("ball" == type) { ! jd.type = BALL_JOINT; } else if ("slider" == type) { ! jd.type = SLIDER_JOINT; } else if ("hinge2" == type) { ! jd.type = HINGE_2_JOINT; } else if ("fixed" == type) { ! jd.type = FIXED_JOINT; } else --- 483,507 ---- if ("hinge" == type) { ! data.setType(HINGE_JOINT); } else if ("universal" == type) { ! data.setType(UNIVERSAL_JOINT); } else if ("ball" == type) { ! data.setType(BALL_JOINT); } else if ("slider" == type) { ! data.setType(SLIDER_JOINT); } else if ("hinge2" == type) { ! data.setType(HINGE_2_JOINT); } else if ("fixed" == type) { ! data.setType(FIXED_JOINT); } else *************** *** 510,514 **** Invalid joint type requested" << " in " << filename << std::endl; ! return jd; } --- 510,514 ---- Invalid joint type requested" << " in " << filename << std::endl; ! return data; } *************** *** 518,526 **** if (NULL != paramsNodePtr) { ! //jd.kd = getAttributeReal(paramsNodePtr, "kd"); ! //jd.ks = getAttributeReal(paramsNodePtr, "ks"); ! jd.breakThresh = getAttributeReal(paramsNodePtr, "breakThresh"); ! jd.accumThresh = getAttributeReal(paramsNodePtr, "accumThresh"); std::string breakMode = --- 518,526 ---- if (NULL != paramsNodePtr) { ! //data.kd = getAttributeReal(paramsNodePtr, "kd"); ! //data.ks = getAttributeReal(paramsNodePtr, "ks"); ! data.breakThresh = getAttributeReal(paramsNodePtr, "breakThresh"); ! data.accumThresh = getAttributeReal(paramsNodePtr, "accumThresh"); std::string breakMode = *************** *** 529,541 **** if ("unbreakable" == breakMode) { ! jd.breakMode = UNBREAKABLE; } else if ("threshold" == breakMode) { ! jd.breakMode = THRESHOLD; } else if ("accumulated" == breakMode) { ! jd.breakMode = ACCUMULATED; } else --- 529,541 ---- if ("unbreakable" == breakMode) { ! data.breakMode = UNBREAKABLE; } else if ("threshold" == breakMode) { ! data.breakMode = THRESHOLD; } else if ("accumulated" == breakMode) { ! data.breakMode = ACCUMULATED; } else *************** *** 544,548 **** Invalid joint break mode requested" << " in " << filename << std::endl; ! return jd; } } --- 544,548 ---- Invalid joint break mode requested" << " in " << filename << std::endl; ! return data; } } *************** *** 556,560 **** Anchor element missing" << " in " << filename << std::endl; ! return jd; } else --- 556,560 ---- Anchor element missing" << " in " << filename << std::endl; ! return data; } else *************** *** 563,567 **** real y = getAttributeReal(anchorNodePtr, "y"); real z = getAttributeReal(anchorNodePtr, "z"); ! jd.anchor.set((real)x, (real)y, (real)z); } --- 563,567 ---- real y = getAttributeReal(anchorNodePtr, "y"); real z = getAttributeReal(anchorNodePtr, "z"); ! data.anchor.set((real)x, (real)y, (real)z); } *************** *** 580,584 **** Axis0 element missing" << " in " << filename << std::endl; ! return jd; } else --- 580,584 ---- Axis0 element missing" << " in " << filename << std::endl; ! return data; } else *************** *** 593,597 **** missing from Axis0 element" << " in " << filename << std::endl; ! return jd; } else --- 593,597 ---- missing from Axis0 element" << " in " << filename << std::endl; ! return data; } else *************** *** 600,604 **** real y = getAttributeReal(directionNodePtr, "y"); real z = getAttributeReal(directionNodePtr, "z"); ! jd.axis[0].direction.set(x, y, z); } --- 600,604 ---- real y = getAttributeReal(directionNodePtr, "y"); real z = getAttributeReal(directionNodePtr, "z"); ! data.axis[0].direction.set(x, y, z); } *************** *** 608,614 **** if (NULL != limitsNodePtr) { ! jd.axis[0].limits.low = getAttributeReal(limitsNodePtr, "low"); ! jd.axis[0].limits.high = getAttributeReal(limitsNodePtr, "high"); } --- 608,614 ---- if (NULL != limitsNodePtr) { ! data.axis[0].limits.low = getAttributeReal(limitsNodePtr, "low"); ! data.axis[0].limits.high = getAttributeReal(limitsNodePtr, "high"); } *************** *** 626,630 **** loadJoint: Axis1 element missing" << " in " << filename << std::endl; ! return jd; } else --- 626,630 ---- loadJoint: Axis1 element missing" << " in " << filename << std::endl; ! return data; } else *************** *** 639,643 **** missing from Axis1 element" << " in " << filename << std::endl; ! return jd; } else --- 639,643 ---- missing from Axis1 element" << " in " << filename << std::endl; ! return data; } else *************** *** 646,650 **** real y = getAttributeReal(directionNodePtr, "y"); real z = getAttributeReal(directionNodePtr, "z"); ! jd.axis[1].direction.set(x, y, z); } --- 646,650 ---- real y = getAttributeReal(directionNodePtr, "y"); real z = getAttributeReal(directionNodePtr, "z"); ! data.axis[1].direction.set(x, y, z); } *************** *** 654,660 **** if (NULL != limitsNodePtr) { ! jd.axis[1].limits.low = getAttributeReal(limitsNodePtr, "low"); ! jd.axis[1].limits.high = getAttributeReal(limitsNodePtr, "high"); } --- 654,660 ---- if (NULL != limitsNodePtr) { ! data.axis[1].limits.low = getAttributeReal(limitsNodePtr, "low"); ! data.axis[1].limits.high = getAttributeReal(limitsNodePtr, "high"); } *************** *** 672,676 **** loadJoint: Axis2 element missing" << " in " << filename << std::endl; ! return jd; } else --- 672,676 ---- loadJoint: Axis2 element missing" << " in " << filename << std::endl; ! return data; } else *************** *** 685,689 **** element missing from Axis2 element" << " in " << filename << std::endl; ! return jd; } else --- 685,689 ---- element missing from Axis2 element" << " in " << filename << std::endl; ! return data; } else *************** *** 695,699 **** real z = getAttributeReal(directionNodePtr, "z"); ! jd.axis[2].direction.set(x, y, z); } --- 695,699 ---- real z = getAttributeReal(directionNodePtr, "z"); ! data.axis[2].direction.set(x, y, z); } *************** *** 703,709 **** if (NULL != limitsNodePtr) { ! jd.axis[2].limits.low = getAttributeReal(limitsNodePtr, "low"); ! jd.axis[2].limits.high = getAttributeReal(limitsNodePtr, "high"); } --- 703,709 ---- if (NULL != limitsNodePtr) { ! data.axis[2].limits.low = getAttributeReal(limitsNodePtr, "low"); ! data.axis[2].limits.high = getAttributeReal(limitsNodePtr, "high"); } *************** *** 725,737 **** Solids element missing" << " in " << filename << std::endl; ! return jd; } else { ! //jd.solid0Name = getAttributeString(solidsNodePtr, "name0"); ! //jd.solid1Name = getAttributeString(solidsNodePtr, "name1"); //std::cout << "Warning in opal::BlueprintManager::loadJoint: \ ! // Joint " << jd.name << " refers to the same Solid \ // twice in " << filename << std::endl; } --- 725,737 ---- Solids element missing" << " in " << filename << std::endl; ! return data; } else { ! //data.solid0Name = getAttributeString(solidsNodePtr, "name0"); ! //data.solid1Name = getAttributeString(solidsNodePtr, "name1"); //std::cout << "Warning in opal::BlueprintManager::loadJoint: \ ! // Joint " << data.name << " refers to the same Solid \ // twice in " << filename << std::endl; } *************** *** 739,743 **** #endif ! return jd; } --- 739,743 ---- #endif ! return data; } Index: opal.h =================================================================== RCS file: /cvsroot/opal/opal/src/opal.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** opal.h 22 Feb 2005 04:28:11 -0000 1.15 --- opal.h 23 Feb 2005 03:58:23 -0000 1.16 *************** *** 32,35 **** --- 32,36 ---- #include "Solid.h" #include "SolidData.h" + #include "ShapeData.h" #include "BoxShapeData.h" #include "SphereShapeData.h" *************** *** 39,48 **** --- 40,53 ---- #include "MeshShapeData.h" #include "Motor.h" + #include "MotorData.h" #include "AttractorMotor.h" + #include "AttractorMotorData.h" #include "ServoMotor.h" #include "ThrusterMotor.h" #include "GearedMotor.h" #include "Joint.h" + #include "JointData.h" #include "Sensor.h" + #include "SensorData.h" #include "EventHandler.h" #include "Blueprint.h" *************** *** 57,59 **** #endif - --- 62,63 ---- Index: Motor.h =================================================================== RCS file: /cvsroot/opal/opal/src/Motor.h,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** Motor.h 21 Feb 2005 15:54:38 -0000 1.33 --- Motor.h 23 Feb 2005 03:58:23 -0000 1.34 *************** *** 46,50 **** /// functions, and adding Motor instances to the simulation via the /// Simulator class (see Simulator for details). All Motors start out ! /// disabled and must be initialized via init) before they can be /// enabled. class Motor --- 46,50 ---- /// functions, and adding Motor instances to the simulation via the /// Simulator class (see Simulator for details). All Motors start out ! /// disabled and must be initialized via init before they can be /// enabled. class Motor *************** *** 56,64 **** /// Returns true if the Motor is enabled. ! virtual bool OPAL_CALL isEnabled()const; /// Sets whether the Motor has any effect. If the Motor has not /// yet been initialized, this will have no effect. ! virtual void OPAL_CALL setEnabled(bool e); /// Set the user data pointer to some external data. The user data --- 56,64 ---- /// Returns true if the Motor is enabled. ! virtual bool OPAL_CALL isEnabled()const = 0; /// Sets whether the Motor has any effect. If the Motor has not /// yet been initialized, this will have no effect. ! virtual void OPAL_CALL setEnabled(bool e) = 0; /// Set the user data pointer to some external data. The user data *************** *** 92,96 **** /// True if the Motor is enabled. ! bool mEnabled; /// Pointer to user data. This is totally user-managed (i.e. OPAL --- 92,96 ---- /// True if the Motor is enabled. ! //bool mEnabled; /// Pointer to user data. This is totally user-managed (i.e. OPAL Index: ShapeData.h =================================================================== RCS file: /cvsroot/opal/opal/src/ShapeData.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ShapeData.h 22 Feb 2005 19:46:30 -0000 1.2 --- ShapeData.h 23 Feb 2005 03:58:23 -0000 1.3 *************** *** 33,37 **** namespace opal { ! /// The types of collision shapes currently supported. enum ShapeType { --- 33,37 ---- namespace opal { ! /// The types of Shapes currently available. enum ShapeType { --- NEW FILE: GearedMotorData.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_DATA_H #define OPAL_GEARED_MOTOR_DATA_H #include "Defines.h" #include "MotorData.h" namespace opal { /// A data structure describing a GearedMotor. class GearedMotorData : public MotorData { public: GearedMotorData() : MotorData() { mType = GEARED_MOTOR; joint = NULL; jointAxisNum = 0; maxTorque = defaults::motor::geared::maxTorque; maxVelocity = defaults::motor::geared::maxVelocity; throttle = 0; } /// Copy constructor. GearedMotorData(const GearedMotorData& data) { (*this) = data; } virtual ~GearedMotorData() { } /// Makes a deep copy. virtual void OPAL_CALL operator=(const GearedMotorData& data) { mType = data.mType; enabled = data.enabled; joint = data.joint; jointAxisNum = data.jointAxisNum; maxTorque = data.maxTorque; maxVelocity = data.maxVelocity; throttle = data.throttle; } /// Pointer to the Joint affected by this Motor. Joint* joint; /// The index of the specific Joint axis affected by this Motor. int jointAxisNum; /// The maximum amount of torque that can be applied to the Joint /// axis. real maxTorque; /// The maximum velocity that can be achieved by the Motor. real maxVelocity; /// The throttle (i.e. the "gas") affects how much of the available /// torque is applied to the Joint axis. real throttle; protected: private: }; } #endif --- NEW FILE: AttractorMotorData.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_ATTRACTOR_MOTOR_DATA_H #define OPAL_ATTRACTOR_MOTOR_DATA_H #include "Defines.h" #include "MotorData.h" namespace opal { /// A data structure describing an AttractorMotor. class AttractorMotorData : public MotorData { public: AttractorMotorData() : MotorData() { mType = ATTRACTOR_MOTOR; solid0 = NULL; solid1 = NULL; strength = defaults::motor::attractor::strength; exponent = defaults::motor::attractor::exponent; } /// Copy constructor. AttractorMotorData(const AttractorMotorData& data) { (*this) = data; } virtual ~AttractorMotorData() { } /// Makes a deep copy. virtual void OPAL_CALL operator=(const AttractorMotorData& data) { mType = data.mType; enabled = data.enabled; solid0 = data.solid0; solid1 = data.solid1; strength = data.strength; exponent = data.exponent; } /// Pointer to Solid 0. Solid* solid0; /// Pointer to Solid 1. Solid* solid1; /// Constant used to scale attraction (repulsion if strength < 0). real strength; /// Determines exponential relationship of attraction/repulsion. real exponent; protected: private: }; } #endif Index: SpringMotor.h =================================================================== RCS file: /cvsroot/opal/opal/src/SpringMotor.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SpringMotor.h 18 Feb 2005 23:59:37 -0000 1.5 --- SpringMotor.h 23 Feb 2005 03:58:23 -0000 1.6 *************** *** 31,34 **** --- 31,35 ---- #include "Defines.h" #include "Motor.h" + #include "SpringMotorData.h" namespace opal *************** *** 41,58 **** { public: - /// The different SpringMotor modes of operation. - enum Mode - { - /// Makes the Motor work to achieve a desired position. - LINEAR_MODE, - - /// Makes the Motor work to achieve a desired orientation. - ANGULAR_MODE, - - /// Makes the Motor work to achieve a desired position and - /// orientation. - LINEAR_AND_ANGULAR_MODE - }; - SpringMotor(); --- 42,45 ---- *************** *** 63,67 **** /// enable the Motor. Calling this more than once will detach the /// Motor from its Solid and attach it to a new Solid. ! virtual void OPAL_CALL init(Mode m, Solid* s); /// Sets the desired position and orientation. --- 50,64 ---- /// enable the Motor. Calling this more than once will detach the /// Motor from its Solid and attach it to a new Solid. ! //virtual void OPAL_CALL init(Mode m, Solid* s); ! ! /// Initializes the Motor with the given data structure. ! virtual void OPAL_CALL init(const SpringMotorData& data); ! ! /// Returns all data describing the Motor. ! virtual const SpringMotorData& OPAL_CALL getMotorData(); ! ! virtual bool OPAL_CALL isEnabled()const; ! ! virtual void OPAL_CALL setEnabled(bool e); /// Sets the desired position and orientation. *************** *** 104,140 **** protected: ! /// Pointer to the Solid affected by this Motor. ! Solid* mSolid; ! /// The Motor's mode of operation. ! Mode mMode; ! /// The Motor's desired position. This is only used if the ! /// appropriate mode is set. ! Point3r mDesiredPos; ! /// The Motor's desired forward direction, part of the desired ! /// orientation. This is only used if the appropriate mode is set. ! Vec3r mDesiredForward; ! /// The Motor's desired up direction, part of the desired ! /// orientation. This is only used if the appropriate mode is set. ! Vec3r mDesiredUp; ! /// The Motor's desired right direction, part of the desired ! /// orientation. This is only used if the appropriate mode is set. ! Vec3r mDesiredRight; ! /// The damping constant for linear mode. ! real mLinearKd; ! /// The spring constant for linear mode. ! real mLinearKs; ! /// The damping constant for angular mode. ! real mAngularKd; ! /// The spring constant for angular mode. ! real mAngularKs; private: --- 101,140 ---- protected: ! /// Stores data describing the Motor. ! SpringMotorData mData; ! ///// Pointer to the Solid affected by this Motor. ! //Solid* mSolid; ! ///// The Motor's mode of operation. ! //Mode mMode; ! ///// The Motor's desired position. This is only used if the ! ///// appropriate mode is set. ! //Point3r mDesiredPos; ! ///// The Motor's desired forward direction, part of the desired ! ///// orientation. This is only used if the appropriate mode is set. ! //Vec3r mDesiredForward; ! ///// The Motor's desired up direction, part of the desired ! ///// orientation. This is only used if the appropriate mode is set. ! //Vec3r mDesiredUp; ! ///// The Motor's desired right direction, part of the desired ! ///// orientation. This is only used if the appropriate mode is set. ! //Vec3r mDesiredRight; ! ///// The damping constant for linear mode. ! //real mLinearKd; ! ///// The spring constant for linear mode. ! //real mLinearKs; ! ///// The damping constant for angular mode. ! //real mAngularKd; ! ! ///// The spring constant for angular mode. ! //real mAngularKs; private: --- NEW FILE: ServoMotorData.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_SERVO_MOTOR_DATA_H #define OPAL_SERVO_MOTOR_DATA_H #include "Defines.h" #include "MotorData.h" namespace opal { /// The different ServoMotor modes of operation. enum ServoMotorMode { /// The ServoMotor tries to achieve a desired position for /// the Joint axis. DESIRED_POS_MODE, /// The ServoMotor tries to achieve a desired velocity for /// the Joint axis. DESIRED_VEL_MODE }; /// A data structure describing a ServoMotor. class ServoMotorData : public MotorData { public: ServoMotorData() : MotorData() { mType = SERVO_MOTOR; joint = NULL; mode = DESIRED_POS_MODE; jointAxisNum = 0; desiredPos = 0; desiredVel = 0; maxForce = defaults::motor::servo::maxForce; restoreSpeed = defaults::motor::servo::restoreSpeed; } /// Copy constructor. ServoMotorData(const ServoMotorData& data) { (*this) = data; } virtual ~ServoMotorData() { } /// Makes a deep copy. virtual void OPAL_CALL operator=(const ServoMotorData& data) { mType = data.mType; enabled = data.enabled; joint = data.joint; mode = data.mode; jointAxisNum = data.jointAxisNum; desiredPos = data.desiredPos; desiredVel = data.desiredVel; maxForce = data.maxForce; restoreSpeed = data.restoreSpeed; } /// Pointer to the Joint affected by this Motor. Joint* joint; /// The Motor's mode of operation. ServoMotorMode mode; /// The index of the Joint axes affected by this Motor. int jointAxisNum; /// The Motor's desired position. This is only used if the /// appropriate mode is set. real desiredPos; /// The Motor's desired position. This is only used if the /// appropriate mode is set. real desiredVel; /// The maximum amount of force that can be used to help the /// Joint axis achieve its desired position or velocity. real maxForce; /// A constant used in desired position mode that scaled how fast /// the Joint axis will achieve its desired position. real restoreSpeed; protected: private: }; } #endif Index: ServoMotor.h =================================================================== RCS file: /cvsroot/opal/opal/src/ServoMotor.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** ServoMotor.h 18 Feb 2005 23:59:37 -0000 1.19 --- ServoMotor.h 23 Feb 2005 03:58:23 -0000 1.20 *************** *** 32,35 **** --- 32,36 ---- #include "Motor.h" #include "Joint.h" + #include "ServoMotorData.h" namespace opal *************** *** 44,59 **** { public: - /// The different ServoMotor modes of operation. - enum Mode - { - /// The ServoMotor tries to achieve a desired position for - /// the Joint axis. - DESIRED_POS_MODE, - - /// The ServoMotor tries to achieve a desired velocity for - /// the Joint axis. - DESIRED_VEL_MODE - }; - ServoMotor(); --- 45,48 ---- *************** *** 63,67 **** /// enable the Motor. Calling this more than once will detach the /// Motor from its Joint and attach it to a new Joint. ! virtual void OPAL_CALL init(Mode m, Joint* j, int axisNum); virtual void OPAL_CALL setEnabled(bool e); --- 52,64 ---- /// enable the Motor. Calling this more than once will detach the /// Motor from its Joint and attach it to a new Joint. ! //virtual void OPAL_CALL init(Mode m, Joint* j, int axisNum); ! ! /// Initializes the Motor with the given data structure. ! virtual void OPAL_CALL init(const ServoMotorData& data); ! ! /// Returns all data describing the Motor. ! virtual const ServoMotorData& OPAL_CALL getMotorData(); ! ! virtual bool OPAL_CALL isEnabled()const; virtual void OPAL_CALL setEnabled(bool e); *************** *** 104,131 **** protected: ! /// Pointer to the Joint affected by this Motor. ! Joint* mJoint; ! /// The Motor's mode of operation. ! Mode mMode; ! /// The index of the Joint axes affected by this Motor. ! int mJointAxis; ! /// The Motor's desired position. This is only used if the ! /// appropriate mode is set. ! real mDesiredPos; ! ! /// The Motor's desired position. This is only used if the ! /// appropriate mode is set. ! real mDesiredVel; ! /// The maximum amount of force that can be used to help the ! /// Joint axis achieve its desired position or velocity. ! real mMaxForce; ! /// A constant used in desired position mode that scaled how fast ! /// the Joint axis will achieve its desired position. ! real mRestoreSpeed; private: --- 101,131 ---- protected: ! /// Stores data describing the Motor. ! ServoMotorData mData; ! ///// Pointer to the Joint affected by this Motor. ! //Joint* mJoint; ! ///// The Motor's mode of operation. ! //Mode mMode; ! ///// The index of the Joint axes affected by this Motor. ! //int mJointAxis; ! ///// The Motor's desired position. This is only used if the ! ///// appropriate mode is set. ! //real mDesiredPos; ! // ! ///// The Motor's desired position. This is only used if the ! ///// appropriate mode is set. ! //real mDesiredVel; ! ///// The maximum amount of force that can be used to help the ! ///// Joint axis achieve its desired position or velocity. ! //real mMaxForce; ! ! ///// A constant used in desired position mode that scaled how fast ! ///// the Joint axis will achieve its desired position. ! //real mRestoreSpeed; private: Index: ThrusterMotor.h =================================================================== RCS file: /cvsroot/opal/opal/src/ThrusterMotor.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ThrusterMotor.h 18 Feb 2005 23:59:37 -0000 1.5 --- ThrusterMotor.h 23 Feb 2005 03:58:23 -0000 1.6 *************** *** 31,34 **** --- 31,35 ---- #include "Defines.h" #include "Motor.h" + #include "ThrusterMotorData.h" namespace opal *************** *** 40,44 **** class ThrusterMotor : public Motor { - public: ThrusterMotor(); --- 41,44 ---- *************** *** 49,53 **** /// Calling this more than once will detach the Motor from its Solid /// and attach it to a new Solid. ! virtual void OPAL_CALL init(Solid* solid); /// Sets the Force applied by this Motor every time step. --- 49,63 ---- /// Calling this more than once will detach the Motor from its Solid /// and attach it to a new Solid. ! //virtual void OPAL_CALL init(Solid* solid); ! ! /// Initializes the Motor with the given data structure. ! virtual void OPAL_CALL init(const ThrusterMotorData& data); ! ! /// Returns all data describing the Motor. ! virtual const ThrusterMotorData& OPAL_CALL getMotorData(); ! ! virtual bool OPAL_CALL isEnabled()const; ! ! virtual void OPAL_CALL setEnabled(bool e); /// Sets the Force applied by this Motor every time step. *************** *** 62,70 **** protected: /// Pointer to the Solid affected by this Motor. ! Solid* mSolid; /// The Force that gets applied to the Solid every time step. ! Force mForce; private: --- 72,83 ---- protected: + /// Stores data describing the Motor. + ThrusterMotorData mData; + /// Pointer to the Solid affected by this Motor. ! //Solid* mSolid; /// The Force that gets applied to the Solid every time step. ! //Force mForce; private: Index: Blueprint.h =================================================================== RCS file: /cvsroot/opal/opal/src/Blueprint.h,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Blueprint.h 22 Feb 2005 01:25:55 -0000 1.20 --- Blueprint.h 23 Feb 2005 03:58:23 -0000 1.21 *************** *** 50,56 **** virtual const std::string& OPAL_CALL getName()const; ! //virtual void OPAL_CALL addSolid(const SolidDescription& sd); ! //virtual void OPAL_CALL addJoint(const JointData& jd); virtual void OPAL_CALL addSpace(const SpaceDescription& sd); --- 50,56 ---- virtual const std::string& OPAL_CALL getName()const; ! //virtual void OPAL_CALL addSolid(const SolidDescription& data); ! //virtual void OPAL_CALL addJoint(const JointData& data); virtual void OPAL_CALL addSpace(const SpaceDescription& sd); Index: Solid.h =================================================================== RCS file: /cvsroot/opal/opal/src/Solid.h,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** Solid.h 22 Feb 2005 01:25:55 -0000 1.74 --- Solid.h 23 Feb 2005 03:58:23 -0000 1.75 *************** *** 116,120 **** // /// Copy constructor. ! // ShapeData(const ShapeData& sd) // { // (*this) = sd; --- 116,120 ---- // /// Copy constructor. ! // ShapeData(const ShapeData& data) // { // (*this) = sd; *************** *** 122,134 **** // /// Makes a deep copy. ! // void operator=(const ShapeData& sd) // { ! // type = sd.type; ! // offset = sd.offset; ! // material = sd.material; // for (int i=0; i<globals::numShapeDimensions; ++i) // { ! // dimensions[i] = sd.dimensions[i]; // } // } --- 122,134 ---- // /// Makes a deep copy. ! // void operator=(const ShapeData& data) // { ! // type = data.type; ! // offset = data.offset; ! // material = data.material; // for (int i=0; i<globals::numShapeDimensions; ++i) // { ! // dimensions[i] = data.dimensions[i]; // } // } *************** *** 174,180 **** // /// Copy constructor. ! // SolidData(const SolidData& sd) // { ! // (*this) = sd; // } --- 174,180 ---- // /// Copy constructor. ! // SolidData(const SolidData& data) // { ! // (*this) = data; // } *************** *** 187,191 **** // /// Makes a deep copy. ! // void operator=(const SolidData& sd) // { // enabled = sd.enabled; --- 187,191 ---- // /// Makes a deep copy. ! // void operator=(const SolidData& data) // { // enabled = sd.enabled; *************** *** 304,308 **** /// Adds a Shape to this Solid. ! virtual void OPAL_CALL addShape(const ShapeData& sd) = 0; ///// Adds a box Shape to this Solid. --- 304,308 ---- /// Adds a Shape to this Solid. ! virtual void OPAL_CALL addShape(const ShapeData& data) = 0; ///// Adds a box Shape to this Solid. Index: SolidData.h =================================================================== RCS file: /cvsroot/opal/opal/src/SolidData.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SolidData.h 22 Feb 2005 19:46:30 -0000 1.2 --- SolidData.h 23 Feb 2005 03:58:23 -0000 1.3 *************** *** 52,58 **** /// Copy constructor. ! SolidData(const SolidData& sd) { ! (*this) = sd; } --- 52,58 ---- /// Copy constructor. ! SolidData(const SolidData& data) { ! (*this) = data; } *************** *** 67,85 **** /// Makes a deep copy. ! virtual void OPAL_CALL operator=(const SolidData& sd) { ! enabled = sd.enabled; ! sleeping = sd.sleeping; ! isStatic = sd.isStatic; ! transform = sd.transform; ! globalLinearVel = sd.globalLinearVel; ! globalAngularVel = sd.globalAngularVel; ! linearDamping = sd.linearDamping; ! angularDamping = sd.angularDamping; shapes.clear(); ! for (unsigned int i=0; i<sd.shapes.size(); ++i) { ! shapes.push_back(sd.shapes[i]); } } --- 67,85 ---- /// Makes a deep copy. ! virtual void OPAL_CALL operator=(const SolidData& data) { ! enabled = data.enabled; ! sleeping = data.sleeping; ! isStatic = data.isStatic; ! transform = data.transform; ! globalLinearVel = data.globalLinearVel; ! globalAngularVel = data.globalAngularVel; ! linearDamping = data.linearDamping; ! angularDamping = data.angularDamping; shapes.clear(); ! for (unsigned int i=0; i<data.shapes.size(); ++i) { ! shapes.push_back(data.shapes[i]); } } Index: GearedMotor.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/GearedMotor.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** GearedMotor.cpp 16 Feb 2005 21:22:39 -0000 1.5 --- GearedMotor.cpp 23 Feb 2005 03:58:23 -0000 1.6 *************** *** 34,42 **** : Motor() { ! mJoint = NULL; ! mJointAxisNum = 0; ! mMaxTorque = defaults::motor::geared::maxTorque; ! mMaxVelInverse = (real)1.0 / defaults::motor::geared::maxVelocity; ! mThrottle = 0; } --- 34,38 ---- : Motor() { ! // "mData" will be initialized in its own constructor. } *************** *** 45,59 **** } ! void GearedMotor::init(Joint* joint, int axisNum) { Motor::init(); ! assert(joint->isRotational(axisNum)); ! mJoint = joint; ! mJointAxisNum = axisNum; } void GearedMotor::internal_update() { ! if (mEnabled) { // Global/local direction makes no difference here since --- 41,82 ---- } ! //void GearedMotor::init(Joint* joint, int axisNum) ! //{ ! // Motor::init(); ! // assert(joint->isRotational(axisNum)); ! // mJoint = joint; ! // mJointAxisNum = axisNum; ! //} ! ! void GearedMotor::init(const GearedMotorData& data) { Motor::init(); ! assert(data.joint->isRotational(data.jointAxisNum)); ! mData = data; ! } ! ! const GearedMotorData& GearedMotor::getMotorData() ! { ! return mData; ! } ! ! bool GearedMotor::isEnabled()const ! { ! return mData.enabled; ! } ! ! void GearedMotor::setEnabled(bool e) ! { ! if (!mInitCalled) ! { ! return; ! } ! ! mData.enabled = e; } void GearedMotor::internal_update() { ! if (mData.enabled) { // Global/local direction makes no difference here since *************** *** 63,70 **** // will be an opposing torque at any velocity. ! real normalizedVel = mJoint->getVelocity(mJointAxisNum) ! * mMaxVelInverse; ! real magnitude = mMaxTorque * (mThrottle - normalizedVel); ! mJoint->addTorque(mJointAxisNum, magnitude, 0, true); } } --- 86,95 ---- // will be an opposing torque at any velocity. ! real normalizedVel = ! mData.joint->getVelocity(mData.jointAxisNum) / ! mData.maxVelocity; ! real magnitude = mData.maxTorque * (mData.throttle - ! normalizedVel); ! mData.joint->addTorque(mData.jointAxisNum, magnitude, 0, true); } } *************** *** 72,81 **** void GearedMotor::setMaxTorque(real max) { ! mMaxTorque = max; } real GearedMotor::getMaxTorque()const { ! return mMaxTorque; } --- 97,106 ---- void GearedMotor::setMaxTorque(real max) { ! mData.maxTorque = max; } real GearedMotor::getMaxTorque()const { ! return mData.maxTorque; } *************** *** 83,92 **** { assert(max != 0); ! mMaxVelInverse = (real)1.0 / max; } real GearedMotor::getMaxVelocity()const { ! return (real)1.0 / mMaxVelInverse; } --- 108,117 ---- { assert(max != 0); ! mData.maxVelocity = max; } real GearedMotor::getMaxVelocity()const { ! return mData.maxVelocity; } *************** *** 94,108 **** { assert(throttle >= -1.0 && throttle <= 1.0); ! mThrottle = throttle; } real GearedMotor::getThrottle()const { ! return mThrottle; } bool GearedMotor::internal_dependsOn(Joint* joint) { ! if (joint == mJoint) { return true; --- 119,133 ---- { assert(throttle >= -1.0 && throttle <= 1.0); ! mData.throttle = throttle; } real GearedMotor::getThrottle()const { ! return mData.throttle; } bool GearedMotor::internal_dependsOn(Joint* joint) { ! if (joint == mData.joint) { return true; --- NEW FILE: SensorData.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_DATA_H #define OPAL_SENSOR_DATA_H #include "Defines.h" namespace opal { /// The types of Sensors currently available. enum SensorType { VELOCITY_SENSOR, ACCELERATION_SENSOR }; /// A data structure describing a Sensor. class SensorData { public: SensorData() { // The initial type doesn't matter since the abstract base // class will never be instantiated. mType = VELOCITY_SENSOR; } virtual ~SensorData() { } /// Returns the Sensor's type. virtual SensorData OPAL_CALL getType()const { return mType; } protected: /// The Sensor type. SensorType mType; private: }; } #endif Index: AttractorMotor.h =================================================================== RCS file: /cvsroot/opal/opal/src/AttractorMotor.h,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** AttractorMotor.h 18 Feb 2005 23:59:36 -0000 1.21 --- AttractorMotor.h 23 Feb 2005 03:58:23 -0000 1.22 *************** *** 31,34 **** --- 31,35 ---- #include "Defines.h" #include "Motor.h" + #include "AttractorMotorData.h" namespace opal *************** *** 50,54 **** /// enable the Motor. Calling this more than once will detach the /// Motor from its Solids and attach it to new Solids. ! virtual void OPAL_CALL init(Solid* solid0, Solid* solid1); /// Sets the strength parameter. --- 51,65 ---- /// enable the Motor. Calling this more than once will detach the /// Motor from its Solids and attach it to new Solids. ! //virtual void OPAL_CALL init(Solid* solid0, Solid* solid1); ! ! /// Initializes the Motor with the given data structure. ! virtual void OPAL_CALL init(const AttractorMotorData& data); ! ! /// Returns all data describing the Motor. ! virtual const AttractorMotorData& OPAL_CALL getMotorData(); ! ! virtual bool OPAL_CALL isEnabled()const; ! ! virtual void OPAL_CALL setEnabled(bool e); /// Sets the strength parameter. *************** *** 69,77 **** protected: /// Pointer to Solid 0. ! Solid* mSolid0; /// Pointer to Solid 1. ! Solid* mSolid1; /// Cached copy of Solid 0's mass. --- 80,91 ---- protected: + /// Stores data describing the Motor. + AttractorMotorData mData; + /// Pointer to Solid 0. ! //Solid* mSolid0; /// Pointer to Solid 1. ! //Solid* mSolid1; /// Cached copy of Solid 0's mass. *************** *** 82,86 **** /// Constant used to scale attraction (repulsion if strength < 0). ! real mStrength; /// Cached copy of strength * m0 * m1. --- 96,100 ---- /// Constant used to scale attraction (repulsion if strength < 0). ! //real mStrength; /// Cached copy of strength * m0 * m1. *************** *** 88,92 **** /// Determines exponential relationship of attraction/repulsion. ! real mExponent; private: --- 102,106 ---- /// Determines exponential relationship of attraction/repulsion. ! //real mExponent; private: Index: ThrusterMotor.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ThrusterMotor.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ThrusterMotor.cpp 16 Feb 2005 21:22:41 -0000 1.4 --- ThrusterMotor.cpp 23 Feb 2005 03:58:23 -0000 1.5 *************** *** 35,40 **** : Motor() { ! mSolid = NULL; ! // "mForce" is initialized in its own constructor. } --- 35,39 ---- : Motor() { ! // "mData" will be initialized in its own constructor. } *************** *** 43,57 **** } ! void ThrusterMotor::init(Solid* solid) { Motor::init(); ! mSolid = solid; } void ThrusterMotor::internal_update() { ! if (mEnabled) { ! mSolid->addForce(mForce); } } --- 42,82 ---- } ! //void ThrusterMotor::init(Solid* solid) ! //{ ! // Motor::init(); ! // mSolid = solid; ! //} ! ! void ThrusterMotor::init(const ThrusterMotorData& data) { Motor::init(); ! mData = data; ! } ! ! const ThrusterMotorData& ThrusterMotor::getMotorData() ! { ! return mData; ! } ! ! bool ThrusterMotor::isEnabled()const ! { ! return mData.enabled; ! } ! ! void ThrusterMotor::setEnabled(bool e) ! { ! if (!mInitCalled) ! { ! return; ! } ! ! mData.enabled = e; } void ThrusterMotor::internal_update() { ! if (mData.enabled) { ! mData.solid->addForce(mData.force); } } *************** *** 59,73 **** 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; --- 84,98 ---- void ThrusterMotor::setForce(const Force& f) { ! mData.force = f; } const Force& ThrusterMotor::getForce()const { ! return mData.force; } bool ThrusterMotor::internal_dependsOn(Solid* solid) { ! if (solid == mData.solid) { return true; Index: Blueprint.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/Blueprint.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Blueprint.cpp 22 Feb 2005 01:25:55 -0000 1.12 --- Blueprint.cpp 23 Feb 2005 03:58:23 -0000 1.13 *************** *** 65,79 **** //} ! //void Blueprint::addJoint(const JointData& jd) //{ ! // if (jointExists(jd.name)) // { // std::cout << "Warning in opal::Blueprint::addJoint: Joint " << ! // jd.name << " already exists in Blueprint " << mName // << "; ignoring Joint" << std::endl; // } // else // { ! // mJointMap[jd.name] = jd; // } //} --- 65,79 ---- //} ! //void Blueprint::addJoint(const JointData& data) //{ ! // if (jointExists(data.name)) // { // std::cout << "Warning in opal::Blueprint::addJoint: Joint " << ! // data.name << " already exists in Blueprint " << mName // << "; ignoring Joint" << std::endl; // } // else // { ! // mJointMap[data.name] = data; // } //} Index: GearedMotor.h =================================================================== RCS file: /cvsroot/opal/opal/src/GearedMotor.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** GearedMotor.h 18 Feb 2005 23:59:37 -0000 1.5 --- GearedMotor.h 23 Feb 2005 03:58:23 -0000 1.6 *************** *** 31,34 **** --- 31,35 ---- #include "Defines.h" #include "Motor.h" + #include "GearedMotorData.h" namespace opal *************** *** 55,59 **** /// than once will detach the Motor from its Joint and attach it /// to a new Joint. ! virtual void OPAL_CALL init(Joint* joint, int axisNum); /// Sets the max torque parameter. --- 56,70 ---- /// than once will detach the Motor from its Joint and attach it /// to a new Joint. ! //virtual void OPAL_CALL init(Joint* joint, int axisNum); ! ! /// Initializes the Motor with the given data structure. ! virtual void OPAL_CALL init(const GearedMotorData& data); ! ! /// Returns all data describing the Motor. ! virtual const GearedMotorData& OPAL_CALL getMotorData(); ! ! virtual bool OPAL_CALL isEnabled()const; ! ! virtual void OPAL_CALL setEnabled(bool e); /// Sets the max torque parameter. *************** *** 81,101 **** protected: ! /// Pointer to the Joint affected by this Motor. ! Joint* mJoint; ! /// The index of the specific Joint axis affected by this Motor. ! int mJointAxisNum; ! /// The maximum amount of torque that can be applied to the Joint ! /// axis. ! real mMaxTorque; ! /// The inverse of the maximum velocity that can be achieved by ! /// the Motor. The inverse is cached for faster computations. ! real mMaxVelInverse; ! /// The throttle (i.e. the "gas") affects how much of the available ! /// torque is applied to the Joint axis. ! real mThrottle; private: --- 92,115 ---- protected: ! /// Stores data describing the Motor. ! GearedMotorData mData; ! ///// Pointer to the Joint affected by this Motor. ! //Joint* mJoint; ! ///// The index of the specific Joint axis affected by this Motor. ! //int mJointAxisNum; ! ///// The maximum amount of torque that can be applied to the Joint ! ///// axis. ! //real mMaxTorque; ! ///// The inverse of the maximum velocity that can be achieved by ! ///// the Motor. The inverse is cached for faster computations. ! //real mMaxVelInverse; ! ! ///// The throttle (i.e. the "gas") affects how much of the available ! ///// torque is applied to the Joint axis. ! //real mThrottle; private: Index: Defines.h =================================================================== RCS file: /cvsroot/opal/opal/src/Defines.h,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** Defines.h 22 Feb 2005 01:25:55 -0000 1.57 --- Defines.h 23 Feb 2005 03:58:23 -0000 1.58 *************** *** 102,111 **** 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; --- 102,112 ---- ForceType type; ! /// Specifies how long to apply to force. This will be ignored ! /// if "singleStep" is true. 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; *************** *** 178,187 **** enum JointBreakMode { UNBREAKABLE, ! THRESHOLD, //breaks when force/torque exceeds a threshold ! ACCUMULATED //breaks when enough damage is accumulated }; ! /// The types of Joints currently supported. enum JointType { --- 179,193 ---- enum JointBreakMode { + /// Joint can never break. UNBREAKABLE, ! ! /// Joint breaks when force/torque exceeds a threshold. ! THRESHOLD, ! ! /// Joint breaks when enough damage is accumulated. ! ACCUMULATED }; ! /// The types of Joints currently available. enum JointType { *************** *** 287,290 **** --- 293,297 ---- { const JointType type = HINGE_JOINT; + const bool enabled = false; const real lowLimit = 0; const real highLimit = 0; *************** *** 305,308 **** --- 312,317 ---- namespace motor { + const bool enabled = false; + /// Default parameters used in AttractorMotor creation. namespace attractor Index: Joint.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/Joint.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Joint.cpp 22 Feb 2005 01:25:55 -0000 1.19 --- Joint.cpp 23 Feb 2005 03:58:23 -0000 1.20 *************** *** 47,53 **** } ! void Joint::init(const JointData& jd) { ! mData = jd; } --- 47,53 ---- } ! void Joint::init(const JointData& data) { ! mData = data; } *************** *** 59,63 **** JointType Joint::getType()const { ! return mData.type; } --- 59,63 ---- JointType Joint::getType()const { ! return mData.getType(); } --- NEW FILE: SpringMotorData.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_DATA_H #define OPAL_SPRING_MOTOR_DATA_H #include "Defines.h" #include "MotorData.h" namespace opal { /// The different SpringMotor modes of operation. enum SpringMotorMode { /// Makes the Motor work to achieve a desired position. LINEAR_MODE, /// Makes the Motor work to achieve a desired orientation. ANGULAR_MODE, /// Makes the Motor work to achieve a desired position and /// orientation. LINEAR_AND_ANGULAR_MODE }; /// A data structure describing a SpringMotor. class SpringMotorData : public MotorData { public: SpringMotorData() : MotorData() { mType = SPRING_MOTOR; solid = NULL; mode = LINEAR_MODE; // "desiredPos" is initialized in its own constructor. // "desiredForward" is initialized in its own constructor. // "desiredUp" is initialized in its own constructor. // "desiredRight" is initialized in its own constructor. linearKd = defaults::motor::spring::linearKd; linearKs = defaults::motor::spring::linearKs; angularKd = defaults::motor::spring::angularKd; angularKs = defaults::motor::spring::angularKs; } /// Copy constructor. SpringMotorData(const SpringMotorData& data) { (*this) = data; } virtual ~SpringMotorData() { } /// Makes a deep copy. virtual void OPAL_CALL operator=(const SpringMotorData& data) { mType = data.mType; enabled = data.enabled; solid = data.solid; mode = data.mode; desiredPos = data.desiredPos; desiredForward = data.desiredForward; desiredUp = data.desiredUp; desiredRight = data.desiredRight; linearKd = data.linearKd; linearKs = data.linearKs; angularKd = data.angularKd; angularKs = data.angularKs; } /// Pointer to the Solid affected by this Motor. Solid* solid; /// The Motor's mode of operation. SpringMotorMode mode; /// The Motor's desired position. This is only used if the /// appropriate mode is set. Point3r desiredPos; /// The Motor's desired forward direction, part of the desired /// orientation. This is only used if the appropriate mode is set. Vec3r desiredForward; /// The Motor's desired up direction, part of the desired /// orientation. This is only used if the appropriate mode is set. Vec3r desiredUp; /// The Motor's desired right direction, part of the desired /// orientation. This is only used if the appropriate mode is set. Vec3r desiredRight; /// The damping constant for linear mode. real linearKd; /// The spring constant for linear mode. real linearKs; /// The damping constant for angular mode. real angularKd; /// The spring constant for angular mode. real angularKs; protected: private: }; } #endif --- NEW FILE: MotorData.h... [truncated message content] |