All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
frame_sensors.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: markus.ms.schneider@gmail.com
18  */
19 
20 #ifndef _FRAME_SENSORS_H_
21 #define _FRAME_SENSORS_H_
22 
23 #include "mbsimControl/sensor.h"
24 
25 namespace MBSim {
26  class Frame;
27 }
28 
29 namespace MBSimControl {
30 
35  class FrameSensor : public Sensor {
36  public:
37  FrameSensor(const std::string &name) : Sensor(name), frame(nullptr) { }
38  void initializeUsingXML(xercesc::DOMElement *element) override;
39  void init(InitStage stage, const MBSim::InitConfigSet &config) override;
40  void setFrame(MBSim::Frame * frame_) { frame = frame_; }
41  int getSignalSize() const override { return 3; }
42  protected:
43  MBSim::Frame *frame;
44  std::string frameString;
45  };
46 
51  class PositionSensor : public FrameSensor {
52  public:
53  PositionSensor(const std::string &name="") : FrameSensor(name) { }
54  void updateSignal() override;
55  };
56 
61  class OrientationSensor : public FrameSensor {
62  public:
63  OrientationSensor(const std::string &name="") : FrameSensor(name) { }
64  void updateSignal() override;
65  int getSignalSize() const override { return 9; }
66  };
67 
72  class VelocitySensor : public FrameSensor {
73  public:
74  VelocitySensor(const std::string &name="") : FrameSensor(name) { }
75  void updateSignal() override;
76  };
77 
83  public:
84  AngularVelocitySensor(const std::string &name="") : FrameSensor(name) { }
85  void updateSignal() override;
86  };
87 
88 // /*!
89 // * \brief RelativeCoordinateSensor
90 // * \author Markus Schneider
91 // */
92 // class RelativeCoordinateSensor : public Sensor {
93 // public:
94 // RelativeCoordinateSensor(const std::string &name) : Sensor(name), refFrame(NULL), relFrame(NULL), direction(), refFrameString(""), relFrameString("") {}
95 // void initializeUsingXML(xercesc::DOMElement *element);
96 // void init(InitStage stage);
97 // void setReferenceFrame(MBSim::Frame * refFrame_) {refFrame=refFrame_; }
98 // void setRelativeFrame(MBSim::Frame * relFrame_) {relFrame=relFrame_; }
99 // void setDirection(fmatvec::Mat direction_) {
100 // direction=direction_;
101 // for (int i=0; i<direction_.cols(); i++)
102 // direction.col(i)=direction.col(i)/nrm2(direction.col(i));
103 // assert(direction.rows()==3);
104 // }
105 // int getSignalSize() const { return direction.cols(); }
106 // protected:
107 // MBSim::Frame * refFrame;
108 // MBSim::Frame * relFrame;
109 // fmatvec::Mat direction;
110 // std::string refFrameString, relFrameString;
111 // };
112 //
113 // /*!
114 // * \brief RelativePositionSensor
115 // * \author Markus Schneider
116 // */
117 // class RelativePositionSensor : public RelativeCoordinateSensor {
118 // public:
119 // RelativePositionSensor(const std::string &name="") : RelativeCoordinateSensor(name) {}
120 // void updateSignal();
121 // };
122 //
123 // /*!
124 // * \brief RelativeVelocitySensor
125 // * \author Markus Schneider
126 // */
127 // class RelativeVelocitySensor : public RelativeCoordinateSensor {
128 // public:
129 // RelativeVelocitySensor(const std::string &name="") : RelativeCoordinateSensor(name) {}
130 // void updateSignal();
131 // };
132 //
133 // /*!
134 // * \brief RelativeAngularPositionSensor
135 // * \author Markus Schneider
136 // */
137 // class RelativeAngularPositionSensor : public RelativeCoordinateSensor {
138 // public:
139 // RelativeAngularPositionSensor(const std::string &name="") : RelativeCoordinateSensor(name) {}
140 // void updateSignal();
141 //
142 // void calcxSize() {xSize=direction.cols(); }
143 // void init(InitStage stage) {
144 // if (stage==preInit) {
145 // RelativeCoordinateSensor::init(stage, config);
146 // g.resize(direction.cols());
147 // gd.resize(direction.cols());
148 // x.resize(direction.cols());
149 // }
150 // else
151 // RelativeCoordinateSensor::init(stage, config);
152 // }
153 // void updatexd();
154 // };
155 //
156 // /*!
157 // * \brief RelativeAngularVelocitySensor
158 // * \author Markus Schneider
159 // */
160 // class RelativeAngularVelocitySensor : public RelativeCoordinateSensor {
161 // public:
162 // RelativeAngularVelocitySensor(const std::string &name="") : RelativeCoordinateSensor(name) {}
163 // void updateSignal();
164 // };
165 
166 }
167 
168 #endif /* _FRAME_SENSORS_H_ */
AngularVelocitySensor.
Definition: frame_sensors.h:82
OrientationSensor.
Definition: frame_sensors.h:61
FrameSensor.
Definition: frame_sensors.h:35
Sensor.
Definition: sensor.h:31
VelocitySensor.
Definition: frame_sensors.h:72
PositionSensor.
Definition: frame_sensors.h:51

Impressum / Disclaimer / Datenschutz Generated by doxygen 1.8.5 Home