1
Fork 0

ramp states

This commit is contained in:
Andy Killorin 2024-11-12 21:54:19 -05:00
parent 95f85e8e07
commit 797742ecd8
Signed by: ank
GPG key ID: 23F9463ECB67FE8C

View file

@ -198,6 +198,28 @@ void Robot::LineFollowingUpdate(void)
}
chassis.SetTwist(speed, turnEffort);
if (eulerAngles.x > 10.) {
Serial.println("climbing");
} else if (eulerAngles.x <= 10.) {
Serial.println("level");
}
if (eulerAngles.x > 10.) { // activate timer when on ramp
leveltimer = 30;
}
if (leveltimer > 0) {
if (eulerAngles.x <= 5.) {
leveltimer--; // count down when off ramp
if (leveltimer == 1) {
leveltimer = 0;
EnterIdleState();
}
} else {
leveltimer = 30;
}
}
}
}