00001
00012 #ifndef ROBOTCENTEREDCONSTANTVELOCITY_HPP_
00013 #define ROBOTCENTEREDCONSTANTVELOCITY_HPP_
00014
00015 #include "rtslam/robotAbstract.hpp"
00016
00017 namespace jafar {
00018 namespace rtslam {
00019
00020 class RobotCenteredConstantVelocity;
00021 typedef boost::shared_ptr<RobotCenteredConstantVelocity> robcenteredconstvel_ptr_t;
00022
00023
00035 class RobotCenteredConstantVelocity: public RobotAbstract {
00036 public:
00037
00038
00043 RobotCenteredConstantVelocity(const map_ptr_t & _mapPtr);
00044
00045 ~RobotCenteredConstantVelocity(void) {
00046 }
00047
00048 virtual std::string typeName() const {
00049 return "Centered-Constant-velocity";
00050 }
00051
00052 void getFrameForReframing(vec7 & frame) ;
00053
00067 void move_func(const vec & _x, const vec & _u, const vec & _n, const double _dt, vec & _xnew, mat & _XNEW_x,
00068 mat & _XNEW_pert, unsigned tempSet = 0) const;
00069
00070 void computePertJacobian();
00071
00089 static size_t size() {
00090 int size_x_Rk_Rkm1 = 13 ;
00091 int size_x_B_Rkm1 = 7 ;
00092 return size_x_Rk_Rkm1 + size_x_B_Rkm1 ;
00093 }
00094 static size_t size_control() {
00095 return 0;
00096 }
00097 static size_t size_perturbation() {
00098 return 6;
00099 }
00100
00101 virtual size_t mySize() {return size();}
00102 virtual size_t mySize_control() {return size_control();}
00103 virtual size_t mySize_perturbation() {return size_perturbation();}
00104
00111 void setVelocityStd(double velLinStd, double velAngStd){
00112 for (size_t i = pose.size(); i < pose.size() + 3; i++){
00113 state.P(i,i) = velLinStd*velLinStd;
00114 }
00115 for (size_t i = pose.size() + 3; i < pose.size() + 6; i++){
00116 state.P(i,i) = velAngStd*velAngStd;
00117 }
00118 }
00119
00120 protected:
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00151 template<class Vx, class Vp, class Vq, class Vv, class Vw>
00152 inline void splitState(const Vx x, Vp & p, Vq & q, Vv & v, Vw & w, Vp & pBase, Vq & qBase) const {
00153 p = ublas::subrange(x, 0, 3);
00154 q = ublas::subrange(x, 3, 7);
00155 v = ublas::subrange(x, 7, 10);
00156 w = ublas::subrange(x, 10, 13);
00157 pBase = ublas::subrange(x, 13, 16);
00158 qBase = ublas::subrange(x, 16, 20);
00159 }
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00192 template<class Vp, class Vq, class Vv, class Vw, class Vx>
00193 inline void unsplitState(const Vp & p, const Vq & q, const Vv & v, const Vw & w, const Vp & pBase, const Vq & qBase, Vx & x) const {
00194 ublas::subrange(x, 0, 3) = p ;
00195 ublas::subrange(x, 3, 7) = q ;
00196 ublas::subrange(x, 7, 10) = v ;
00197 ublas::subrange(x, 10, 13) = w ;
00198 ublas::subrange(x, 13, 16) = pBase;
00199 ublas::subrange(x, 16, 20) = qBase;
00200 }
00201
00202
00210 template<class Vu, class V>
00211 inline void splitControl(const Vu & u, V & vi, V & wi) const {
00212 vi = project(u, ublas::range(0, 3));
00213 wi = project(u, ublas::range(3, 6));
00214 }
00215
00216 private:
00217
00218 struct TempVariables
00219 {
00220 vec7 lastJump;
00221 mat33 PNEW_v;
00222 mat43 QNEW_wdt;
00223
00224
00225
00226
00227
00228 };
00229 mutable TempVariables tempvars0, tempvars1;
00230
00231 };
00232 }
00233 }
00234
00235 #endif