1
- #!/usr/bin/env python3
2
- '''waypoint command handling'''
1
+ '''
2
+ waypoint command handling
3
+
4
+ AP_FLAKE8_CLEAN
5
+ '''
3
6
4
7
from MAVProxy .modules .lib import mission_item_protocol
5
8
from MAVProxy .modules .lib import mp_util
@@ -233,15 +236,14 @@ def get_default_frame(self):
233
236
return mavutil .mavlink .MAV_FRAME_GLOBAL_TERRAIN_ALT
234
237
return mavutil .mavlink .MAV_FRAME_GLOBAL_RELATIVE_ALT
235
238
236
-
237
239
def get_WP0 (self , home_only = False ):
238
240
'''get a location for WP0 when building a mission
239
241
this ideally should be home, but if home is not available then use a click position
240
242
'''
241
- (lat ,lon ,alt ) = (None ,None ,None )
243
+ (lat , lon , alt ) = (None , None , None )
242
244
if 'HOME_POSITION' in self .master .messages :
243
245
h = self .master .messages ['HOME_POSITION' ]
244
- (lat ,lon ,alt ) = (h .latitude * 1.0e-7 , h .longitude * 1.0e-7 , h .altitude * 1.0e-3 )
246
+ (lat , lon , alt ) = (h .latitude * 1.0e-7 , h .longitude * 1.0e-7 , h .altitude * 1.0e-3 )
245
247
elif home_only :
246
248
return None
247
249
elif self .wploader .count () > 0 :
@@ -250,7 +252,7 @@ def get_WP0(self, home_only=False):
250
252
latlon = self .mpstate .click_location
251
253
if latlon is None :
252
254
return None
253
- (lat ,lon ,alt ) = (latlon [0 ],latlon [1 ],0 )
255
+ (lat , lon , alt ) = (latlon [0 ], latlon [1 ], 0 )
254
256
if lat is None or lon is None :
255
257
return None
256
258
w = mavutil .mavlink .MAVLink_mission_item_message (self .target_system ,
@@ -259,13 +261,13 @@ def get_WP0(self, home_only=False):
259
261
0 ,
260
262
mavutil .mavlink .MAV_CMD_NAV_WAYPOINT ,
261
263
0 , 0 , 0 , 0 , 0 , 0 ,
262
- lat ,lon ,alt )
264
+ lat , lon , alt )
263
265
return w
264
266
265
267
def get_home (self ):
266
268
'''get a location for home'''
267
269
return self .get_WP0 (home_only = True )
268
-
270
+
269
271
def wp_draw_callback (self , points ):
270
272
'''callback from drawing waypoints'''
271
273
if len (points ) < 2 :
0 commit comments