ObjectModel.h
Go to the documentation of this file.
1 #ifndef OBJECT_TRACKER_OBJECTMODEL_H
2 #define OBJECT_TRACKER_OBJECTMODEL_H
3 
5 
6 #include <std_msgs/String.h>
7 #include <visualization_msgs/MarkerArray.h>
8 
9 #include <list>
10 #include <string>
11 #include <boost/thread/recursive_mutex.hpp>
12 
13 #include <Eigen/Geometry>
14 
15 #include <tf/transform_listener.h>
16 
17 namespace hector_object_tracker {
18 
20 {
21 public:
22  typedef ObjectList::iterator iterator;
23  typedef ObjectList::const_iterator const_iterator;
24 
25 public:
26  ObjectModel(const std::string& frame_id = std::string());
27  ObjectModel(const ObjectModel&);
28  virtual ~ObjectModel();
29 
30  ObjectList getObjects() const;
31  ObjectList getObjects(const std::string& class_id) const;
32  ObjectPtr getObject(const std::string& object_id) const;
33 
34  std_msgs::Header getHeader() const;
35  void setFrameId(const std::string &frame_id);
36 
37  void getMessage(hector_worldmodel_msgs::ObjectModel& model) const;
38  hector_worldmodel_msgs::ObjectModelPtr getMessage() const;
39  void getVisualization(visualization_msgs::MarkerArray &markers) const;
40  void reset();
41 
42  iterator begin() { return objects.begin(); }
43  iterator end() { return objects.end(); }
44  const_iterator begin() const { return objects.begin(); }
45  const_iterator end() const { return objects.end(); }
46 
47  ObjectPtr create(const std::string& class_id = "", const std::string& object_id = "");
48  ObjectPtr add(const std::string& class_id = "", const std::string& object_id = "");
49  ObjectPtr add(ObjectPtr object);
50  void remove(ObjectPtr object);
51  void remove(iterator it);
52 
53  ObjectModel &operator=(const ObjectModel& other);
54  ObjectModel &operator=(const hector_worldmodel_msgs::ObjectModel& other);
55 
56  void lock() const { objectsMutex.lock(); }
57  bool try_lock() const { return objectsMutex.try_lock(); }
58  void unlock() const { objectsMutex.unlock(); }
59 
60  float getBestCorrespondence(ObjectPtr &object, const tf::Pose& pose, const Eigen::Matrix3f& covariance, const std::string& class_id, const std::string& name, float max_distance = 0.0) const;
61 
62  void mergeWith(const ObjectModel& other, tf::TransformListener& tf, const std::string& prefix = std::string());
63  void merge(const ObjectPtr& other, tf::TransformListener& tf, const std::string& prefix = std::string());
64 
65 private:
66  std_msgs::Header header;
68  mutable boost::recursive_mutex objectsMutex;
69 };
70 
71 } // namespace hector_object_tracker
72 
73 #endif // OBJECT_TRACKER_OBJECTMODEL_H
void getVisualization(visualization_msgs::MarkerArray &markers) const
ObjectModel(const std::string &frame_id=std::string())
Definition: ObjectModel.cpp:7
std_msgs::Header getHeader() const
Definition: ObjectModel.cpp:48
void merge(const ObjectPtr &other, tf::TransformListener &tf, const std::string &prefix=std::string())
const_iterator begin() const
Definition: ObjectModel.h:44
hector_worldmodel_msgs::ObjectModelPtr getMessage() const
Definition: ObjectModel.cpp:73
ObjectList::iterator iterator
Definition: ObjectModel.h:22
std::list< ObjectPtr > ObjectList
Definition: types.h:46
boost::recursive_mutex objectsMutex
Definition: ObjectModel.h:68
ObjectList::const_iterator const_iterator
Definition: ObjectModel.h:23
void setFrameId(const std::string &frame_id)
Definition: ObjectModel.cpp:58
float getBestCorrespondence(ObjectPtr &object, const tf::Pose &pose, const Eigen::Matrix3f &covariance, const std::string &class_id, const std::string &name, float max_distance=0.0) const
const_iterator end() const
Definition: ObjectModel.h:45
ObjectModel & operator=(const ObjectModel &other)
ObjectPtr getObject(const std::string &object_id) const
Definition: ObjectModel.cpp:38
ObjectPtr add(const std::string &class_id="", const std::string &object_id="")
Definition: ObjectModel.cpp:86
ObjectPtr create(const std::string &class_id="", const std::string &object_id="")
void mergeWith(const ObjectModel &other, tf::TransformListener &tf, const std::string &prefix=std::string())


hector_object_tracker
Author(s): Johannes Meyer
autogenerated on Mon Jun 10 2019 13:35:13