<s> """<STR_LIT>""" <EOL> from dronekit import connect , VehicleMode , LocationGlobalRelative <EOL> import time <EOL> import argparse <EOL> parser = argparse . ArgumentParser ( description = '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT>' , <EOL> help = "<STR_LIT>" ) <EOL> args = parser . parse_args ( ) <EOL> connection_string = args . connect <EOL> sitl = None <EOL> if not args . connect : <EOL> print "<STR_LIT>" <EOL> from dronekit_sitl import SITL <EOL> sitl = SITL ( ) <EOL> sitl . download ( '<STR_LIT>' , '<STR_LIT>' , verbose = True ) <EOL> sitl_args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> sitl . launch ( sitl_args , await_ready = True , restart = True ) <EOL> connection_string = '<STR_LIT>' <EOL> print '<STR_LIT>' % connection_string <EOL> vehicle = connect ( connection_string , wait_ready = True ) <EOL> def arm_and_takeoff ( aTargetAltitude ) : <EOL> """<STR_LIT>""" <EOL> print "<STR_LIT>" <EOL> while not vehicle . is_armable : <EOL> print "<STR_LIT>" <EOL> time . sleep ( <NUM_LIT:1> ) <EOL> print "<STR_LIT>" <EOL> vehicle . mode = VehicleMode ( "<STR_LIT>" ) <EOL> vehicle . armed = True <EOL> while not vehicle . armed : <EOL> print "<STR_LIT>" <EOL> time . sleep ( <NUM_LIT:1> ) <EOL> print "<STR_LIT>" <EOL> vehicle . simple_takeoff ( aTargetAltitude ) <EOL> while True : <EOL> print "<STR_LIT>" , vehicle . location . global_relative_frame . alt <EOL> if vehicle . location . global_relative_frame . alt >= aTargetAltitude * <NUM_LIT> : <EOL> print "<STR_LIT>" <EOL> break <EOL> time . sleep ( <NUM_LIT:1> ) <EOL> arm_and_takeoff ( <NUM_LIT:10> ) <EOL> print "<STR_LIT>" <EOL> vehicle . airspeed = <NUM_LIT:3> <EOL> print "<STR_LIT>" <EOL> point1 = LocationGlobalRelative ( - <NUM_LIT> , <NUM_LIT> , <NUM_LIT:20> ) <EOL> vehicle . simple_goto ( point1 ) <EOL> time . sleep ( <NUM_LIT:30> ) <EOL> print "<STR_LIT>" <EOL> point2 = LocationGlobalRelative ( - <NUM_LIT> , <NUM_LIT> , <NUM_LIT:20> ) <EOL> vehicle . simple_goto ( point2 , groundspeed = <NUM_LIT:10> ) <EOL> time . sleep ( <NUM_LIT:30> ) <EOL> print "<STR_LIT>" <EOL> vehicle . mode = VehicleMode ( "<STR_LIT>" ) <EOL> print "<STR_LIT>" <EOL> vehicle . close ( ) <EOL> if sitl is not None : <EOL> sitl . stop ( ) </s>
