Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

rdCMC_TaskSet.h

00001 // rdCMC_TaskSet.h 00002 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00003 // Copyright (c) 2006 Stanford University and Realistic Dynamics, Inc. 00004 // Contributors: Frank C. Anderson, Ph.D. 00005 // 00006 // Permission is hereby granted, free of charge, to any person obtaining 00007 // a copy of this software and associated documentation files (the 00008 // "Software"), to deal in the Software without restriction, including 00009 // without limitation the rights to use, copy, modify, merge, publish, 00010 // distribute, sublicense, and/or sell copies of the Software, and to 00011 // permit persons to whom the Software is furnished to do so, subject 00012 // to the following conditions: 00013 // 00014 // The above copyright notice and this permission notice shall be included 00015 // in all copies or substantial portions of the Software. 00016 // 00017 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00018 // EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 00019 // WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 00020 // PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS, 00021 // CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 00022 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 00023 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH 00024 // THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00025 // 00026 // This software, originally developed by Realistic Dynamics, Inc., was 00027 // transferred to Stanford University on November 1, 2006. 00028 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00029 #ifndef __rdCMC_TaskSet_h__ 00030 #define __rdCMC_TaskSet_h__ 00031 00032 // INCLUDES 00033 #include "rdCMCDLL.h" 00034 #include <OpenSim/Tools/rdTools.h> 00035 #include <OpenSim/Tools/ArrayPtrs.h> 00036 #include <OpenSim/Simulation/Model/Model.h> 00037 #include "rdCMC_Task.h" 00038 00039 00040 #ifndef SWIG 00041 template class RDCMC_API OpenSim::Set<rdCMC_Task>; 00042 #endif 00043 00044 00045 //============================================================================= 00046 //============================================================================= 00053 class RDCMC_API rdCMC_TaskSet : public OpenSim::Set<rdCMC_Task> 00054 { 00055 00056 //============================================================================= 00057 // MEMBER VARIABLES 00058 //============================================================================= 00059 protected: 00061 OpenSim::Model *_model; 00063 OpenSim::Array<double> _pTask; 00065 OpenSim::Array<double> _vTask; 00067 OpenSim::Array<double> _aTask; 00069 OpenSim::Array<double> _pErrLast; 00071 OpenSim::Array<double> _pErr; 00073 OpenSim::Array<double> _vErrLast; 00075 OpenSim::Array<double> _vErr; 00077 OpenSim::Array<double> _kp; 00079 OpenSim::Array<double> _kv; 00081 OpenSim::Array<double> _ka; 00083 OpenSim::Array<double> _w; 00085 OpenSim::Array<double> _aDes; 00087 OpenSim::Array<double> _a; 00088 00089 //============================================================================= 00090 // METHODS 00091 //============================================================================= 00092 //-------------------------------------------------------------------------- 00093 // CONSTRUCTION 00094 //-------------------------------------------------------------------------- 00095 public: 00096 rdCMC_TaskSet(); 00097 rdCMC_TaskSet(const char *aFileName); 00098 virtual ~rdCMC_TaskSet(); 00099 private: 00100 void setNull(); 00101 void setupProperties(); 00102 00103 //-------------------------------------------------------------------------- 00104 // GET AND SET 00105 //-------------------------------------------------------------------------- 00106 public: 00107 // MODEL 00108 void setModel(OpenSim::Model *aModel); 00109 OpenSim::Model* getModel() const; 00110 // PARAMETERS BASED ON NAME 00111 void setParametersBasedOnName(); 00112 // FUNCTIONS 00113 void setFunctions(OpenSim::FunctionSet &aFuncSet); 00114 void setFunctionsForVelocity(OpenSim::FunctionSet &aFuncSet); 00115 void setFunctionsForAcceleration(OpenSim::FunctionSet &aFuncSet); 00116 // KINEMATICS 00117 OpenSim::Array<double>& getTaskPositions(double aT); 00118 OpenSim::Array<double>& getTaskVelocities(double aT); 00119 OpenSim::Array<double>& getTaskAccelerations(double aT); 00120 // GAINS 00121 OpenSim::Array<double>& getPositionGains(); 00122 OpenSim::Array<double>& getVelocityGains(); 00123 OpenSim::Array<double>& getAccelerationGains(); 00124 // ERRORS 00125 OpenSim::Array<double>& getPositionErrorsLast(); 00126 OpenSim::Array<double>& getPositionErrors(); 00127 OpenSim::Array<double>& getVelocityErrorsLast(); 00128 OpenSim::Array<double>& getVelocityErrors(); 00129 // WEIGHTS 00130 OpenSim::Array<double>& getWeights(); 00131 // DESIRED ACCELERATIONS 00132 OpenSim::Array<double>& getDesiredAccelerations(); 00133 // ACCELERATIONS 00134 OpenSim::Array<double>& getAccelerations(); 00135 00136 //-------------------------------------------------------------------------- 00137 // COMPUTATIONS 00138 //-------------------------------------------------------------------------- 00139 void recordErrorsAsLastErrors(); 00140 void computeErrors(double aT); 00141 void computeDesiredAccelerations(double aT); 00142 void computeDesiredAccelerations(double aTCurrent,double aTFuture); 00143 void computeAccelerations(); 00144 00145 00146 //============================================================================= 00147 }; // END of class rdCMC_TaskSet 00148 //============================================================================= 00149 //============================================================================= 00150 00151 #endif // __rdCMC_TaskSet_h__ 00152 00153

Generated on Wed Nov 1 16:04:31 2006 for Computed Muscle Control (CMC) API by doxygen 1.3.8