Go to the documentation of this file.
39 #include "hri_msgs/IdsList.h"
44 HRIListener::HRIListener() : _reference_frame(
"base_link"), _tf_listener(_tf_buffer)
57 sub.second.shutdown();
64 map<ID, FaceWeakConstPtr> result;
68 for (
auto const&
f :
faces)
70 result[
f.first] =
f.second;
78 map<ID, BodyWeakConstPtr> result;
84 result[
f.first] =
f.second;
92 map<ID, VoiceWeakConstPtr> result;
98 result[
f.first] =
f.second;
106 map<ID, PersonWeakConstPtr> result;
108 vector<PersonConstPtr> aliased;
114 if (
f.second->alias().empty())
116 result[
f.first] =
f.second;
120 aliased.push_back(
f.second);
124 for (
auto const& p : aliased)
126 if (result.count(p->alias()) != 0)
128 result[p->id()] = result[p->alias()];
141 map<ID, PersonWeakConstPtr> result;
143 vector<PersonConstPtr> aliased;
149 if (
f.second->alias().empty())
151 result[
f.first] =
f.second;
155 aliased.push_back(
f.second);
159 for (
auto const& p : aliased)
161 if (result.count(p->alias()) != 0)
163 result[p->id()] = result[p->alias()];
176 ROS_DEBUG(
"Initialising the HRI Listener");
180 "/humans/faces/tracked", 1,
184 "/humans/bodies/tracked", 1,
188 "/humans/voices/tracked", 1,
192 "/humans/persons/tracked", 1,
196 "/humans/persons/known", 1,
206 for (
auto const&
id : tracked->ids)
208 new_ids.insert(
ID(
id));
219 for (
auto const& kv :
faces)
221 current_ids.insert(kv.first);
225 for (
auto const& kv :
bodies)
227 current_ids.insert(kv.first);
231 for (
auto const& kv :
voices)
233 current_ids.insert(kv.first);
239 current_ids.insert(kv.first);
245 current_ids.insert(kv.first);
252 for (
auto id : new_ids)
254 if (current_ids.find(
id) == current_ids.end())
260 for (
auto id : current_ids)
262 if (new_ids.find(
id) == new_ids.end())
264 to_remove.insert(
id);
271 for (
auto id : to_remove)
283 for (
auto id : to_remove)
295 for (
auto id : to_remove)
307 for (
auto id : to_remove)
315 if (p.second->alias() ==
id)
317 aliases.push_back(p.first);
320 for (
auto alias : aliases)
333 for (
auto id : to_remove)
341 if (p.second->alias() ==
id)
343 aliases.push_back(p.first);
346 for (
auto alias : aliases)
363 for (
auto id : to_add)
377 for (
auto id : to_add)
391 for (
auto id : to_add)
405 for (
auto id : to_add)
419 for (
auto id : to_add)
std::vector< std::function< void(PersonConstPtr)> > person_callbacks
std::map< ID, FaceConstPtr > faces
std::vector< std::function< void(BodyWeakConstPtr)> > body_callbacks
std::map< ID, PersonConstPtr > tracked_persons
std::vector< std::function< void(ID)> > body_lost_callbacks
std::vector< std::function< void(ID)> > person_lost_callbacks
std::vector< std::function< void(ID)> > person_tracked_lost_callbacks
std::map< ID, PersonConstPtr > persons
std::map< ID, BodyConstPtr > bodies
std::map< ID, BodyWeakConstPtr > getBodies() const
Returns the list of currently detected bodies, mapped to their IDs.
std::map< ID, PersonWeakConstPtr > getPersons() const
Returns the list of all known persons, whether or not they are currently actively detected (eg,...
std::map< ID, PersonWeakConstPtr > getTrackedPersons() const
Returns the list of currently detected persons, mapped to their IDs.
std::vector< std::function< void(PersonConstPtr)> > person_tracked_callbacks
std::string _reference_frame
std::vector< std::function< void(FaceWeakConstPtr)> > face_callbacks
std::vector< std::function< void(ID)> > voice_lost_callbacks
Subscriber subscribe(const std::string &topic, uint32_t queue_size, const boost::function< void(C)> &callback, const VoidConstPtr &tracked_object=VoidConstPtr(), const TransportHints &transport_hints=TransportHints())
std::map< ID, FaceWeakConstPtr > getFaces() const
Returns the list of currently detected faces, mapped to their IDs.
std::map< FeatureType, ros::Subscriber > feature_subscribers_
std::map< ID, VoiceWeakConstPtr > getVoices() const
Returns the list of currently detected voices, mapped to their IDs.
tf2_ros::Buffer _tf_buffer
std::vector< std::function< void(ID)> > face_lost_callbacks
std::vector< std::function< void(VoiceWeakPtr)> > voice_callbacks
std::map< ID, VoiceConstPtr > voices
void onTrackedFeature(FeatureType feature, hri_msgs::IdsListConstPtr tracked)
libhri
Author(s): Séverin Lemaignan
autogenerated on Thu Jul 6 2023 02:43:58