SCL  1.0
Standard Control Library : Control, dynamics, physics, and simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Groups Pages
CTaskOpPosPIDA1OrderInfTime.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 CTaskOpPosPIDA1OrderInfTime.hpp
24  *
25  * Created on: Aug 9, 2013
26  *
27  * Copyright (C) 2013
28  *
29  * Author: Samir Menon <smenon@stanford.edu>
30  */
31 
32 #ifndef COPPOINTTASKPIDA1ORDERINFTIME_HPP_
33 #define COPPOINTTASKPIDA1ORDERINFTIME_HPP_
34 
35 #include <string>
36 #include <vector>
37 
38 #include <scl/DataTypes.hpp>
39 
40 #include <scl/control/task/tasks/data_structs/STaskOpPosPIDA1OrderInfTime.hpp>
41 
42 #include <scl/control/task/CTaskBase.hpp>
43 
44 #include <Eigen/Dense>
45 #include <Eigen/SVD>
46 
47 
48 namespace scl
49 {
72 {
73 public:
74  /********************************
75  * CTaskBase API
76  *********************************/
78  virtual bool computeServo(const SRobotSensors* arg_sensors);
79 
82  virtual bool computeModel(const SRobotSensors* arg_sensors);
83 
84  /* **************************************************************
85  * Status Get/Set Functions
86  * ************************************************************** */
88  virtual STaskBase* getTaskData();
89 
91  virtual bool setGoalPos(const Eigen::VectorXd & arg_goal);
92 
94  virtual bool setGoalVel(const Eigen::VectorXd & arg_goal);
95 
97  virtual bool setGoalAcc(const Eigen::VectorXd & arg_goal);
98 
100  virtual bool getGoalPos(Eigen::VectorXd & arg_goal) const
101  { arg_goal = data_->x_goal_; return true; }
102 
104  virtual bool getGoalVel(Eigen::VectorXd & arg_goal) const
105  { arg_goal = data_->dx_goal_; return true; }
106 
108  virtual bool getGoalAcc(Eigen::VectorXd & arg_goal) const
109  { arg_goal = data_->ddx_goal_; return true; }
110 
112  virtual bool getPos(Eigen::VectorXd & arg_pos) const
113  { arg_pos = data_->x_; return true; }
114 
116  virtual bool getVel(Eigen::VectorXd & arg_vel) const
117  { arg_vel = data_->dx_; return true; }
118 
120  virtual bool getAcc(Eigen::VectorXd & arg_acc) const
121  { arg_acc = data_->ddx_; return true; }
122 
123  /* *******************************
124  * CTaskOpPosPID specific functions
125  * ******************************* */
128 
129  void setFlagComputeOpPosGravity(sBool arg_compute_grav)
130  { flag_compute_gravity_ = arg_compute_grav; }
131 
134  { return flag_integral_gain_active_; }
135 
136  /* *******************************
137  * CTaskOpPos specific functions
138  * ******************************* */
141 
144 
147  virtual bool init(STaskBase* arg_task_data,
148  CDynamicsBase* arg_dynamics);
149 
152  virtual void reset();
153 
154 protected:
157 
159  Eigen::VectorXd tmp1, tmp2;
160 
162  Eigen::ColPivHouseholderQR<Eigen::Matrix3d> qr_;
163 
166 
169  Eigen::JacobiSVD<Eigen::Matrix3d > svd_;
170  Eigen::Matrix3d singular_values_;
171 
172  sBool flag_compute_gravity_;
173  sBool flag_integral_gain_active_;
174 };
175 
176 }
177 
178 #endif /* COPPOINTTASKPIDA1ORDERINFTIME_HPP_ */
sBool achievedGoalPos()
Definition: CTaskOpPosPIDA1OrderInfTime.cpp:341
virtual STaskBase * getTaskData()
Definition: CTaskOpPosPIDA1OrderInfTime.cpp:106
Eigen::JacobiSVD< Eigen::Matrix3d > svd_
Definition: CTaskOpPosPIDA1OrderInfTime.hpp:169
Definition: STaskBase.hpp:69
STaskOpPosPIDA1OrderInfTime * data_
Definition: CTaskOpPosPIDA1OrderInfTime.hpp:156
sBool integralGainActive()
Definition: CTaskOpPosPIDA1OrderInfTime.hpp:133
virtual bool getGoalAcc(Eigen::VectorXd &arg_goal) const
Definition: CTaskOpPosPIDA1OrderInfTime.hpp:108
virtual bool setGoalVel(const Eigen::VectorXd &arg_goal)
Definition: CTaskOpPosPIDA1OrderInfTime.cpp:129
virtual bool setGoalAcc(const Eigen::VectorXd &arg_goal)
Definition: CTaskOpPosPIDA1OrderInfTime.cpp:148
virtual bool getPos(Eigen::VectorXd &arg_pos) const
Definition: CTaskOpPosPIDA1OrderInfTime.hpp:112
virtual void reset()
Definition: CTaskOpPosPIDA1OrderInfTime.cpp:166
sBool lambda_inv_singular_
Definition: CTaskOpPosPIDA1OrderInfTime.hpp:165
Definition: CDynamicsBase.hpp:55
Eigen::ColPivHouseholderQR< Eigen::Matrix3d > qr_
Definition: CTaskOpPosPIDA1OrderInfTime.hpp:162
bool sBool
Definition: DataTypes.hpp:54
virtual bool init(STaskBase *arg_task_data, CDynamicsBase *arg_dynamics)
Definition: CTaskOpPosPIDA1OrderInfTime.cpp:64
Definition: STaskOpPosPIDA1OrderInfTime.hpp:43
virtual bool getAcc(Eigen::VectorXd &arg_acc) const
Definition: CTaskOpPosPIDA1OrderInfTime.hpp:120
Definition: CTaskOpPosPIDA1OrderInfTime.hpp:71
virtual bool setGoalPos(const Eigen::VectorXd &arg_goal)
Definition: CTaskOpPosPIDA1OrderInfTime.cpp:110
Eigen::VectorXd tmp1
Definition: CTaskOpPosPIDA1OrderInfTime.hpp:159
virtual bool computeServo(const SRobotSensors *arg_sensors)
Definition: CTaskOpPosPIDA1OrderInfTime.cpp:174
virtual bool getGoalPos(Eigen::VectorXd &arg_goal) const
Definition: CTaskOpPosPIDA1OrderInfTime.hpp:100
CTaskOpPosPIDA1OrderInfTime()
Definition: CTaskOpPosPIDA1OrderInfTime.cpp:53
virtual bool getVel(Eigen::VectorXd &arg_vel) const
Definition: CTaskOpPosPIDA1OrderInfTime.hpp:116
Definition: SRobotIO.hpp:49
virtual bool getGoalVel(Eigen::VectorXd &arg_goal) const
Definition: CTaskOpPosPIDA1OrderInfTime.hpp:104
Definition: CTaskBase.hpp:54
virtual ~CTaskOpPosPIDA1OrderInfTime()
Definition: CTaskOpPosPIDA1OrderInfTime.hpp:143
virtual bool computeModel(const SRobotSensors *arg_sensors)
Definition: CTaskOpPosPIDA1OrderInfTime.cpp:236