Skip to content

Commit

Permalink
minDeltaT to min_elapsed_time
Browse files Browse the repository at this point in the history
  • Loading branch information
askuric committed Oct 15, 2022
1 parent 091a98d commit 8c65a5f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/common/base_classes/Sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void Sensor::update() {
float Sensor::getVelocity() {
// calculate sample time
float Ts = (angle_prev_ts - vel_angle_prev_ts)*1e-6;
if (Ts<minDeltaT) return velocity; // don't update velocity if deltaT is too small
if (Ts < min_elapsed_time) return velocity; // don't update velocity if Ts is too small

velocity = ( (float)(full_rotations - vel_full_rotations)*_2PI + (angle_prev - vel_angle_prev) ) / Ts;
vel_angle_prev = angle_prev;
Expand Down
2 changes: 1 addition & 1 deletion src/common/base_classes/Sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class Sensor{
/**
* Minimum time between updates to velocity. If time elapsed is lower than this, the velocity is not updated.
*/
float minDeltaT = 0.000100; // default is 100 microseconds, or 10kHz
float min_elapsed_time = 0.000100; // default is 100 microseconds, or 10kHz

protected:
/**
Expand Down

0 comments on commit 8c65a5f

Please sign in to comment.