GCOP  1.0
body3dcost.h
Go to the documentation of this file.
00001 // This file is part of libgcop, a library for Geometric Control, Optimization, and Planning (GCOP)
00002 //
00003 // Copyright (C) 2004-2014 Marin Kobilarov <marin(at)jhu.edu>
00004 //
00005 // This Source Code Form is subject to the terms of the Mozilla
00006 // Public License v. 2.0. If a copy of the MPL was not distributed
00007 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008 
00009 #ifndef GCOP_BODY3DCOST_H
00010 #define GCOP_BODY3DCOST_H
00011 
00012 #include "body3d.h"
00013 #include "lqcost.h"
00014 
00015 namespace gcop {
00016   
00017   using namespace std;
00018   using namespace Eigen;
00019 
00025   template <int c = 6> class Body3dCost : public LqCost<Body3dState, 12, c, Dynamic, 6> {
00026     
00027     typedef Matrix<double, c, 1> Vectorcd;
00028     typedef Matrix<double, c, c> Matrixcd;
00029     typedef Matrix<double, 6, c> Matrix6xcd;
00030     typedef Matrix<double, 12, c> Matrix12xcd;
00031     
00032   public:
00033     
00034     Body3dCost(Body3d<c> &sys, double tf, const Body3dState &xf, bool diag = true);
00035   };  
00036   
00037   template <int c> Body3dCost<c>::Body3dCost(Body3d<c> &sys, double tf, const Body3dState &xf, bool diag) : 
00038     LqCost<Body3dState, 12, c, Dynamic, 6>(sys, tf, xf, diag) {
00039 
00040     this->Qf(0,0) = .5;
00041     this->Qf(1,1) = .5;
00042     this->Qf(2,2) = .5;
00043     this->Qf(3,3) = 5;
00044     this->Qf(4,4) = 5;
00045     this->Qf(5,5) = 5;
00046     
00047     this->Qf(6,6) = .1;
00048     this->Qf(7,7) = .1;
00049     this->Qf(8,8) = .1;
00050     this->Qf(9,9) = 1;
00051     this->Qf(10,10) = 1;
00052     this->Qf(11,11) = 1;
00053     
00054     this->R.diagonal() = Matrix<double, c, 1>::Constant(.1);
00055   }
00056 }
00057 
00058 
00059 #endif