ORCA: Optimization-based framework for Robotic Control Applications
PIDController.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 
38 #pragma once
39 
40 #include "orca/math/Utils.h"
41 #include "orca/utils/Utils.h"
43 
44 namespace orca
45 {
46 namespace common
47 {
49  {
50  public:
51  using Ptr = std::shared_ptr<PIDController>;
52 
53  PIDController(const std::string& name = "pid");
54  void resize(int dim);
55  void setProportionalGain(const Eigen::VectorXd& P_gain);
56  void setProportionalGain(const std::vector<double>& P_gain);
57  const Eigen::VectorXd& P() const;
58  void setIntegralGain(const Eigen::VectorXd& I_gain);
59  void setIntegralGain(const std::vector<double>& I_gain);
60  void setWindupLimit(const Eigen::VectorXd& windup_lim);
61  void setWindupLimit(const std::vector<double>& windup_lim);
62  const Eigen::VectorXd& windupLimit();
63  const Eigen::VectorXd& I() const;
64  void setDerivativeGain(const Eigen::VectorXd& D_gain);
65  void setDerivativeGain(const std::vector<double>& D_gain);
66 
67  const Eigen::VectorXd& D() const;
68  const Eigen::VectorXd& computeCommand(const Eigen::VectorXd& Error
69  , const Eigen::VectorXd& DError
70  , double dt);
71  const Eigen::VectorXd& computeCommand(const Eigen::VectorXd& Error, double dt);
72  void print() const;
73  private:
74  Parameter<int> dimension_ = 0;
78  Parameter<Eigen::VectorXd> windup_limit_;
79  private:
80  Eigen::VectorXd i_error_;
81  Eigen::VectorXd d_error_;
82  Eigen::VectorXd cmd_;
83  };
84 
85 } // namespace common
86 } // namespace orca
Represents a set of parameters that can be loaded from a YAML file.
Definition: ConfigurableOrcaObject.h:14
void setIntegralGain(const Eigen::VectorXd &I_gain)
Definition: PIDController.cc:65
const Eigen::VectorXd & computeCommand(const Eigen::VectorXd &Error, const Eigen::VectorXd &DError, double dt)
Definition: PIDController.cc:110
std::shared_ptr< ConfigurableOrcaObject > Ptr
Definition: ConfigurableOrcaObject.h:17
void setWindupLimit(const Eigen::VectorXd &windup_lim)
Definition: PIDController.cc:75
void setDerivativeGain(const Eigen::VectorXd &D_gain)
Definition: PIDController.cc:95
void resize(int dim)
Definition: PIDController.cc:17
const Eigen::VectorXd & I() const
Definition: PIDController.cc:90
void print() const
Definition: PIDController.cc:136
const Eigen::VectorXd & windupLimit()
Definition: PIDController.cc:85
Definition: CartesianAccelerationPID.h:44
const Eigen::VectorXd & P() const
Definition: PIDController.cc:60
PIDController(const std::string &name="pid")
Definition: PIDController.cc:6
void setProportionalGain(const Eigen::VectorXd &P_gain)
Definition: PIDController.cc:50
Definition: PIDController.h:48
const Eigen::VectorXd & D() const
Definition: PIDController.cc:105