ORCA: Optimization-based framework for Robotic Control Applications
GenericTask.h
Go to the documentation of this file.
1 //| This file is a part of the ORCA framework.
2 //|
3 //| Copyright 2018, Fuzzy Logic Robotics
4 //| Copyright 2017, ISIR / Universite Pierre et Marie Curie (UPMC)
5 //|
6 //| Main contributor(s): Antoine Hoarau, Ryan Lober, and
7 //| Fuzzy Logic Robotics <info@fuzzylogicrobotics.com>
8 //|
9 //| ORCA is a whole-body reactive controller framework for robotics.
10 //|
11 //| This software is governed by the CeCILL-C license under French law and
12 //| abiding by the rules of distribution of free software. You can use,
13 //| modify and/ or redistribute the software under the terms of the CeCILL-C
14 //| license as circulated by CEA, CNRS and INRIA at the following URL
15 //| "http://www.cecill.info".
16 //|
17 //| As a counterpart to the access to the source code and rights to copy,
18 //| modify and redistribute granted by the license, users are provided only
19 //| with a limited warranty and the software's author, the holder of the
20 //| economic rights, and the successive licensors have only limited
21 //| liability.
22 //|
23 //| In this respect, the user's attention is drawn to the risks associated
24 //| with loading, using, modifying and/or developing or reproducing the
25 //| software by the user in light of its specific status of free software,
26 //| that may mean that it is complicated to manipulate, and that also
27 //| therefore means that it is reserved for developers and experienced
28 //| professionals having in-depth computer knowledge. Users are therefore
29 //| encouraged to load and test the software's suitability as regards their
30 //| requirements in conditions enabling the security of their systems and/or
31 //| data to be ensured and, more generally, to use and operate it in the
32 //| same conditions as regards security.
33 //|
34 //| The fact that you are presently reading this means that you have had
35 //| knowledge of the CeCILL-C license and that you accept its terms.
36 
37 #pragma once
38 
39 #include "orca/math/Utils.h"
40 #include "orca/utils/Utils.h"
42 #include "orca/robot/RobotModel.h"
43 #include "orca/common/TaskBase.h"
44 
45 namespace orca
46 {
47 namespace task
48 {
49 
51 {
52 
53 public:
54  using Ptr = std::shared_ptr<GenericTask>;
55 
56  GenericTask(const std::string& name,optim::ControlVariable control_var);
57 
58  virtual ~GenericTask();
59 
60  double getWeight() const;
61  void setWeight(double weight);
62 
63  math::Size getSize() const;
64  int cols() const;
65  int rows() const;
66 
69 
70  const Eigen::MatrixXd& getE() const;
71  const Eigen::VectorXd& getf() const;
72 
73  void setE(const Eigen::MatrixXd& newE);
74  void setf(const Eigen::VectorXd& newf);
75 
76  virtual void print() const;
77 
79 
80  Eigen::MatrixXd& E();
81  Eigen::VectorXd& f();
82 
83  virtual bool rampUp(double time_since_start);
84  virtual void onUpdateAffineFunction(double current_time, double dt) = 0;
85  virtual void onDeactivation();
86  virtual bool rampDown(double time_since_stop);
87 private:
88  virtual void onCompute(double current_time, double dt);
89  virtual void computeQuadraticCost();
91  common::Parameter<double> weight_ = 1.0;
92 };
93 
94 }
95 }
const math::WeightedEuclidianNormFunction::QuadraticCost & getQuadraticCost() const
Definition: GenericTask.cc:56
const math::WeightedEuclidianNormFunction & getEuclidianNorm() const
Definition: GenericTask.cc:66
void setf(const Eigen::VectorXd &newf)
Definition: GenericTask.cc:86
virtual void print() const
Definition: GenericTask.cc:22
Definition: WeightedEuclidianNormFunction.h:48
virtual void onUpdateAffineFunction(double current_time, double dt)=0
Definition: GenericTask.h:50
const Eigen::MatrixXd & getE() const
Definition: GenericTask.cc:71
const Eigen::VectorXd & getf() const
Definition: GenericTask.cc:76
void setE(const Eigen::MatrixXd &newE)
Definition: GenericTask.cc:81
virtual bool rampDown(double time_since_stop)
Definition: GenericTask.cc:146
virtual bool rampUp(double time_since_start)
Definition: GenericTask.cc:101
std::shared_ptr< ConfigurableOrcaObject > Ptr
Definition: ConfigurableOrcaObject.h:17
GenericTask(const std::string &name, optim::ControlVariable control_var)
Definition: GenericTask.cc:10
double getWeight() const
Definition: GenericTask.cc:31
virtual ~GenericTask()
Definition: GenericTask.cc:17
void setWeight(double weight)
Definition: GenericTask.cc:36
math::WeightedEuclidianNormFunction & euclidianNorm()
Definition: GenericTask.cc:61
virtual void onDeactivation()
Definition: GenericTask.cc:160
Definition: CartesianAccelerationPID.h:44
ControlVariable
Definition: ControlVariable.h:44
Definition: WeightedEuclidianNormFunction.h:54
Eigen::VectorXd & f()
Definition: GenericTask.cc:96
math::Size getSize() const
Definition: GenericTask.cc:41
Definition: Utils.h:105
int rows() const
Definition: GenericTask.cc:51
Eigen::MatrixXd & E()
Definition: GenericTask.cc:91
The common base class for tasks and constraints.
Definition: TaskBase.h:59
int cols() const
Definition: GenericTask.cc:46