SCL  1.0
Standard Control Library : Control, dynamics, physics, and simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Groups Pages
CTaskOpPos.hpp
1 /* This file is part of scl, a control and simulation library
2 for robots and biomechanical models.
3 
4 scl is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 3 of the License, or (at your option) any later version.
8 
9 Alternatively, you can redistribute it and/or
10 modify it under the terms of the GNU General Public License as
11 published by the Free Software Foundation; either version 2 of
12 the License, or (at your option) any later version.
13 
14 scl is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU Lesser General Public
20 License and a copy of the GNU General Public License along with
21 scl. If not, see <http://www.gnu.org/licenses/>.
22 */
23 /* \file CTaskOpPos.hpp
24  *
25  * Created on: Aug 19, 2010
26  *
27  * Copyright (C) 2010
28  *
29  * Author: Samir Menon <smenon@stanford.edu>
30  */
31 
32 #ifndef COPPOINTTASK_HPP_
33 #define COPPOINTTASK_HPP_
34 
35 #include <string>
36 #include <vector>
37 
38 #include <scl/DataTypes.hpp>
39 
40 #include <scl/control/task/tasks/data_structs/STaskOpPos.hpp>
41 
42 #include <scl/control/task/CTaskBase.hpp>
43 
44 #include <Eigen/Dense>
45 #include <Eigen/SVD>
46 
47 
48 namespace scl
49 {
62 class CTaskOpPos : public scl::CTaskBase
63 {
64 public:
65  /********************************
66  * CTaskBase API
67  *********************************/
69  virtual bool computeServo(const SRobotSensors* arg_sensors);
70 
73  virtual bool computeModel(const SRobotSensors* arg_sensors);
74 
75  /* **************************************************************
76  * Status Get/Set Functions
77  * ************************************************************** */
79  virtual STaskBase* getTaskData();
80 
82  virtual bool setGoalPos(const Eigen::VectorXd & arg_goal);
83 
85  virtual bool setGoalVel(const Eigen::VectorXd & arg_goal);
86 
88  virtual bool setGoalAcc(const Eigen::VectorXd & arg_goal);
89 
91  virtual bool getGoalPos(Eigen::VectorXd & arg_goal) const
92  { arg_goal = data_->x_goal_; return true; }
93 
95  virtual bool getGoalVel(Eigen::VectorXd & arg_goal) const
96  { arg_goal = data_->dx_goal_; return true; }
97 
99  virtual bool getGoalAcc(Eigen::VectorXd & arg_goal) const
100  { arg_goal = data_->ddx_goal_; return true; }
101 
103  virtual bool getPos(Eigen::VectorXd & arg_pos) const
104  { arg_pos = data_->x_; return true; }
105 
107  virtual bool getVel(Eigen::VectorXd & arg_vel) const
108  { arg_vel = data_->dx_; return true; }
109 
111  virtual bool getAcc(Eigen::VectorXd & arg_acc) const
112  { arg_acc = data_->ddx_; return true; }
113 
114  /* *******************************
115  * CTaskOpPos specific functions
116  ******************************** */
119 
120  void setFlagComputeOpPosGravity(sBool arg_compute_grav)
121  { flag_compute_gravity_ = arg_compute_grav; }
122 
123  /* *******************************
124  * Initialization specific functions
125  ******************************** */
127  CTaskOpPos();
128 
130  virtual ~CTaskOpPos(){}
131 
134  virtual bool init(STaskBase* arg_task_data,
135  CDynamicsBase* arg_dynamics);
136 
139  virtual void reset();
140 
141 protected:
144 
146  Eigen::VectorXd tmp1, tmp2;
147 
149  Eigen::ColPivHouseholderQR<Eigen::Matrix3d> qr_;
150 
153 
156  Eigen::JacobiSVD<Eigen::Matrix3d > svd_;
157  Eigen::Matrix3d singular_values_;
158 
159  sBool flag_compute_gravity_;
160 };
161 
162 }
163 
164 #endif /* CMARKERTRACKTASK_HPP_ */
Definition: STaskBase.hpp:69
virtual bool getGoalAcc(Eigen::VectorXd &arg_goal) const
Definition: CTaskOpPos.hpp:99
virtual bool computeServo(const SRobotSensors *arg_sensors)
Definition: CTaskOpPos.cpp:173
virtual bool getPos(Eigen::VectorXd &arg_pos) const
Definition: CTaskOpPos.hpp:103
Eigen::ColPivHouseholderQR< Eigen::Matrix3d > qr_
Definition: CTaskOpPos.hpp:149
virtual bool getGoalVel(Eigen::VectorXd &arg_goal) const
Definition: CTaskOpPos.hpp:95
virtual bool init(STaskBase *arg_task_data, CDynamicsBase *arg_dynamics)
Definition: CTaskOpPos.cpp:63
sBool achievedGoalPos()
Definition: CTaskOpPos.cpp:345
CTaskOpPos()
Definition: CTaskOpPos.cpp:53
Eigen::JacobiSVD< Eigen::Matrix3d > svd_
Definition: CTaskOpPos.hpp:156
Eigen::VectorXd tmp1
Definition: CTaskOpPos.hpp:146
virtual bool getVel(Eigen::VectorXd &arg_vel) const
Definition: CTaskOpPos.hpp:107
virtual ~CTaskOpPos()
Definition: CTaskOpPos.hpp:130
Definition: CDynamicsBase.hpp:55
virtual bool setGoalPos(const Eigen::VectorXd &arg_goal)
Definition: CTaskOpPos.cpp:109
bool sBool
Definition: DataTypes.hpp:54
virtual bool computeModel(const SRobotSensors *arg_sensors)
Definition: CTaskOpPos.cpp:221
Definition: STaskOpPos.hpp:43
virtual bool getGoalPos(Eigen::VectorXd &arg_goal) const
Definition: CTaskOpPos.hpp:91
virtual void reset()
Definition: CTaskOpPos.cpp:165
virtual bool getAcc(Eigen::VectorXd &arg_acc) const
Definition: CTaskOpPos.hpp:111
STaskOpPos * data_
Definition: CTaskOpPos.hpp:143
virtual STaskBase * getTaskData()
Definition: CTaskOpPos.cpp:105
Definition: CTaskOpPos.hpp:62
Definition: SRobotIO.hpp:49
Definition: CTaskBase.hpp:54
virtual bool setGoalVel(const Eigen::VectorXd &arg_goal)
Definition: CTaskOpPos.cpp:128
sBool lambda_inv_singular_
Definition: CTaskOpPos.hpp:152
virtual bool setGoalAcc(const Eigen::VectorXd &arg_goal)
Definition: CTaskOpPos.cpp:147