Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
robotConstantVelocity.hpp
Go to the documentation of this file.
00001 
00012 #ifndef ROBOTCONSTANTVELOCITY_HPP_
00013 #define ROBOTCONSTANTVELOCITY_HPP_
00014 
00015 #include "rtslam/robotAbstract.hpp"
00016 
00017 namespace jafar {
00018   namespace rtslam {
00019 
00020     class RobotConstantVelocity;
00021     typedef boost::shared_ptr<RobotConstantVelocity> robconstvel_ptr_t;
00022 
00023 
00054     class RobotConstantVelocity: public RobotAbstract {
00055       public:
00056 
00057 
00062         RobotConstantVelocity(const map_ptr_t & _mapPtr);
00063 
00064         ~RobotConstantVelocity(void) {
00065         }
00066 
00067         virtual std::string typeName() const {
00068           return "Constant-velocity";
00069         }
00070 
00071 
00085         void move_func(const vec & _x, const vec & _u, const vec & _n, const double _dt, vec & _xnew, mat & _XNEW_x,
00086             mat & _XNEW_pert, unsigned tempSet = 0) const;
00087 
00088         void computePertJacobian();
00089 
00090         static size_t size() {
00091           return 13;
00092         }
00093         static size_t size_control() {
00094           return 0;
00095         }
00096         static size_t size_perturbation() {
00097           return 6;
00098         }
00099 
00100         virtual size_t mySize() {return size();}
00101         virtual size_t mySize_control() {return size_control();}
00102         virtual size_t mySize_perturbation() {return size_perturbation();}
00103 
00104         void setVelocityStd(double velLinStd, double velAngStd){
00105           for (size_t i = pose.size(); i < pose.size() + 3; i++){
00106             state.P(i,i) = velLinStd*velLinStd;
00107           }
00108           for (size_t i = pose.size() + 3; i < pose.size() + 6; i++){
00109             state.P(i,i) = velAngStd*velAngStd;
00110           }
00111         }
00112 
00113         virtual void writeLogHeader(kernel::DataLogger& log) const;
00114         virtual void writeLogData(kernel::DataLogger& log) const;
00115         
00116       protected:
00127         template<class Vx, class Vp, class Vq, class Vv, class Vw>
00128         inline void splitState(const Vx x, Vp & p, Vq & q, Vv & v, Vw & w) const {
00129           p = ublas::subrange(x, 0, 3);
00130           q = ublas::subrange(x, 3, 7);
00131           v = ublas::subrange(x, 7, 10);
00132           w = ublas::subrange(x, 10, 13);
00133         }
00134 
00135 
00146         template<class Vp, class Vq, class Vv, class Vw, class Vx>
00147         inline void unsplitState(const Vp & p, const Vq & q, const Vv & v, const Vw & w, Vx & x) const {
00148           ublas::subrange(x, 0, 3) = p;
00149           ublas::subrange(x, 3, 7) = q;
00150           ublas::subrange(x, 7, 10) = v;
00151           ublas::subrange(x, 10, 13) = w;
00152         }
00153 
00154 
00162         template<class Vu, class V>
00163         inline void splitControl(const Vu & u, V & vi, V & wi) const {
00164           vi = project(u, ublas::range(0, 3));
00165           wi = project(u, ublas::range(3, 6));
00166         }
00167 
00168       private:
00169         // temporary matrices to speed up Jacobian computation
00170         struct TempVariables
00171         {
00172           mat33 PNEW_v; 
00173           mat43 QWDT_wdt; 
00174           mat44 QNEW_qwdt; 
00175           mat43 QNEW_wdt; 
00176           mat44 QNEW_q; 
00177           mat44 QNORM_qnew; 
00178         };
00179         mutable TempVariables tempvars0, tempvars1;
00180 
00181     };
00182   }
00183 }
00184 
00185 #endif /* ROBOTCONSTANTVELOCITY_HPP_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Wed Oct 15 2014 00:37:27 for Jafar by doxygen 1.7.6.1
LAAS-CNRS