state-observation
1.8.0
General implementation of observers.
Toggle main menu visibility
Loading...
Searching...
No Matches
ContactsManager.hpp
1
#ifndef CONTACTSMANAGERHPP
2
#define CONTACTSMANAGERHPP
3
#include <set>
4
#include <state-observation/tools/measurements-manager/Contact.hpp>
5
#include <string>
6
#include <type_traits>
7
#include <unordered_map>
8
9
namespace
stateObservation
10
{
11
namespace
measurements
12
{
17
template
<
typename
ContactT>
18
struct
ContactsManager
19
{
20
21
protected
:
26
template
<
typename
OnAddedContact = std::
nullptr
_t>
27
ContactT &
addContactToManager
(
const
std::string & name, OnAddedContact onAddedContact =
nullptr
);
28
29
public
:
40
template
<
typename
OnNewContact,
41
typename
OnMaintainedContact,
42
typename
OnRemovedContact,
43
typename
OnAddedContact = std::nullptr_t>
44
void
updateContacts
(
const
std::set<std::string> & latestContactList,
45
OnNewContact onNewContact,
46
OnMaintainedContact onMaintainedContact,
47
OnRemovedContact onRemovedContact,
48
OnAddedContact onAddedContact =
nullptr
);
49
53
inline
std::unordered_map<std::string, ContactT> &
contacts
()
54
{
55
return
listContacts_;
56
}
57
59
inline
bool
contactsDetected
() const noexcept
60
{
61
return
contactsDetected_
;
62
}
63
69
ContactT *
findContact
(
const
std::string & name)
70
{
71
auto
it = listContacts_.find(name);
72
if
(it != listContacts_.end())
73
{
74
return
&(it->second);
75
}
76
return
nullptr
;
77
}
78
79
protected
:
80
// map of contacts used by the manager. unordered map containing all the contacts, currently set or not.
81
std::unordered_map<std::string, ContactT> listContacts_;
82
83
// vector containing the name of all the currently set contacts
84
std::set<std::string> currentContactsList_;
85
86
// Index generator, incremented everytime a new contact is created
87
unsigned
idx_ = 0;
89
bool
contactsDetected_
=
false
;
90
};
91
}
// namespace measurements
92
}
// namespace stateObservation
93
94
#include <state-observation/tools/measurements-manager/ContactsManager.hxx>
95
96
#endif
// CONTACTSMANAGERHPP
stateObservation
Filtering of divergent component of motion (DCM) and estimation of a bias betweeen the DCM and the co...
Definition
bidim-elastic-inv-pendulum-dyn-sys.hpp:22
stateObservation::measurements::ContactsManager
Structure that implements all the necessary functions to manage the map of contacts....
Definition
ContactsManager.hpp:19
stateObservation::measurements::ContactsManager::addContactToManager
ContactT & addContactToManager(const std::string &name, OnAddedContact onAddedContact=nullptr)
Insert a contact to the map of contacts.
stateObservation::measurements::ContactsManager< LoContact >::contactsDetected_
bool contactsDetected_
Definition
ContactsManager.hpp:89
stateObservation::measurements::ContactsManager::contactsDetected
bool contactsDetected() const noexcept
Definition
ContactsManager.hpp:59
stateObservation::measurements::ContactsManager::contacts
std::unordered_map< std::string, ContactT > & contacts()
Get the map of all the contacts.
Definition
ContactsManager.hpp:53
stateObservation::measurements::ContactsManager::findContact
ContactT * findContact(const std::string &name)
Accessor for the a contact associated to a surface contained in the map.
Definition
ContactsManager.hpp:69
stateObservation::measurements::ContactsManager::updateContacts
void updateContacts(const std::set< std::string > &latestContactList, OnNewContact onNewContact, OnMaintainedContact onMaintainedContact, OnRemovedContact onRemovedContact, OnAddedContact onAddedContact=nullptr)
Updates the list of contacts to inform whether they are newly set, removed, etc., and execute actions...
include
state-observation
tools
measurements-manager
ContactsManager.hpp
Generated by
1.17.0