scene_configurator_data.cpp
Go to the documentation of this file.
1 
18 // Local Include
20 
21 // ISM Inlcude
22 #include <ISM/utility/GeometryHelper.hpp>
23 
24 
25 
26 void SceneConfiguratorData::addEstimation(ISM::ObjectPtr object)
27 {
28  boost::lock_guard<boost::mutex> lock{estimations_mutex_}; //Thread-safety
29 
30  //Look whether object has already been observed and update or add the estimation for this object.
31  bool found = false;
32  for (ObjectEstimationPtrs::iterator it = estimations_.begin(); it != estimations_.end(); ++it)
33  {
34  if (((*it)->object->type == object->type) && ((*it)->object->observedId == object->observedId)
35  && (!enable_neighborhood_evaluation_ || ISM::GeometryHelper::sharedNeighborhoodEvaluation((*it)->object->pose, object->pose, neighbour_distance_threshold_, neighbour_angle_threshold_)))
36  {
37  (*it)->object = object;
38  (*it)->in_view = true;
39  found = true;
40  break;
41  }
42  }
43 
44  if (!found)
45  {
46  estimations_.push_back(ObjectEstimationPtr(new ObjectEstimation(object)));
47  }
48 }
49 
51 {
52  boost::lock_guard<boost::mutex> lock{estimations_mutex_}; //Thread-safety
53 
54  for (ObjectEstimationPtrs::iterator it = estimations_.begin(); it != estimations_.end(); ++it)
55  {
56  (*it)->in_view = false;
57  }
58 }
59 
61 {
62  boost::lock_guard<boost::mutex> lock{estimations_mutex_}; //Thread-safety
63 
64  for (ObjectEstimationPtrs::iterator it = estimations_.begin(); it != estimations_.end(); ++it)
65  {
66  if ((*it)->in_view)
67  {
68  (*it)->marked = marked;
69  }
70  }
71 }
72 
74 {
75  boost::lock_guard<boost::mutex> lock{estimations_mutex_}; //Thread-safety
76 
77  for (ObjectEstimationPtrs::iterator it = estimations_.begin(); it != estimations_.end(); ++it)
78  {
79  (*it)->marked = false;
80  }
81 }
82 
84 {
85  ISM::ObjectSetPtr set(new ISM::ObjectSet());
86 
87  boost::lock_guard<boost::mutex> lock{estimations_mutex_}; //Thread-safety
88 
89  for (ObjectEstimationPtrs::iterator it = estimations_.begin(); it != estimations_.end(); ++it)
90  {
91  if ((*it)->marked)
92  {
93  set->insert(ISM::ObjectPtr(new ISM::Object(*(*it)->object)));
94  }
95  }
96  return set;
97 }
98 
100 {
101  ISM::ObjectSetPtr set(new ISM::ObjectSet());
102 
103  boost::lock_guard<boost::mutex> lock{estimations_mutex_}; //Thread-safety
104 
105  for (ObjectEstimationPtrs::iterator it = estimations_.begin(); it != estimations_.end(); ++it)
106  {
107  set->insert(ISM::ObjectPtr(new ISM::Object(*(*it)->object)));
108  }
109  return set;
110 }
111 
113 {
114  ObjectEstimationPtrs estimations;
115 
116  boost::lock_guard<boost::mutex> lock{estimations_mutex_}; //Thread-safety
117 
118  for (const ObjectEstimationPtr estimation : estimations_)
119  {
120  estimations.push_back(ObjectEstimationPtr(new ObjectEstimation(*estimation)));
121  }
122  return estimations;
123 }
124 
126 {
127  boost::lock_guard<boost::mutex> lock{estimations_mutex_}; //Thread-safety
128  estimations_.clear();
129 }
130 
132 {
133  boost::lock_guard<boost::mutex> lock{estimations_mutex_}; //Thread-safety
134 
135  for (ObjectEstimationPtrs::iterator it = estimations_.begin(); it != estimations_.end(); )
136  {
137  if (!((*it)->marked))
138  {
139  it = estimations_.erase(it);
140  }
141  else
142  {
143  ++it;
144  }
145  }
146 }
ISM::ObjectSetPtr getObjectSetFromAllEstimations()
void addEstimation(ISM::ObjectPtr object)
ObjectEstimationPtrs estimations_
ISM::ObjectSetPtr getObjectSetFromMarkedEstimations()
std::vector< ObjectEstimationPtr > ObjectEstimationPtrs
boost::shared_ptr< ObjectEstimation > ObjectEstimationPtr
void setMarkedForAllEstimationsInView(bool marked)
ObjectEstimationPtrs getAllEstimations()


asr_ism
Author(s): Borella Jocelyn, Hanselmann Fabian, Heller Florian, Heizmann Heinrich, Kübler Marcel, Mehlhaus Jonas, Meißner Pascal, Qattan Mohamad, Reckling Reno, Stroh Daniel
autogenerated on Thu Jan 9 2020 07:20:58