Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
* Copyright 2011, Nicolas Mansard, LAAS-CNRS
*
* This file is part of sot-dyninv.
* sot-dyninv is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
* sot-dyninv is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. You should
* have received a copy of the GNU Lesser General Public License along
* with sot-dyninv. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __sot_dyninv_SolverKine_H__
#define __sot_dyninv_SolverKine_H__
/* --------------------------------------------------------------------- */
/* --- API ------------------------------------------------------------- */
/* --------------------------------------------------------------------- */
#if defined (WIN32)
# if defined (solver_kine_EXPORTS)
# define SOTSOLVERKINE_EXPORT __declspec(dllexport)
# else
# define SOTSOLVERKINE_EXPORT __declspec(dllimport)
# endif
#else
# define SOTSOLVERKINE_EXPORT
#endif
/* --------------------------------------------------------------------- */
/* --- INCLUDE --------------------------------------------------------- */
/* --------------------------------------------------------------------- */
/* SOT */
#include <sot-dyninv/signal-helper.h>
#include <sot-dyninv/entity-helper.h>
#include <sot-dyninv/stack-template.h>
#include <sot-dyninv/task-dyn-pd.h>
#include <soth/HCOD.hpp>
namespace dynamicgraph {
namespace sot {
namespace dyninv {
/* --------------------------------------------------------------------- */
/* --- CLASS ----------------------------------------------------------- */
/* --------------------------------------------------------------------- */
class SOTSOLVERKINE_EXPORT SolverKine
:public ::dynamicgraph::Entity
,public ::dynamicgraph::EntityHelper<SolverKine>
,public sot::Stack< TaskAbstract >
{
public: /* --- CONSTRUCTOR ---- */
SolverKine( const std::string & name );
public: /* --- STACK INHERITANCE --- */
typedef sot::Stack<TaskAbstract> stack_t;
using stack_t::TaskDependancyList_t;
using stack_t::StackIterator_t;
using stack_t::StackConstIterator_t;
using stack_t::stack;
virtual TaskDependancyList_t getTaskDependancyList( const TaskAbstract& task );
virtual void addDependancy( const TaskDependancyList_t& depList );
virtual void removeDependancy( const TaskDependancyList_t& depList );
virtual void resetReady( void );
public: /* --- ENTITY INHERITANCE --- */
static const std::string CLASS_NAME;
virtual void display( std::ostream& os ) const;
virtual const std::string& getClassName( void ) const { return CLASS_NAME; }
virtual void commandLine( const std::string& cmdLine,
std::istringstream& cmdArgs,
std::ostream& os );
public: /* --- SIGNALS --- */
DECLARE_SIGNAL_IN(damping,double);
Francesco Morsillo
committed
DECLARE_SIGNAL_IN(velocity,ml::Vector); //only used for second order kinematics
DECLARE_SIGNAL_OUT(control,ml::Vector);
public: /* --- COMMANDS --- */
void debugOnce( void );
void resetAset( void );
void getDecomposition( const int &stage );
Francesco Morsillo
committed
bool secondOrderKinematics_;
/// Push the task in the stack.
/// Call parent implementation anc check that task is
/// of type dynamic if necessary
virtual void push( TaskAbstract& task );
Francesco Morsillo
committed
void setSecondOrderKinematics ();
private: /* --- INTERNAL COMPUTATIONS --- */
void refreshTaskTime( int time );
bool checkSolverSize( void );
void resizeSolver( void );
void checkDynamicTask (const TaskAbstract& task) const;
private:
typedef boost::shared_ptr<soth::HCOD> hcod_ptr_t;
hcod_ptr_t hsolver;
std::vector< Eigen::MatrixXd > Ctasks;
std::vector< soth::VectorBound > btasks;
Eigen::VectorXd solution;
std::vector<soth::cstref_vector_t> activeSet;
bool relevantActiveSet;
bool ddxdriftInit_;
Eigen::VectorXd ddxdrift_ ;