|
mbsimcontrol
4.0.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 #ifdef HAVE_OPENMBVCPPINTERFACE 00027 #include "mbsim/utils/boost_parameters.h" 00028 #include "mbsim/utils/openmbv_utils.h" 00029 #endif 00030 00031 namespace MBSimControl { 00032 00033 class Signal; 00034 00043 class Actuator : public MBSim::LinkMechanics { 00044 public: 00049 Actuator(const std::string &name=""); 00050 00054 virtual ~Actuator() {}; 00055 00056 /* INHERITED INTERFACE OF LINKINTERFACE */ 00057 virtual void updateh(double t, int j=0); 00058 virtual void updateg(double t) {} 00059 virtual void updategd(double t) {}; 00060 /***************************************************/ 00061 00062 /* INHERITED INTERFACE OF EXTRADYNAMICINTERFACE */ 00063 virtual void init(InitStage stage); 00064 /***************************************************/ 00065 00066 /* INHERITED INTERFACE OF LINK */ 00067 virtual void calclaSize(int); 00068 virtual bool isActive() const { return true; } 00069 virtual bool gActiveChanged() { return false; } 00070 virtual bool isSingleValued () const { return true; } 00071 /***************************************************/ 00072 00073 /* GETTER / SETTER */ 00074 void setKOSY(int id) { KOSYID = id; assert(KOSYID >= 0); assert(KOSYID <= 2); } 00075 void setSignal(Signal *signal_) {signal = signal_; } 00076 /***************************************************/ 00077 00082 void connect(MBSim::Frame *frame1, MBSim::Frame *frame2); 00083 00084 #ifdef HAVE_OPENMBVCPPINTERFACE 00085 00086 BOOST_PARAMETER_MEMBER_FUNCTION( (void), enableOpenMBVForce, MBSim::tag, (optional (scaleLength,(double),1)(scaleSize,(double),1)(referencePoint,(OpenMBV::Arrow::ReferencePoint),OpenMBV::Arrow::toPoint)(diffuseColor,(const fmatvec::Vec3&),"[-1;1;1]")(transparency,(double),0))) { 00087 MBSim::OpenMBVArrow ombv(diffuseColor,transparency,OpenMBV::Arrow::toHead,referencePoint,scaleLength,scaleSize); 00088 std::vector<bool> which; which.resize(2, false); 00089 which[1]=true; 00090 LinkMechanics::setOpenMBVForceArrow(ombv.createOpenMBV(), which); 00091 } 00092 00094 BOOST_PARAMETER_MEMBER_FUNCTION( (void), enableOpenMBVMoment, MBSim::tag, (optional (scaleLength,(double),1)(scaleSize,(double),1)(referencePoint,(OpenMBV::Arrow::ReferencePoint),OpenMBV::Arrow::toPoint)(diffuseColor,(const fmatvec::Vec3&),"[-1;1;1]")(transparency,(double),0))) { 00095 MBSim::OpenMBVArrow ombv(diffuseColor,transparency,OpenMBV::Arrow::toDoubleHead,referencePoint,scaleLength,scaleSize); 00096 std::vector<bool> which; which.resize(2, false); 00097 which[1]=true; 00098 LinkMechanics::setOpenMBVMomentArrow(ombv.createOpenMBV(), which); 00099 } 00100 #endif 00101 00105 void setForceDirection(const fmatvec::Mat& fd); 00106 00110 void setMomentDirection(const fmatvec::Mat& md); 00111 00112 void initializeUsingXML(xercesc::DOMElement *element); 00113 00114 protected: 00118 fmatvec::Index IT, IR; 00119 00123 fmatvec::Mat3xV forceDir, momentDir; 00124 00128 Signal * signal; 00129 00133 int KOSYID; 00134 00138 MBSim::Frame *refFrame; 00139 00143 MBSim::Frame C; 00144 00145 private: 00146 std::string saved_inputSignal, saved_ref1, saved_ref2; 00147 00148 }; 00149 } 00150 00151 #endif 00152
1.8.0