Skip to content

Commit

Permalink
C++: Examples: AHRS: fix sign of accumulated offset
Browse files Browse the repository at this point in the history
remove negative sign at accumulated offset because the offset is subtracted from sensor reading
  • Loading branch information
ktahar authored and staroselskii committed Nov 19, 2017
1 parent 586caaa commit 84573fe
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions C++/Examples/AHRS/AHRS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,9 @@ void AHRS::setGyroOffset()
gy *= 180 / PI;
gz *= 180 / PI;

offset[0] += (-gx*0.0175);
offset[1] += (-gy*0.0175);
offset[2] += (-gz*0.0175);
offset[0] += gx*0.0175;
offset[1] += gy*0.0175;
offset[2] += gz*0.0175;

usleep(10000);
}
Expand Down Expand Up @@ -412,7 +412,6 @@ std::string get_sensor_name(int argc, char *argv[])

return "mpu";
}

}

//============================== Main loop ====================================
Expand Down

0 comments on commit 84573fe

Please sign in to comment.