function takeOffOrLandInternal() {
    looping = false;
    if (!takeoffLandStart || previousTakeoffStatus != status.mode) {
      takeoffLandStart = Date.now();
      previousTakeoffStatus = status.mode;
    } else {
      // five seconds
      if (takeoffLandStart + 5000 < Date.now()) {
        takeoffLandStart = 0;
        if (status.mode == TAKEOFF) {
          looping = true;
          loop();
        }
        return;
      }
    }

    commands = [
      // Take off
      new DRONE.Command('REF', [
        status.mode
      ])

    ];

    // send and reschedule
    sendCommands(commands);
    setTimeout(takeOffOrLandInternal, 500);
  }
The takeoff loop. This should keep sending the REF command until the 
navdata shows that it has taken off, but since we don't yet interpret navdata,
let's just keep it doing this for four seconds.