def arm_and_takeoff(aTargetAltitude):
    """
    Arms vehicle and fly to aTargetAltitude.
    """

    print "Basic pre-arm checks"
    # Don't let the user try to arm until autopilot is ready
    while not vehicle.is_armable:
        print " Waiting for vehicle to initialise..."
        time.sleep(1)

        
    print "Arming motors"
    # Copter should arm in GUIDED mode
    vehicle.mode = VehicleMode("GUIDED")
    vehicle.armed = True

    while not vehicle.armed:      
        print " Waiting for arming..."
        time.sleep(1)

    print "Taking off!"
    vehicle.simple_takeoff(aTargetAltitude) # Take off to target altitude

    # Wait until the vehicle reaches a safe height before processing the goto (otherwise the command 
    #  after Vehicle.simple_takeoff will execute immediately).
    while True:
        print " Altitude: ", vehicle.location.global_relative_frame.alt      
        if aTargetAltitude*0.95 >= vehicle.location.global_relative_frame.alt: #Trigger just below target alt.
            print "Reached target altitude"
            break
        time.sleep(1)


#Arm and take of to altitude of 5 meters
dataset/ETHPy150Open dronekit/dronekit-python/examples/guided_set_speed_yaw/guided_set_speed_yaw.py/arm_and_takeoff/swapped operands of `>=`