00001
00002
00003 #ifndef SLAM_POSE_COPY_HPP
00004 #define SLAM_POSE_COPY_HPP
00005
00006 #include "jmath/jblas.hpp"
00007
00008 #include "slam/abstractMapManager.hpp"
00009
00010 namespace jafar {
00011 namespace slam {
00012
00013 class SlamEkf;
00014
00018 class PoseCopy : public AbstractMapObject {
00019
00020 public:
00021
00022 PoseCopy(std::size_t sizeState, unsigned int id, unsigned int frameIndex) :
00023 AbstractMapObject(id),
00024 m_sizeState(sizeState),
00025 m_frameIndex(frameIndex),
00026 m_id(id),
00027 m_x(0),
00028 m_xCov(0)
00029 {}
00030
00031 ~PoseCopy()
00032 {
00033 if (m_x) delete m_x;
00034 if (m_xCov) delete m_xCov;
00035 }
00036
00037 std::size_t sizeState() const {return m_sizeState;}
00038 unsigned int frameIndex() const {return m_frameIndex;}
00039
00040 void setState(jblas::vec& x, jblas::sym_mat& P)
00041 {
00042 if (m_x) delete m_x;
00043 if (m_xCov) delete m_xCov;
00044 ublas::range r(filterIndex(), filterIndex()+sizeState());
00045 m_x = new jblas::vec_range(x, r);
00046 m_xCov = new jblas::sym_mat_range(P, r, r);
00047 }
00048
00049 unsigned int id() const {return m_id;}
00050 jblas::vec_range const& x() const {return *m_x;}
00051 jblas::sym_mat_range const& xCov() const {return *m_xCov;}
00052
00053 private:
00054
00055 std::size_t m_sizeState;
00056 unsigned int m_frameIndex;
00057
00058 unsigned int m_id;
00059 jblas::vec_range* m_x;
00060 jblas::sym_mat_range* m_xCov;
00061
00062 friend class SlamEkf;
00063
00064 };
00065
00066 }
00067 }
00068
00069 #endif // SLAM_POSE_COPY_HPP