diff --git a/libraries/PID/PID.cpp b/libraries/PID/PID.cpp index eafc0d8d72..4499d26900 100644 --- a/libraries/PID/PID.cpp +++ b/libraries/PID/PID.cpp @@ -19,7 +19,7 @@ const AP_Param::GroupInfo PID::var_info[] PROGMEM = { AP_GROUPEND }; -int32_t PID::get_pid(int32_t error, float scaler) +float PID::get_pid(float error, float scaler) { uint32_t tnow = hal.scheduler->millis(); uint32_t dt = tnow - _last_t; diff --git a/libraries/PID/PID.h b/libraries/PID/PID.h index aa18e23b34..aced3e566a 100644 --- a/libraries/PID/PID.h +++ b/libraries/PID/PID.h @@ -36,15 +36,11 @@ public: /// Positive error produces positive output. /// /// @param error The measured error value - /// @param dt The time delta in milliseconds (note - /// that update interval cannot be more - /// than 65.535 seconds due to limited range - /// of the data type). /// @param scaler An arbitrary scale factor /// /// @returns The updated control output. /// - int32_t get_pid(int32_t error, float scaler = 1.0); + float get_pid(float error, float scaler = 1.0); /// Reset the PID integrator /// @@ -108,11 +104,11 @@ private: AP_Int16 _imax; float _integrator;///< integrator value - int32_t _last_error;///< last error for derivative + float _last_error;///< last error for derivative float _last_derivative;///< last derivative for low-pass filter uint32_t _last_t;///< last time get_pid() was called in millis - int32_t _get_pid(int32_t error, uint16_t dt, float scaler); + float _get_pid(float error, uint16_t dt, float scaler); /// Low pass filter cut frequency for derivative calculation. ///