I'm trying to change the guided mode to loiter when vehicle reaches a point. but as soon as mode changes , the altitude is becoming zero - vehicle crashes in simulator.
Do i have specify any altitude before changing to loiter mode ?
#change the mode to loiter and wait for 10 seconds
vehicle.mode = VehicleMode("LOITER")
while not vehicle.mode.name == "LOITER":
print "Waiting for vehicle to change to LOITER Mode"
sleep(1)