state-observation 1.8.0
General implementation of observers.
Loading...
Searching...
No Matches
Contact.hpp
1#ifndef CONTACTHPP
2#define CONTACTHPP
3#include <boost/assert.hpp>
4#include <Eigen/Core>
5#include <string>
6#include <string_view>
7
8namespace stateObservation::measurements
9{
13
14struct Contact
15{
16 // constructor if the contact is not associated to a surface
17 inline Contact(unsigned id, std::string_view surfaceName) : id_(id), surface_(surfaceName) {}
18
19protected:
20 inline Contact() = default;
21 inline bool operator<(const Contact & rhs) const noexcept
22 {
23 return (id() < rhs.id_);
24 }
25
26public:
27 virtual void resetContact() noexcept
28 {
29 wasAlreadySet_ = false;
30 isSet_ = false;
31 }
32
33 inline unsigned id() const noexcept
34 {
35 return id_;
36 }
37
38 inline const std::string & surfaceName() const noexcept
39 {
40 return surface_;
41 }
42 inline bool isSet() const noexcept
43 {
44 return isSet_;
45 }
46 inline bool wasAlreadySet() const noexcept
47 {
48 return wasAlreadySet_;
49 }
50
51 inline void isSet(bool isSet)
52 {
53 isSet_ = isSet;
54 }
55 inline void wasAlreadySet(bool wasAlreadySet)
56 {
57 wasAlreadySet_ = wasAlreadySet;
58 }
59
60protected:
61 unsigned id_ = 0;
62
63 bool isSet_ = false;
64 bool wasAlreadySet_ = false;
65 std::string surface_;
66};
67} // namespace stateObservation::measurements
68
69#endif // CONTACTHPP