YARP
Yet Another Robot Platform
ControlBoardPid.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * Copyright (C) 2006-2010 RobotCub Consortium
4  * All rights reserved.
5  *
6  * This software may be modified and distributed under the terms of the
7  * BSD-3-Clause license. See the accompanying LICENSE file for details.
8  */
9 
10 #include <yarp/dev/api.h>
11 
12 #ifndef YARP_DEV_CONTROLBOARDPID_H
13 #define YARP_DEV_CONTROLBOARDPID_H
14 
19 namespace yarp{
20  namespace dev{
21  class Pid;
22  }
23 }
24 
29 {
30 public:
31  double kp;
32  double kd;
33  double ki;
34  double max_int;
35  double scale;
36  double max_output;
37  double offset;
38  double stiction_up_val;
40  double kff;
41 
42 public:
46  Pid();
47 
51  ~Pid();
52 
63  Pid(double kp, double kd, double ki, double int_max, double scale, double out_max);
64 
78  Pid(double kp, double kd, double ki,
79  double int_max, double scale, double out_max, double st_up, double st_down, double kff);
80 
86  void setKp(double p);
87 
93  void setKi(double i);
94 
100  void setKd(double d);
101 
107  void setMaxInt(double m);
108 
114  void setScale(double sc);
115 
121  void setMaxOut(double m);
122 
128  void setOffset(double o);
129 
136  void setStictionValues(double up_value, double down_value);
137 
143  void setKff(double Kff);
144 
150  bool operator==(const yarp::dev::Pid &p) const;
151 
156  void clear();
157 };
158 
159 #endif // YARP_DEV_CONTROLBOARDPID_H
yarp::dev::Pid::stiction_up_val
double stiction_up_val
up stiction offset added to the pid output
Definition: ControlBoardPid.h:38
yarp::dev::Pid::Pid
Pid()
Default Constructor.
Definition: ControlBoardPid.cpp:44
yarp::dev::Pid::max_output
double max_output
max output
Definition: ControlBoardPid.h:36
yarp::dev::Pid::scale
double scale
scale for the pid output
Definition: ControlBoardPid.h:35
yarp::dev::Pid::ki
double ki
integrative gain
Definition: ControlBoardPid.h:33
yarp::dev::Pid::setMaxInt
void setMaxInt(double m)
Set max threshold for the integrative part.
Definition: ControlBoardPid.cpp:78
yarp::dev::Pid::setMaxOut
void setMaxOut(double m)
Set max output value for the pid.
Definition: ControlBoardPid.cpp:88
yarp::dev::Pid::setScale
void setScale(double sc)
Set output scale for the pid.
Definition: ControlBoardPid.cpp:83
yarp::dev::Pid::setKi
void setKi(double i)
Set integrative gain.
Definition: ControlBoardPid.cpp:68
yarp::dev::Pid::setKp
void setKp(double p)
Set proportional gain.
Definition: ControlBoardPid.cpp:63
yarp::dev::Pid::offset
double offset
pwm offset added to the pid output
Definition: ControlBoardPid.h:37
yarp::dev::Pid::max_int
double max_int
saturation threshold for the integrator
Definition: ControlBoardPid.h:34
yarp::dev::Pid::operator==
bool operator==(const yarp::dev::Pid &p) const
return true if all params are equal
Definition: ControlBoardPid.cpp:109
yarp::dev::Pid::kd
double kd
derivative gain
Definition: ControlBoardPid.h:32
yarp::dev::Pid::kp
double kp
proportional gain
Definition: ControlBoardPid.h:31
yarp::dev::Pid::kff
double kff
feedforward gain
Definition: ControlBoardPid.h:40
yarp::dev::Pid::~Pid
~Pid()
Destructor.
YARP_dev_API
#define YARP_dev_API
Definition: api.h:19
yarp::dev::Pid::stiction_down_val
double stiction_down_val
down stiction offset added to the pid output
Definition: ControlBoardPid.h:39
yarp::dev::Pid::setOffset
void setOffset(double o)
Set offset value for the pid.
Definition: ControlBoardPid.cpp:93
yarp::dev::Pid::setKff
void setKff(double Kff)
Set the feedforward gain for the pid.
Definition: ControlBoardPid.cpp:104
yarp::dev::Pid::clear
void clear()
Set all pid parameters to zero.
Definition: ControlBoardPid.cpp:49
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::dev::Pid
Contains the parameters for a PID.
Definition: ControlBoardPid.h:29
api.h
yarp::dev::Pid::setKd
void setKd(double d)
Set derivative gain.
Definition: ControlBoardPid.cpp:73
yarp::dev::Pid::setStictionValues
void setStictionValues(double up_value, double down_value)
Set the two stiction values for the pid.
Definition: ControlBoardPid.cpp:98