EasyNav Plugins
Loading...
Searching...
No Matches
PIDController.hpp
Go to the documentation of this file.
1// Copyright 2021 Intelligent Robotics Lab
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
17
18#ifndef EASYNAV_SIMPLE_CONTROLLER__PIDCONTROLLER_HPP_
19#define EASYNAV_SIMPLE_CONTROLLER__PIDCONTROLLER_HPP_
20
21#include <cmath>
22
23namespace easynav
24{
25
28{
29public:
40 PIDController(double min_ref, double max_ref, double min_output, double max_output);
41
49 void set_pid(double n_KP, double n_KI, double n_KD);
50
60 double get_output(double new_reference, double dt);
61
65 void reset();
66
67private:
68 double KP_;
69 double KI_;
70 double KD_;
71
72 double min_ref_;
73 double max_ref_;
74 double min_output_;
75 double max_output_;
76
77 double prev_error_;
78 double int_error_;
79 double integral_limit_ {0.0};
80};
81
82} // namespace easynav
83
84#endif // EASYNAV_SIMPLE_CONTROLLER__PIDCONTROLLER_HPP_
PIDController(double min_ref, double max_ref, double min_output, double max_output)
Constructor.
Definition PIDController.cpp:22
double get_output(double new_reference, double dt)
Computes the control output for the given reference input.
Definition PIDController.cpp:45
void set_pid(double n_KP, double n_KI, double n_KD)
Sets the PID gains.
Definition PIDController.cpp:37
void reset()
Reset internal integrator and derivative state.
Definition PIDController.cpp:86
Provides a mapping for often used cost values.
Definition cost_values.hpp:41