mbsimcontrol  3.0.0
actuator.h
1 /* Copyright (C) 2004-2009 MBSim Development Team
2  *
3  * This library is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU Lesser General Public
5  * License as published by the Free Software Foundation; either
6  * version 2.1 of the License, or (at your option) any later version.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with this library; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16  *
17  * Contact: martin.o.foerg@googlemail.com
18  */
19 
20 #ifndef _ACTUATOR_H_
21 #define _ACTUATOR_H_
22 
23 #include "mbsim/link_mechanics.h"
24 
25 namespace MBSim {
26  class Frame;
27 }
28 
29 namespace MBSimControl {
30 
31  class Signal;
32 
41  class Actuator : public MBSim::LinkMechanics {
42  public:
47  Actuator(const std::string &name);
48 
52  virtual ~Actuator() {};
53 
54  /* INHERITED INTERFACE OF LINKINTERFACE */
55  virtual void updateh(double t, int j=0);
56  virtual void updateg(double t) {}
57  virtual void updategd(double t) {};
58  /***************************************************/
59 
60  /* INHERITED INTERFACE OF EXTRADYNAMICINTERFACE */
61  virtual void init(MBSim::InitStage stage);
62  /***************************************************/
63 
64  /* INHERITED INTERFACE OF LINK */
65  virtual void calclaSize(int);
66  virtual bool isActive() const { return true; }
67  virtual bool gActiveChanged() { return false; }
68  /***************************************************/
69 
70  /* GETTER / SETTER */
71  void setKOSY(int id) { KOSYID = id; assert(KOSYID >= 0); assert(KOSYID <= 2); }
72  void setSignal(Signal *signal_) {signal = signal_; }
73  /***************************************************/
74 
79  void connect(MBSim::Frame *frame1, MBSim::Frame *frame2);
80 
84  void setForceDirection(const fmatvec::Mat& fd);
85 
89  void setMomentDirection(const fmatvec::Mat& md);
90 
91  void initializeUsingXML(TiXmlElement *element);
92 
93  protected:
97  fmatvec::Index IT, IR;
98 
102  fmatvec::Mat forceDir, momentDir;
103 
107  fmatvec::Mat Wf, Wm;
108 
112  fmatvec::Mat WF[2], WM[2];
113 
118 
122  int KOSYID;
123 
124  private:
125  std::string saved_inputSignal, saved_ref1, saved_ref2;
126 
127  };
128 }
129 
130 #endif
131