Skip to content

Commit

Permalink
NEXT TIME IMU
Browse files Browse the repository at this point in the history
  • Loading branch information
Holoratte committed Apr 29, 2018
1 parent a50b739 commit dcdd942
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
13 changes: 8 additions & 5 deletions code/ardumower/robot.cpp
Expand Up @@ -182,6 +182,7 @@ Robot::Robot(){
nextTimeInfo = 0;
nextTimeMotorSense = 0;
nextTimeIMU = 0;
nextTimeIMUUpdate = 0;
nextTimeCheckTilt = 0;
nextTimeOdometry = 0;
nextTimeOdometryInfo = 0;
Expand Down Expand Up @@ -1273,15 +1274,17 @@ void Robot::loop() {
checkBattery();
checkIfStuck();
checkRobotStats();
ADCMan.run();
currentMillis = millis();
calcOdometry();
checkOdometryFaults();
checkButton();
motorMowControl();
checkTilt();
checkTilt();


if (imuUse) imu.update();
if ((imuUse) && (currentMillis >= nextTimeIMUUpdate)) {
nextTimeIMUUpdate = currentMillis + 15;
imu.update();
}

if (gpsUse) {
gps.feed();
Expand All @@ -1308,7 +1311,7 @@ void Robot::loop() {
}
currentMillis = millis();
calcOdometry();

ADCMan.run();
// state machine - things to do *PERMANENTLY* for current state
// robot state machine
// http://wiki.ardumower.de/images/f/ff/Ardumower_states.png
Expand Down
1 change: 1 addition & 0 deletions code/ardumower/robot.h
Expand Up @@ -362,6 +362,7 @@ class Robot
//point_float_t accMax;
unsigned long nextTimeIMU ; //read IMU data
unsigned long nextTimeCheckTilt; // check if
unsigned long nextTimeIMUUpdate ; //read IMU data
// ------- perimeter state --------------------------
Perimeter perimeter;
char perimeterUse ; // use perimeter?
Expand Down

0 comments on commit dcdd942

Please sign in to comment.