Skip to content

Commit 77c38a4

Browse files
committed
angle GREATER than epsilon
1 parent 83c6276 commit 77c38a4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/common/base_classes/Sensor.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ float Sensor::getVelocity() {
2929
}
3030
if (Ts < min_elapsed_time) return velocity; // don't update velocity if deltaT is too small
3131

32-
float current_angle = 0;
33-
float prev_angle = 0;
32+
float current_angle = 0.0f;
33+
float prev_angle = 0.0f;
3434
// Avoid floating point precision loss for large full_rotations
3535
// this is likely optional
3636
if (full_rotations == vel_full_rotations) {
@@ -43,7 +43,7 @@ float Sensor::getVelocity() {
4343
const float delta_angle = current_angle - prev_angle;
4444

4545
// floating point equality checks are bad, so instead we check that the angle change is very small
46-
if (fabsf(delta_angle) < 1e-8f) {
46+
if (fabsf(delta_angle) > 1e-8f) {
4747
velocity = delta_angle / Ts;
4848

4949
vel_angle_prev = angle_prev;

0 commit comments

Comments
 (0)