path.h
Go to the documentation of this file.
00001 
00059 /*
00060  * path.h
00061  *
00062  *  Created on: 29.05.2012
00063  *      Author: josh
00064  */
00065 
00066 #ifndef PATH_H_
00067 #define PATH_H_
00068 
00069 #include "way.h"
00070 
00071 namespace Slam  
00072 {
00073 
00074   template<typename NODE>
00075   class Path
00076   {
00077     typedef typename NODE::DOF6 DOF6;
00078     typedef typename NODE::OBJCTXT OBJCTXT;
00079     typedef typename OBJCTXT::OBJECT OBJECT;
00080 
00081     std::vector<SWAY<NODE> > path_;
00082     SWAY<NODE> local_;                        
00083 
00084     OBJCTXT act_ctxt_;                  
00085 
00086     const typename DOF6::TYPE translation_res_, rotation_res_;
00087 
00088     double last_time_;                  
00089 
00097     bool needNewNode()
00098     {
00099       ROS_INFO("pot. tr  movement %f",local_.link_.getTranslation().norm()+local_.link_.getTranslationVariance());
00100       ROS_INFO("pot. rot movement %f",local_.link_.getRotation().norm()+local_.link_.getRotationVariance());
00101       if(
00102           (local_.node_->getNumObjs()>2) &&
00103           (
00104               //translation
00105               (local_.link_.getTranslation().norm()+local_.link_.getTranslationVariance() > translation_res_)
00106               ||
00107               //rotation
00108               (local_.link_.getRotation().norm()+local_.link_.getRotationVariance() > rotation_res_)
00109           )
00110       )
00111         return true;
00112       return false;
00113     }
00114 
00116     void newNode() {
00117       static size_t id = 0;
00118       local_.node_.reset(new NODE());
00119       local_.link_ = DOF6();
00120       local_.id_ = id;
00121       id++;
00122     }
00123 
00124   public:
00125 
00126     Path(const typename DOF6::TYPE &thr_tr, const typename DOF6::TYPE &thr_rot)
00127     :
00128       translation_res_(thr_tr), rotation_res_(thr_rot)
00129     {
00130       newNode();
00131     }
00132 
00133     /*
00134      * 1. start frame (reseting local node)
00135      * 2. add all atom-nodes
00136      * 3. finish it, which will add tf-path between last node and local node
00137      */
00138     void startFrame(const double time_in_sec);
00139     void operator+=(typename OBJECT::Ptr obj);
00140     void finishFrame();
00141 
00142     const SWAY<NODE> &getLocal() const {return local_;}
00143     SWAY<NODE> &getLocal() {return local_;}
00144 
00145     bool getTF(DOF6 &tf, const SWAY<NODE> *start, const SWAY<NODE> *end);
00146 
00147     void test();
00148   };
00149 
00150 #include "impl/path.hpp"
00151 
00152 }
00153 
00154 
00155 #endif /* PATH_H_ */


cob_3d_mapping_slam
Author(s): Joshua Hampp
autogenerated on Wed Aug 26 2015 11:04:51