<s> """<STR_LIT>""" <EOL> import time <EOL> from dronekit import connect , VehicleMode , LocationGlobalRelative <EOL> from dronekit . test import with_sitl <EOL> from nose . tools import assert_equals <EOL> @ with_sitl <EOL> def test_goto ( connpath ) : <EOL> vehicle = connect ( connpath , wait_ready = True ) <EOL> vehicle . parameters [ '<STR_LIT>' ] = <NUM_LIT:0> <EOL> vehicle . parameters [ '<STR_LIT>' ] = <NUM_LIT:100> <EOL> def arm_and_takeoff ( aTargetAltitude ) : <EOL> """<STR_LIT>""" <EOL> i = <NUM_LIT> <EOL> while not vehicle . is_armable and i > <NUM_LIT:0> : <EOL> time . sleep ( <NUM_LIT:1> ) <EOL> i = i - <NUM_LIT:1> <EOL> assert_equals ( vehicle . is_armable , True ) <EOL> vehicle . mode = VehicleMode ( "<STR_LIT>" ) <EOL> i = <NUM_LIT> <EOL> while vehicle . mode . name != '<STR_LIT>' and i > <NUM_LIT:0> : <EOL> time . sleep ( <NUM_LIT:1> ) <EOL> i = i - <NUM_LIT:1> <EOL> assert_equals ( vehicle . mode . name , '<STR_LIT>' ) <EOL> vehicle . armed = True <EOL> i = <NUM_LIT> <EOL> while not vehicle . armed and vehicle . mode . name == '<STR_LIT>' and i > <NUM_LIT:0> : <EOL> time . sleep ( <NUM_LIT:1> ) <EOL> i = i - <NUM_LIT:1> <EOL> assert_equals ( vehicle . armed , True ) <EOL> vehicle . simple_takeoff ( aTargetAltitude ) <EOL> while True : <EOL> if vehicle . location . global_frame . alt >= aTargetAltitude * <NUM_LIT> : <EOL> break <EOL> assert_equals ( vehicle . mode . name , '<STR_LIT>' ) <EOL> time . sleep ( <NUM_LIT:1> ) <EOL> arm_and_takeoff ( <NUM_LIT:10> ) <EOL> point1 = LocationGlobalRelative ( - <NUM_LIT> , <NUM_LIT> , <NUM_LIT:20> ) <EOL> vehicle . simple_goto ( point1 ) <EOL> time . sleep ( <NUM_LIT:3> ) <EOL> point2 = LocationGlobalRelative ( - <NUM_LIT> , <NUM_LIT> , <NUM_LIT:20> ) <EOL> vehicle . simple_goto ( point2 ) <EOL> time . sleep ( <NUM_LIT:3> ) <EOL> vehicle . mode = VehicleMode ( "<STR_LIT>" ) <EOL> vehicle . close ( ) </s>
