1- import sys
1+ from __future__ import print_function
2+ import sys
23import math
34import clr
45import time
@@ -25,10 +26,10 @@ def gps_distance(lat1, lon1, lat2, lon2):
2526 c = 2.0 * atan2 (sqrt (a ), sqrt (1.0 - a ))
2627 return radius_of_earth * c
2728
28- print __name__
29+ print ( __name__ )
2930
3031# main program
31- print "Start script"
32+ print ( "Start script" )
3233######Mission variables######
3334dist_tolerance = 15 #(m)
3435ber_tolerance = 45 #heading tolerance
@@ -43,23 +44,23 @@ def gps_distance(lat1, lon1, lat2, lon2):
4344target = (- 35 , 117.98 ) # gps pos of target in degrees
4445
4546time .sleep (5 ) # wait 10 seconds before starting
46- print 'Starting Mission'
47+ print ( 'Starting Mission' )
4748Script .ChangeMode ("Guided" ) # changes mode to "Guided"
4849item = MissionPlanner .Utilities .Locationwp () # creating waypoint
4950
5051alt = 60.000000 # altitude value
5152Locationwp .lat .SetValue (item ,target [0 ]) # sets latitude
5253Locationwp .lng .SetValue (item ,target [1 ]) # sets longitude
5354Locationwp .alt .SetValue (item ,alt ) # sets altitude
54- print 'Drop zone set'
55+ print ( 'Drop zone set' )
5556MAV .setGuidedModeWP (item ) # tells UAV "go to" the set lat/long @ alt
56- print 'Going to DZ'
57+ print ( 'Going to DZ' )
5758Good = True
5859while Good == True :
5960 ground_speed = cs .groundspeed
6061 alt = cs .alt
6162 wp_dist = gps_distance (cs .lat ,cs .lng , math .radians (target [0 ]), math .radians (target [1 ]))
62- print wp_dist
63+ print ( wp_dist )
6364 ber_error = cs .ber_error
6465 fall_time = ((2 * alt ) / gravity ) ** (0.5 )
6566 fall_dist = ground_speed * fall_time
@@ -69,12 +70,12 @@ def gps_distance(lat1, lon1, lat2, lon2):
6970 if (math .fabs (ber_error ) <= ber_tolerance ):
7071 ######Payload Release######
7172 Script .SendRC (payload_servo ,1900 ,True )
72- print 'Bombs away!'
73+ print ( 'Bombs away!' )
7374 else :
74- print 'Heading outside of threshold, go around!'
75+ print ( 'Heading outside of threshold, go around!' )
7576 Good = False
7677 else :
77- print 'Outside of threshold!'
78+ print ( 'Outside of threshold!' )
7879 time .sleep (1.0 ) #sleep for a second
7980 #Broken out of the loop as Bearing was not right
80- print 'Bearing was out of tolerance for the Drop - Start run again'
81+ print ( 'Bearing was out of tolerance for the Drop - Start run again' )
0 commit comments