|
mbsimcontrol
3.3.0
|
00001 /* Copyright (C) 2004-2009 MBSim Development Team 00002 * 00003 * This library is free software; you can redistribute it and/or 00004 * modify it under the terms of the GNU Lesser General Public 00005 * License as published by the Free Software Foundation; either 00006 * version 2.1 of the License, or (at your option) any later version. 00007 * 00008 * This library is distributed in the hope that it will be useful, 00009 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 * Lesser General Public License for more details. 00012 * 00013 * You should have received a copy of the GNU Lesser General Public 00014 * License along with this library; if not, write to the Free Software 00015 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00016 * 00017 * Contact: martin.o.foerg@googlemail.com 00018 */ 00019 00020 #ifndef _ACTUATOR_H_ 00021 #define _ACTUATOR_H_ 00022 00023 #include "mbsim/link_mechanics.h" 00024 #include "mbsim/frame.h" 00025 00026 namespace MBSimControl { 00027 00028 class Signal; 00029 00038 class Actuator : public MBSim::LinkMechanics { 00039 public: 00044 Actuator(const std::string &name=""); 00045 00049 virtual ~Actuator() {}; 00050 00051 /* INHERITED INTERFACE OF LINKINTERFACE */ 00052 virtual void updateh(double t, int j=0); 00053 virtual void updateg(double t) {} 00054 virtual void updategd(double t) {}; 00055 /***************************************************/ 00056 00057 /* INHERITED INTERFACE OF EXTRADYNAMICINTERFACE */ 00058 virtual void init(MBSim::InitStage stage); 00059 /***************************************************/ 00060 00061 /* INHERITED INTERFACE OF LINK */ 00062 virtual void calclaSize(int); 00063 virtual bool isActive() const { return true; } 00064 virtual bool gActiveChanged() { return false; } 00065 virtual bool isSingleValued () const { return true; } 00066 /***************************************************/ 00067 00068 /* GETTER / SETTER */ 00069 void setKOSY(int id) { KOSYID = id; assert(KOSYID >= 0); assert(KOSYID <= 2); } 00070 void setSignal(Signal *signal_) {signal = signal_; } 00071 /***************************************************/ 00072 00077 void connect(MBSim::Frame *frame1, MBSim::Frame *frame2); 00078 00079 #ifdef HAVE_OPENMBVCPPINTERFACE 00080 00081 void setOpenMBVActuatorForceArrow(OpenMBV::Arrow *arrow) { 00082 std::vector<bool> which; which.resize(2, false); 00083 which[1]=true; 00084 LinkMechanics::setOpenMBVForceArrow(arrow, which); 00085 } 00086 00088 void setOpenMBVActuatorMomentArrow(OpenMBV::Arrow *arrow) { 00089 std::vector<bool> which; which.resize(2, false); 00090 which[1]=true; 00091 LinkMechanics::setOpenMBVMomentArrow(arrow, which); 00092 } 00093 #endif 00094 00098 void setForceDirection(const fmatvec::Mat& fd); 00099 00103 void setMomentDirection(const fmatvec::Mat& md); 00104 00105 void initializeUsingXML(MBXMLUtils::TiXmlElement *element); 00106 00107 protected: 00111 fmatvec::Index IT, IR; 00112 00116 fmatvec::Mat3xV forceDir, momentDir; 00117 00121 Signal * signal; 00122 00126 int KOSYID; 00127 00131 MBSim::Frame *refFrame; 00132 00136 MBSim::Frame C; 00137 00138 private: 00139 std::string saved_inputSignal, saved_ref1, saved_ref2; 00140 00141 }; 00142 } 00143 00144 #endif 00145
1.8.0