mbsimcontrol 4.0.0 MBSim Control Module

constraint_sensors.h
1 /* Copyright (C) 2004-2020 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@gmail.com
18 */
19
20 #ifndef _CONSTRAINT_SENSORS_H_
21 #define _CONSTRAINT_SENSORS_H_
22
23 #include "mbsimControl/sensor.h"
24 #include "mbsim/utils/index.h"
25
26 namespace MBSim {
27 class Constraint;
28 }
29
30 namespace MBSimControl {
31
36 class ConstraintSensor : public Sensor {
37 public:
38 ConstraintSensor(const std::string &name) : Sensor(name) { }
39 void initializeUsingXML(xercesc::DOMElement *element) override;
40 void init(InitStage stage, const MBSim::InitConfigSet &config) override;
41 void setConstraint(MBSim::Constraint *constraint_) { constraint = constraint_; }
42 protected:
43 MBSim::Constraint *constraint{nullptr};
44 std::string constraintString;
45 };
46
51 class MechanicalConstraintSensor : public ConstraintSensor {
52 public:
53 MechanicalConstraintSensor(const std::string &name) : ConstraintSensor(name) { }
54 void init(InitStage stage, const MBSim::InitConfigSet &config) override;
55 };
56
61 class MechanicalConstraintForceSensor : public MechanicalConstraintSensor {
62 public:
63 MechanicalConstraintForceSensor(const std::string &name="") : MechanicalConstraintSensor(name) { }
64 void setForceNumber(int i_) { i = i_; }
65 int getSignalSize() const override { return 3; }
66 void updateSignal() override;
67 void initializeUsingXML(xercesc::DOMElement *element) override;
68 protected:
69 MBSim::Index i{0};
70 };
71
76 class MechanicalConstraintMomentSensor : public MechanicalConstraintSensor {
77 public:
78 MechanicalConstraintMomentSensor(const std::string &name="") : MechanicalConstraintSensor(name) { }
79 void setMomentNumber(int i_) { i = i_; }
80 int getSignalSize() const override { return 3; }
81 void updateSignal() override;
82 void initializeUsingXML(xercesc::DOMElement *element) override;
83 protected:
84 MBSim::Index i{0};
85 };
86
87 }
88
89 #endif
MBSimControl::MechanicalConstraintSensor
MechanicalConstraintSensor.
Definition: constraint_sensors.h:51
MBSimControl::ConstraintSensor
ConstraintSensor.
Definition: constraint_sensors.h:36
MBSimControl::MechanicalConstraintForceSensor
MechanicalConstraintForceSensor.
Definition: constraint_sensors.h:61
MBSim::Element::InitStage
InitStage
MBSimControl::Sensor
Sensor.
Definition: sensor.h:31
MBSim::Element::name
std::string name
MBSim::Constraint
MBSimControl::MechanicalConstraintMomentSensor
MechanicalConstraintMomentSensor.
Definition: constraint_sensors.h:76