ObjectModel.h
Go to the documentation of this file.
00001 #ifndef OBJECT_TRACKER_OBJECTMODEL_H
00002 #define OBJECT_TRACKER_OBJECTMODEL_H
00003 
00004 #include <boost/shared_ptr.hpp>
00005 #include <worldmodel_msgs/ObjectModel.h>
00006 #include <worldmodel_msgs/ImagePercept.h>
00007 #include <worldmodel_msgs/PosePercept.h>
00008 #include <std_msgs/String.h>
00009 #include <visualization_msgs/MarkerArray.h>
00010 
00011 #include <list>
00012 #include <string>
00013 #include <boost/thread/recursive_mutex.hpp>
00014 
00015 #include <Eigen/Geometry>
00016 
00017 #include <tf/transform_listener.h>
00018 
00019 namespace hector_object_tracker {
00020 
00021 class Object;
00022 
00023 class ObjectModel
00024 {
00025 public:
00026     typedef boost::shared_ptr<Object> ObjectPtr;
00027     typedef boost::shared_ptr<Object const> ObjectConstPtr;
00028 
00029     typedef std::list<ObjectPtr> ObjectList;
00030     typedef ObjectList::iterator iterator;
00031     typedef ObjectList::const_iterator const_iterator;
00032 
00033 public:
00034     ObjectModel(const std::string& frame_id = std::string());
00035     ObjectModel(const ObjectModel&);
00036     virtual ~ObjectModel();
00037 
00038     ObjectList getObjects() const;
00039     ObjectList getObjects(const std::string& class_id) const;
00040     ObjectPtr getObject(const std::string& object_id) const;
00041 
00042     std_msgs::Header getHeader() const;
00043     void setFrameId(const std::string &frame_id);
00044 
00045     void getMessage(worldmodel_msgs::ObjectModel& model) const;
00046     worldmodel_msgs::ObjectModelPtr getMessage() const;
00047     void getVisualization(visualization_msgs::MarkerArray &markers) const;
00048     void reset();
00049 
00050     iterator begin() { return objects.begin(); }
00051     iterator end()   { return objects.end(); }
00052     const_iterator begin() const { return objects.begin(); }
00053     const_iterator end() const { return objects.end(); }
00054 
00055     ObjectPtr create(const std::string& class_id = "", const std::string& object_id = "");
00056     ObjectPtr add(const std::string& class_id = "", const std::string& object_id = "");
00057     ObjectPtr add(ObjectPtr object);
00058     void remove(ObjectPtr object);
00059     void remove(iterator it);
00060 
00061     ObjectModel &operator=(const ObjectModel& other);
00062     ObjectModel &operator=(const worldmodel_msgs::ObjectModel& other);
00063 
00064     void lock() const { objectsMutex.lock(); }
00065     bool try_lock() const { return objectsMutex.try_lock(); }
00066     void unlock() const { objectsMutex.unlock(); }
00067 
00068     float getBestCorrespondence(ObjectPtr &object, const Eigen::Vector3f& position, const Eigen::Matrix3f& covariance, const std::string& class_id, float max_distance = 0.0) const;
00069 
00070     void mergeWith(const ObjectModel& other, tf::TransformListener& tf, const std::string& prefix = std::string());
00071     void merge(const ObjectPtr& other, tf::TransformListener& tf, const std::string& prefix = std::string());
00072 
00073 private:
00074     std_msgs::Header header;
00075     ObjectList objects;
00076     mutable boost::recursive_mutex objectsMutex;
00077 };
00078 
00079 } // namespace hector_object_tracker
00080 
00081 #endif // OBJECT_TRACKER_OBJECTMODEL_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Friends


hector_object_tracker
Author(s): Johannes Meyer
autogenerated on Mon Jul 15 2013 16:50:57