mbsimcontrol  4.0.0
MBSim Control Module
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
contact_sensor.h
1 /* Copyright (C) 2004-2018 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 _CONTACT_SENSOR_H_
21 #define _CONTACT_SENSOR_H_
22 
23 #include "mbsimControl/sensor.h"
24 #include "mbsim/utils/index.h"
25 
26 namespace MBSim {
27  class Contact;
28 }
29 
30 namespace MBSimControl {
31 
36  class ContactSensor : public Sensor {
37  public:
38  ContactSensor(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 setContact(MBSim::Contact * contact_) { contact = contact_; }
42  void setSingleContactNumber(int i_) { i = i_; }
43  protected:
44  MBSim::Contact *contact{nullptr};
45  std::string contactString;
46  MBSim::Index i{0};
47  };
48 
54  public:
55  GeneralizedRelativeContactPositionSensor(const std::string &name="") : ContactSensor(name) { }
56  int getSignalSize() const override;
57  void updateSignal() override;
58  };
59 
65  public:
66  GeneralizedRelativeContactVelocitySensor(const std::string &name="") : ContactSensor(name) { }
67  int getSignalSize() const override;
68  void updateSignal() override;
69  };
70 
76  public:
77  GeneralizedContactForceSensor(const std::string &name="") : ContactSensor(name) { }
78  int getSignalSize() const override;
79  void updateSignal() override;
80  };
81 
82 }
83 
84 #endif
GeneralizedRelativeContactVelocitySensor.
Definition: contact_sensor.h:64
GeneralizedRelativeContactPositionSensor.
Definition: contact_sensor.h:53
GeneralizedContactForceSensor.
Definition: contact_sensor.h:75
Sensor.
Definition: sensor.h:31
ContactSensor.
Definition: contact_sensor.h:36