Skip to content

Commit

Permalink
Removed a cast to float to fix a bug where the time delta was being c…
Browse files Browse the repository at this point in the history
…alculated incorrectly.
  • Loading branch information
jfkeller authored Apr 3, 2018
1 parent 1c7b250 commit 6aa6424
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class PidController : public IUpdatable {
const T error = goal_ - measured_;

float dt = clock_ == nullptr ? 1 :
(static_cast<float>(clock_->millis()) - last_time_)
(clock_->millis() - last_time_)
* config_.time_scale;

float pterm = error * config_.kp;
Expand Down Expand Up @@ -135,4 +135,4 @@ class PidController : public IUpdatable {
};


} //namespace
} //namespace

0 comments on commit 6aa6424

Please sign in to comment.