Merge branch 'sim' of git.mistlab.ca:dasto/drones into sim

This commit is contained in:
dave 2018-05-31 11:41:57 -04:00
commit d3214b9cf6
1 changed files with 11 additions and 0 deletions

11
buzz_scripts/testLJ.bzz Normal file → Executable file
View File

@ -24,6 +24,7 @@ function init() {
# Starting state: TURNEDOFF to wait for user input. # Starting state: TURNEDOFF to wait for user input.
BVMSTATE = "TURNEDOFF" BVMSTATE = "TURNEDOFF"
TAKEOFF_COUNTER = 20
} }
# Executed at each time step. # Executed at each time step.
@ -50,6 +51,16 @@ function step() {
statef() statef()
log("Current state: ", BVMSTATE) log("Current state: ", BVMSTATE)
# Auto-takeoff (delayed for simulator boot)
if(id == 0) {
if(TAKEOFF_COUNTER>0)
TAKEOFF_COUNTER = TAKEOFF_COUNTER - 1
else if(TAKEOFF_COUNTER == 0) {
BVMSTATE="LAUNCH"
TAKEOFF_COUNTER = -1
}
}
} }
# Executed once when the robot (or the simulator) is reset. # Executed once when the robot (or the simulator) is reset.