Object.h
Go to the documentation of this file.
00001 #ifndef OBJECT_TRACKER_OBJECT_H
00002 #define OBJECT_TRACKER_OBJECT_H
00003 
00004 #include <boost/shared_ptr.hpp>
00005 #include <worldmodel_msgs/Object.h>
00006 #include <worldmodel_msgs/constants/ObjectState.h>
00007 #include <visualization_msgs/MarkerArray.h>
00008 #include <tf/transform_listener.h>
00009 
00010 #include <Eigen/Geometry>
00011 
00012 #include <ros/ros.h>
00013 
00014 #include <map>
00015 
00016 namespace hector_object_tracker {
00017 
00018 using namespace worldmodel_msgs;
00019 
00020 class Object;
00021 typedef boost::shared_ptr<Object> ObjectPtr;
00022 typedef boost::shared_ptr<Object const> ObjectConstPtr;
00023 
00024 class Object
00025 {
00026 public:
00027     EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00028 
00029     typedef boost::shared_ptr<Object> Ptr;
00030     typedef boost::shared_ptr<Object const> ConstPtr;
00031     typedef worldmodel_msgs::ObjectState::_state_type StateType;
00032 
00033     Object(const std::string class_id = "", const std::string object_id = "");
00034     Object(const worldmodel_msgs::Object& other);
00035     virtual ~Object();
00036 
00037     static void reset();
00038 
00039     void getMessage(worldmodel_msgs::Object& object) const;
00040     worldmodel_msgs::Object getMessage() const;
00041     void getVisualization(visualization_msgs::MarkerArray &markers) const;
00042 
00043     void getPoseWithCovariance(geometry_msgs::PoseWithCovariance& pose) const;
00044     void setPose(const geometry_msgs::PoseWithCovariance& pose);
00045 
00046     void getPose(geometry_msgs::Pose& pose) const;
00047     void getPose(tf::Pose& pose) const;
00048     void setPose(const geometry_msgs::Pose& pose);
00049     void setPose(const tf::Pose& pose);
00050 
00051     const Eigen::Vector3f& getPosition() const;
00052     void setPosition(const Eigen::Vector3f& position);
00053     void setPosition(const geometry_msgs::Point& position);
00054     void setPosition(const tf::Point& point);
00055 
00056     const Eigen::Quaternionf& getOrientation() const;
00057     void setOrientation(const geometry_msgs::Quaternion& orientation);
00058     void setOrientation(const tf::Quaternion& orientation);
00059 
00060     const Eigen::Matrix3f& getCovariance() const;
00061     void getCovariance(geometry_msgs::PoseWithCovariance::_covariance_type& covariance) const;
00062     void setCovariance(const Eigen::Matrix3f& covariance);
00063     void setCovariance(const tf::Matrix3x3& covariance);
00064     void setCovariance(const geometry_msgs::PoseWithCovariance::_covariance_type& covariance);
00065 
00066     const std::string& getClassId() const {
00067       return this->info.class_id;
00068     }
00069 
00070     const std::string& getObjectId() const {
00071       return this->info.object_id;
00072     }
00073 
00074     void setObjectId(const std::string& object_id) {
00075       this->info.object_id = object_id;
00076     }
00077 
00078     float getSupport() const {
00079       return this->info.support;
00080     }
00081 
00082     void setSupport(float support) {
00083       this->info.support = support;
00084     }
00085 
00086     void addSupport(float support) {
00087       this->info.support += support;
00088     }
00089 
00090     StateType getState() const {
00091       return this->state.state;
00092     }
00093 
00094     void setState(const StateType& state);
00095 
00096     const std::string& getName() const {
00097       return this->info.name;
00098     }
00099 
00100     void setName(const std::string& name) {
00101       this->info.name = name;
00102     }
00103 
00104     std_msgs::Header getHeader() const {
00105       return this->header;
00106     }
00107 
00108     void setHeader(const std_msgs::Header &header) {
00109       this->header = header;
00110     }
00111 
00112     ros::Time getStamp() const {
00113       return this->header.stamp;
00114     }
00115 
00116     void intersect(const Eigen::Vector3f& position, const Eigen::Matrix3f& covariance, float support);
00117     void update(const Eigen::Vector3f& position, const Eigen::Matrix3f& covariance, float support);
00118 
00119     static void setNamespace(const std::string& ns);
00120 
00121     Object& operator=(const worldmodel_msgs::Object& other);
00122 
00123     ObjectPtr transform(tf::Transformer& tf, const std::string& target_frame) const;
00124     ObjectPtr transform(tf::Transformer& tf, const std::string& target_frame, const ros::Time& target_time) const;
00125 
00126 private:
00127     ros::NodeHandle nh;
00128     std_msgs::Header header;
00129     ObjectInfo info;
00130     ObjectState state;
00131 
00132     Eigen::Vector3f position;
00133     Eigen::Quaternionf orientation;
00134     Eigen::Matrix3f covariance;
00135 
00136     static std::map<std::string,unsigned int> object_count;
00137     static std::string object_namespace;
00138 };
00139 
00140 } // namespace hector_object_tracker
00141 
00142 #endif // OBJECT_TRACKER_OBJECT_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:56