00001 // rdActuatorSet.h 00002 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00003 // Copyright 2002, 2003 Realistic Dynamics, Inc. 00004 // All rights reserved. 00005 // 00006 // Please do not read, copy, distribute, or use without permission. 00007 // Contact: Frank C. Anderson, fca@RealisticDynamics.com 00008 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00009 #ifndef __rdActuatorSet_h__ 00010 #define __rdActuatorSet_h__ 00011 00012 00013 // INCLUDES 00014 #include <rdPtrArray.h> 00015 #include "rdModel.h" 00016 #include "rdActuator.h" 00017 00018 00019 //============================================================================= 00020 //============================================================================= 00027 class RDSIMULATION_API rdActuatorSet : public rdPtrArray 00028 { 00029 00030 //============================================================================= 00031 // DATA 00032 //============================================================================= 00033 private: 00035 static rdPtrArray _ActuatorTypes; 00036 protected: 00038 rdPtrArray _defaultActuators; 00040 rdModel *_model; 00042 int _nx; 00044 int *_controlsIndex; 00046 int _ny; 00048 int *_statesIndex; 00050 int _nyp; 00052 int *_pseudoIndex; 00053 00054 //============================================================================= 00055 // METHODS 00056 //============================================================================= 00057 //-------------------------------------------------------------------------- 00058 // CONSTRUCTION 00059 //-------------------------------------------------------------------------- 00060 public: 00061 rdActuatorSet(); 00062 rdActuatorSet(const char *aFileName); 00063 virtual ~rdActuatorSet(); 00064 private: 00065 void setNull(); 00066 void constructControlsIndex(); 00067 void constructStatesIndex(); 00068 void constructPseudoStatesIndex(); 00069 void constructDefaultActuators(); 00070 00071 //-------------------------------------------------------------------------- 00072 // GET AND SET 00073 //-------------------------------------------------------------------------- 00074 public: 00075 // MODEL 00076 void setModel(rdModel *aModel); 00077 rdModel* getModel(); 00078 // ACTUATOR 00079 rdActuator* setActuator(rdActuator *aActuator); 00080 rdActuator* setActuator(int aIndex,rdActuator *aActuator); 00081 rdActuator* getActuator(int aIndex) const; 00082 // CONTROLS 00083 int getNX(); 00084 int getControlsIndex(int aWhich); 00085 void setControls(const double aX[]); 00086 void getControls(double rX[]); 00087 // STATES 00088 int getNY(); 00089 int getStatesIndex(int aWhich); 00090 void setStates(const double aY[]); 00091 void getStates(double rY[]); 00092 // PSEUDOSTATES 00093 int getNYP(); 00094 int getPseudoStatesIndex(int aWhich); 00095 void setPseudoStates(const double aY[]); 00096 void getPseudoStates(double rY[]); 00097 00098 //-------------------------------------------------------------------------- 00099 // COMPUTATIONS 00100 //-------------------------------------------------------------------------- 00101 void promoteControlsToStates(const double aX[],double aDT); 00102 void computeActuation(); 00103 void computeStateDerivatives(double rDY[]); 00104 void updatePseudoStates(); 00105 00106 //-------------------------------------------------------------------------- 00107 // APPLICATION 00108 //-------------------------------------------------------------------------- 00109 void apply(); 00110 00111 //-------------------------------------------------------------------------- 00112 // CHECK 00113 //-------------------------------------------------------------------------- 00114 bool check() const; 00115 00116 //-------------------------------------------------------------------------- 00117 // REGISTER SUPPORTED ACTUATOR TYPES 00118 //-------------------------------------------------------------------------- 00119 static void RegisterType(const rdActuator &aActuator); 00120 00121 //-------------------------------------------------------------------------- 00122 // XML 00123 //-------------------------------------------------------------------------- 00124 void updateObject(bool aDeep=true); 00125 void updateNode(bool aDeep=true); 00126 void generateNode(IDOM_Element *aParent); 00127 00128 //============================================================================= 00129 }; // END of class rdActuatorSet 00130 //============================================================================= 00131 //============================================================================= 00132 00133 00134 #endif // __rdActuatorSet_h__ 00135 00136
1.3