1
- import sys
1
+ from __future__ import print_function
2
+ import sys
2
3
import math
3
4
import clr
4
5
import time
@@ -25,10 +26,10 @@ def gps_distance(lat1, lon1, lat2, lon2):
25
26
c = 2.0 * atan2 (sqrt (a ), sqrt (1.0 - a ))
26
27
return radius_of_earth * c
27
28
28
- print __name__
29
+ print ( __name__ )
29
30
30
31
# main program
31
- print "Start script"
32
+ print ( "Start script" )
32
33
######Mission variables######
33
34
dist_tolerance = 15 #(m)
34
35
ber_tolerance = 45 #heading tolerance
@@ -43,23 +44,23 @@ def gps_distance(lat1, lon1, lat2, lon2):
43
44
target = (- 35 , 117.98 ) # gps pos of target in degrees
44
45
45
46
time .sleep (5 ) # wait 10 seconds before starting
46
- print 'Starting Mission'
47
+ print ( 'Starting Mission' )
47
48
Script .ChangeMode ("Guided" ) # changes mode to "Guided"
48
49
item = MissionPlanner .Utilities .Locationwp () # creating waypoint
49
50
50
51
alt = 60.000000 # altitude value
51
52
Locationwp .lat .SetValue (item ,target [0 ]) # sets latitude
52
53
Locationwp .lng .SetValue (item ,target [1 ]) # sets longitude
53
54
Locationwp .alt .SetValue (item ,alt ) # sets altitude
54
- print 'Drop zone set'
55
+ print ( 'Drop zone set' )
55
56
MAV .setGuidedModeWP (item ) # tells UAV "go to" the set lat/long @ alt
56
- print 'Going to DZ'
57
+ print ( 'Going to DZ' )
57
58
Good = True
58
59
while Good == True :
59
60
ground_speed = cs .groundspeed
60
61
alt = cs .alt
61
62
wp_dist = gps_distance (cs .lat ,cs .lng , math .radians (target [0 ]), math .radians (target [1 ]))
62
- print wp_dist
63
+ print ( wp_dist )
63
64
ber_error = cs .ber_error
64
65
fall_time = ((2 * alt ) / gravity ) ** (0.5 )
65
66
fall_dist = ground_speed * fall_time
@@ -69,12 +70,12 @@ def gps_distance(lat1, lon1, lat2, lon2):
69
70
if (math .fabs (ber_error ) <= ber_tolerance ):
70
71
######Payload Release######
71
72
Script .SendRC (payload_servo ,1900 ,True )
72
- print 'Bombs away!'
73
+ print ( 'Bombs away!' )
73
74
else :
74
- print 'Heading outside of threshold, go around!'
75
+ print ( 'Heading outside of threshold, go around!' )
75
76
Good = False
76
77
else :
77
- print 'Outside of threshold!'
78
+ print ( 'Outside of threshold!' )
78
79
time .sleep (1.0 ) #sleep for a second
79
80
#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