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)
Others who are facing the same issue. assiging 1500 to throttle (after takeoff ?) will solve the issue.
armAndTakeOff()
#set the channel overrides which avoids crashing when mode changed to loiter
print "setting throttle channel to 1500 via channel overrides"
vehicle.channels.overrides['3'] = 1500
I dont know is this proper way or not, since dronekit doc highly dis-commended using rc overrides