All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
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 #include "mbsim/frame.h"
25 
26 #ifdef HAVE_OPENMBVCPPINTERFACE
27 #include "mbsim/utils/boost_parameters.h"
28 #include "mbsim/utils/openmbv_utils.h"
29 #endif
30 
31 namespace MBSimControl {
32 
33  class Signal;
34 
43  class Actuator : public MBSim::LinkMechanics {
44  public:
49  Actuator(const std::string &name="");
50 
54  virtual ~Actuator() {};
55 
56  /* INHERITED INTERFACE OF LINKINTERFACE */
57  virtual void updateh(double t, int j=0);
58  virtual void updateg(double t) {}
59  virtual void updategd(double t) {};
60  /***************************************************/
61 
62  /* INHERITED INTERFACE OF EXTRADYNAMICINTERFACE */
63  virtual void init(InitStage stage);
64  /***************************************************/
65 
66  /* INHERITED INTERFACE OF LINK */
67  virtual void calclaSize(int);
68  virtual bool isActive() const { return true; }
69  virtual bool gActiveChanged() { return false; }
70  virtual bool isSingleValued () const { return true; }
71  /***************************************************/
72 
73  /* GETTER / SETTER */
74  void setKOSY(int id) { KOSYID = id; assert(KOSYID >= 0); assert(KOSYID <= 2); }
75  void setSignal(Signal *signal_) {signal = signal_; }
76  /***************************************************/
77 
82  void connect(MBSim::Frame *frame1, MBSim::Frame *frame2);
83 
84 #ifdef HAVE_OPENMBVCPPINTERFACE
85 
86  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))) {
87  MBSim::OpenMBVArrow ombv(diffuseColor,transparency,OpenMBV::Arrow::toHead,referencePoint,scaleLength,scaleSize);
88  std::vector<bool> which; which.resize(2, false);
89  which[1]=true;
90  LinkMechanics::setOpenMBVForceArrow(ombv.createOpenMBV(), which);
91  }
92 
94  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))) {
95  MBSim::OpenMBVArrow ombv(diffuseColor,transparency,OpenMBV::Arrow::toDoubleHead,referencePoint,scaleLength,scaleSize);
96  std::vector<bool> which; which.resize(2, false);
97  which[1]=true;
98  LinkMechanics::setOpenMBVMomentArrow(ombv.createOpenMBV(), which);
99  }
100 #endif
101 
105  void setForceDirection(const fmatvec::Mat& fd);
106 
110  void setMomentDirection(const fmatvec::Mat& md);
111 
112  void initializeUsingXML(xercesc::DOMElement *element);
113 
114  protected:
119 
123  fmatvec::Mat3xV forceDir, momentDir;
124 
129 
133  int KOSYID;
134 
139 
144 
145  private:
146  std::string saved_inputSignal, saved_ref1, saved_ref2;
147 
148  };
149 }
150 
151 #endif
152 
fmatvec::Mat3xV forceDir
local force and moment direction
Definition: actuator.h:123
void setMomentDirection(const fmatvec::Mat &md)
Definition: actuator.cc:107
fmatvec::Index IT
indices of forces and moments
Definition: actuator.h:118
Signal.
Definition: signal_.h:37
predefines load between two frames with additional possibility of rotation
Definition: actuator.h:43
MBSim::Frame * refFrame
frame of reference the force is defined in
Definition: actuator.h:138
void connect(MBSim::Frame *frame1, MBSim::Frame *frame2)
Definition: actuator.cc:93
Signal * signal
force / moment norm function
Definition: actuator.h:128
void setForceDirection(const fmatvec::Mat &fd)
Definition: actuator.cc:98
int KOSYID
frame index for rotating forces
Definition: actuator.h:133
MBSim::Frame C
own frame located in second partner with same orientation as first partner
Definition: actuator.h:143
virtual ~Actuator()
destructor
Definition: actuator.h:54
Actuator(const std::string &name="")
constructor
Definition: actuator.cc:35

Impressum / Disclaimer / Datenschutz Generated by doxygen 1.8.5 Valid HTML