00001 /*+-------------------------------------------------------------------------+ 00002 | MultiVehicle simulator (libmvsim) | 00003 | | 00004 | Copyright (C) 2014 Jose Luis Blanco Claraco (University of Almeria) | 00005 | Copyright (C) 2017 Borys Tymchenko (Odessa Polytechnic University) | 00006 | Distributed under GNU General Public License version 3 | 00007 | See <http://www.gnu.org/licenses/> | 00008 +-------------------------------------------------------------------------+ */ 00009 #pragma once 00010 00011 namespace mvsim 00012 { 00013 struct PID_Controller 00014 { 00015 PID_Controller(); 00016 00017 double KP, KI, KD; 00018 double max_out; 00019 00021 double compute(double err, double dt); 00022 00023 private: 00024 double lastOutput; 00025 double e_n, e_n_1, e_n_2; 00026 }; 00027 }