SCL  1.0
Standard Control Library : Control, dynamics, physics, and simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Groups Pages
CTaskComPos.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 CTaskComPos.hpp
24  *
25  * Created on: Sep 2, 2012
26  *
27  * Copyright (C) 2012
28  *
29  * Author: Samir Menon <smenon@stanford.edu>
30  */
31 
32 #ifndef CCOMPOSTASK_HPP_
33 #define CCOMPOSTASK_HPP_
34 
35 #include <scl/DataTypes.hpp>
36 #include <scl/control/task/tasks/data_structs/STaskComPos.hpp>
37 #include <scl/control/task/CTaskBase.hpp>
38 
39 #include <Eigen/Dense>
40 #include <Eigen/SVD>
41 
42 #include <string>
43 #include <vector>
44 
45 namespace scl
46 {
57  class CTaskComPos : public scl::CTaskBase
58  {
59  public:
60  /********************************
61  * CTaskBase API
62  *********************************/
64  virtual bool computeServo(const SRobotSensors* arg_sensors);
65 
68  virtual bool computeModel(const SRobotSensors* arg_sensors);
69 
70  /* **************************************************************
71  * Status Get/Set Functions
72  * ************************************************************** */
74  virtual STaskBase* getTaskData();
75 
77  virtual bool setGoalPos(const Eigen::VectorXd & arg_goal);
78 
80  virtual bool setGoalVel(const Eigen::VectorXd & arg_goal);
81 
83  virtual bool setGoalAcc(const Eigen::VectorXd & arg_goal);
84 
86  virtual bool getGoalPos(Eigen::VectorXd & arg_goal) const
87  { arg_goal = data_->x_goal_; return true; }
88 
90  virtual bool getGoalVel(Eigen::VectorXd & arg_goal) const
91  { arg_goal = data_->dx_goal_; return true; }
92 
94  virtual bool getGoalAcc(Eigen::VectorXd & arg_goal) const
95  { arg_goal = data_->ddx_goal_; return true; }
96 
98  virtual bool getPos(Eigen::VectorXd & arg_pos) const
99  { arg_pos = data_->x_; return true; }
100 
102  virtual bool getVel(Eigen::VectorXd & arg_vel) const
103  { arg_vel = data_->dx_; return true; }
104 
106  virtual bool getAcc(Eigen::VectorXd & arg_acc) const
107  { arg_acc = data_->ddx_; return true; }
108 
109  /* *******************************
110  * CTaskComPos specific functions
111  ******************************** */
114 
115  /********************************
116  * Initialization specific functions
117  *********************************/
119  CTaskComPos();
120 
122  virtual ~CTaskComPos(){}
123 
126  virtual bool init(STaskBase* arg_task_data,
127  CDynamicsBase* arg_dynamics);
128 
131  virtual void reset();
132 
133  private:
136 
138  Eigen::VectorXd tmp1, tmp2;
139 
141  Eigen::Matrix3d J_premultiplier_;
142 
144  Eigen::ColPivHouseholderQR<Eigen::Matrix3d> qr_;
145 
148 
151  Eigen::JacobiSVD<Eigen::Matrix3d > svd_;
152  Eigen::Matrix3d singular_values_;
153  };
154 
155 } /* namespace scl */
156 #endif /* CCOMPOSTASK_HPP_ */
Eigen::VectorXd tmp1
Definition: CTaskComPos.hpp:138
virtual bool computeModel(const SRobotSensors *arg_sensors)
Definition: CTaskComPos.cpp:213
Definition: STaskBase.hpp:69
CTaskComPos()
Definition: CTaskComPos.cpp:50
Definition: STaskComPos.hpp:50
virtual bool computeServo(const SRobotSensors *arg_sensors)
Definition: CTaskComPos.cpp:171
virtual bool init(STaskBase *arg_task_data, CDynamicsBase *arg_dynamics)
Definition: CTaskComPos.cpp:56
sBool achievedGoalPos()
Definition: CTaskComPos.cpp:315
STaskComPos * data_
Definition: CTaskComPos.hpp:135
virtual bool getPos(Eigen::VectorXd &arg_pos) const
Definition: CTaskComPos.hpp:98
virtual bool getVel(Eigen::VectorXd &arg_vel) const
Definition: CTaskComPos.hpp:102
Eigen::Matrix3d J_premultiplier_
Definition: CTaskComPos.hpp:141
virtual bool setGoalPos(const Eigen::VectorXd &arg_goal)
Definition: CTaskComPos.cpp:106
Definition: CTaskComPos.hpp:57
Definition: CDynamicsBase.hpp:55
virtual bool setGoalVel(const Eigen::VectorXd &arg_goal)
Definition: CTaskComPos.cpp:125
bool sBool
Definition: DataTypes.hpp:54
Eigen::ColPivHouseholderQR< Eigen::Matrix3d > qr_
Definition: CTaskComPos.hpp:144
virtual bool getAcc(Eigen::VectorXd &arg_acc) const
Definition: CTaskComPos.hpp:106
virtual bool setGoalAcc(const Eigen::VectorXd &arg_goal)
Definition: CTaskComPos.cpp:144
virtual STaskBase * getTaskData()
Definition: CTaskComPos.cpp:102
virtual ~CTaskComPos()
Definition: CTaskComPos.hpp:122
virtual bool getGoalVel(Eigen::VectorXd &arg_goal) const
Definition: CTaskComPos.hpp:90
sBool lambda_inv_singular_
Definition: CTaskComPos.hpp:147
Eigen::JacobiSVD< Eigen::Matrix3d > svd_
Definition: CTaskComPos.hpp:151
virtual bool getGoalPos(Eigen::VectorXd &arg_goal) const
Definition: CTaskComPos.hpp:86
virtual bool getGoalAcc(Eigen::VectorXd &arg_goal) const
Definition: CTaskComPos.hpp:94
virtual void reset()
Definition: CTaskComPos.cpp:163
Definition: SRobotIO.hpp:49
Definition: CTaskBase.hpp:54