mbsimcontrol  4.0.0
MBSim Control Module
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
tyre_contact_sensor.h
1 /* Copyright (C) 2004-2022 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 _TYRE_CONTACT_SENSOR_H_
21 #define _TYRE_CONTACT_SENSOR_H_
22 
23 #include "mbsimControl/sensor.h"
24 #include "mbsim/utils/index.h"
25 
26 namespace MBSim {
27  class TyreContact;
28 }
29 
30 namespace MBSimControl {
31 
36  class TyreContactSensor : public Sensor {
37  public:
38  TyreContactSensor(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 setTyreContact(MBSim::TyreContact *contact_) { contact = contact_; }
42  protected:
43  MBSim::TyreContact *contact{nullptr};
44  std::string contactString;
45  };
46 
52  public:
53  TyreContactPositionSensor(const std::string &name="") : TyreContactSensor(name) { }
54  void setPositionNumber(int i_) { i = i_; }
55  int getSignalSize() const override { return 3; }
56  void updateSignal() override;
57  void initializeUsingXML(xercesc::DOMElement *element) override;
58  protected:
59  MBSim::Index i{0};
60  };
61 
67  public:
68  TyreContactOrientationSensor(const std::string &name="") : TyreContactSensor(name) { }
69  void setOrientationNumber(int i_) { i = i_; }
70  int getSignalSize() const override { return 9; }
71  void updateSignal() override;
72  void initializeUsingXML(xercesc::DOMElement *element) override;
73  protected:
74  MBSim::Index i{0};
75  };
76 
82  public:
83  TyreContactVelocitySensor(const std::string &name="") : TyreContactSensor(name) { }
84  void setVelocityNumber(int i_) { i = i_; }
85  int getSignalSize() const override { return 3; }
86  void updateSignal() override;
87  void initializeUsingXML(xercesc::DOMElement *element) override;
88  protected:
89  MBSim::Index i{0};
90  };
91 
97  public:
98  TyreContactAngularVelocitySensor(const std::string &name="") : TyreContactSensor(name) { }
99  void setAngularVelocityNumber(int i_) { i = i_; }
100  int getSignalSize() const override { return 3; }
101  void updateSignal() override;
102  void initializeUsingXML(xercesc::DOMElement *element) override;
103  protected:
104  MBSim::Index i{0};
105  };
106 
112  public:
113  TyreModelSensor(const std::string &name="") : TyreContactSensor(name) { }
114  int getSignalSize() const override;
115  void updateSignal() override;
116  };
117 
118 }
119 
120 #endif
TyreModelSensor.
Definition: tyre_contact_sensor.h:111
TyreContactVelocitySensor.
Definition: tyre_contact_sensor.h:81
TyreContactOrientationSensor.
Definition: tyre_contact_sensor.h:66
TyreContactSensor.
Definition: tyre_contact_sensor.h:36
TyreContactAngularVelocitySensor.
Definition: tyre_contact_sensor.h:96
TyreContactPositionSensor.
Definition: tyre_contact_sensor.h:51
Sensor.
Definition: sensor.h:31