mbsimcontrol 4.0.0 MBSim Control Module

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
53 class GeneralizedRelativeContactPositionSensor : public ContactSensor {
54 public:
55 GeneralizedRelativeContactPositionSensor(const std::string &name="") : ContactSensor(name) { }
56 int getSignalSize() const override;
57 void updateSignal() override;
58 };
59
64 class GeneralizedRelativeContactVelocitySensor : public ContactSensor {
65 public:
66 GeneralizedRelativeContactVelocitySensor(const std::string &name="") : ContactSensor(name) { }
67 int getSignalSize() const override;
68 void updateSignal() override;
69 };
70
75 class GeneralizedContactForceSensor : public ContactSensor {
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
MBSim::Contact
MBSimControl::GeneralizedRelativeContactVelocitySensor
GeneralizedRelativeContactVelocitySensor.
Definition: contact_sensor.h:64
MBSimControl::GeneralizedRelativeContactPositionSensor
GeneralizedRelativeContactPositionSensor.
Definition: contact_sensor.h:53
MBSimControl::GeneralizedContactForceSensor
GeneralizedContactForceSensor.
Definition: contact_sensor.h:75
MBSim::Element::InitStage
InitStage
MBSimControl::Sensor
Sensor.
Definition: sensor.h:31
MBSimControl::ContactSensor
ContactSensor.
Definition: contact_sensor.h:36
MBSim::Element::name
std::string name