Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef CDetectableObject_H
00030 #define CDetectableObject_H
00031
00032 #include <mrpt/utils/CSerializable.h>
00033 #include <mrpt/slam/CObservation.h>
00034
00035 #include <mrpt/detectors/link_pragmas.h>
00036
00037 namespace mrpt
00038 {
00039 namespace detectors
00040 {
00041 using namespace mrpt::slam;
00042
00043 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE( CDetectableObject, mrpt::utils::CSerializable, DETECTORS_IMPEXP )
00044
00045
00046
00047
00048
00049
00050 class DETECTORS_IMPEXP CDetectableObject: public mrpt::utils::CSerializable
00051 {
00052 DEFINE_VIRTUAL_SERIALIZABLE( CDetectableObject )
00053
00054 public:
00055
00056 std::string m_id;
00057
00058 CObservationPtr obs;
00059
00060 inline void setObservation( CObservationPtr newObs ){ obs = newObs; };
00061
00062 };
00063
00064
00065 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE( CDetectable2D, mrpt::detectors::CDetectableObject, DETECTORS_IMPEXP )
00066
00067 class DETECTORS_IMPEXP CDetectable2D: public CDetectableObject
00068 {
00069 DEFINE_SERIALIZABLE( CDetectable2D )
00070
00071 public:
00072
00073 float m_x, m_y;
00074 float m_height, m_width;
00075
00076
00077 CDetectable2D( const int &x = 0, const int &y = 0, const int &height = 0, const int &width = 0 )
00078 : m_x(x), m_y(y), m_height(height), m_width(width)
00079 {};
00080
00081
00082 CDetectable2D( const CDetectable2D *d )
00083 {
00084 *this = *d;
00085 };
00086
00087
00088
00089
00090 inline double distanceTo( const CDetectable2D &d2 )
00091 {
00092
00093 double c_x1 = ( m_x + m_width/2 );
00094 double c_x2 = ( d2.m_x + d2.m_width/2 );
00095 double c_y1 = ( m_y + m_height/2 ) ;
00096 double c_y2 = ( d2.m_y + d2.m_height/2 ) ;
00097
00098 return sqrt( pow( c_x1 - c_x2, 2 ) + pow( c_y1 - c_y2, 2 ) );
00099 };
00100
00101 };
00102
00103
00104 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE( CDetectable3D, mrpt::detectors::CDetectable2D, DETECTORS_IMPEXP )
00105
00106 class DETECTORS_IMPEXP CDetectable3D: public CDetectable2D
00107 {
00108 DEFINE_SERIALIZABLE( CDetectable3D )
00109
00110 public:
00111
00112 CDetectable3D(){};
00113
00114 CDetectable3D( const CDetectable2DPtr &object2d )
00115 : CDetectable2D( object2d.pointer() ), m_z(0)
00116 { };
00117
00118
00119 CDetectable3D( const CDetectable3D *d )
00120 {
00121 *this = *d;
00122 };
00123
00124
00125 float m_z;
00126
00127 };
00128 }
00129
00130 }
00131
00132 #endif