From 6aa642483dd3e47664bf6057be5e7d30f3bacda6 Mon Sep 17 00:00:00 2001 From: jfkeller Date: Tue, 3 Apr 2018 14:06:35 -0400 Subject: [PATCH] Removed a cast to float to fix a bug where the time delta was being calculated incorrectly. --- .../firmwares/simple_flight/firmware/PidController.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AirLib/include/vehicles/multirotor/firmwares/simple_flight/firmware/PidController.hpp b/AirLib/include/vehicles/multirotor/firmwares/simple_flight/firmware/PidController.hpp index 96a9dfd24d..af9d2161c3 100644 --- a/AirLib/include/vehicles/multirotor/firmwares/simple_flight/firmware/PidController.hpp +++ b/AirLib/include/vehicles/multirotor/firmwares/simple_flight/firmware/PidController.hpp @@ -91,7 +91,7 @@ class PidController : public IUpdatable { const T error = goal_ - measured_; float dt = clock_ == nullptr ? 1 : - (static_cast(clock_->millis()) - last_time_) + (clock_->millis() - last_time_) * config_.time_scale; float pterm = error * config_.kp; @@ -135,4 +135,4 @@ class PidController : public IUpdatable { }; -} //namespace \ No newline at end of file +} //namespace