File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -317,8 +317,17 @@ TABS.mission_control.initialize = function (callback) {
317
317
// var coord = ol.proj.fromLonLat([MISSION_PLANER.bufferPoint.lon, MISSION_PLANER.bufferPoint.lat]); //buzz
318
318
// rthGeo.setCoordinates(coord);
319
319
// });
320
- var h_lat = FC . curr_mav_state [ 'HOME_POSITION' ] . latitude / 10000000 ;
321
- var h_lng = FC . curr_mav_state [ 'HOME_POSITION' ] . longitude / 10000000 ;
320
+
321
+ // if the drone has given us its HOME_POSITION, then use that otherwise fall back to its current GPS co-ord.
322
+ var h_lat ;
323
+ var h_lng ;
324
+ if ( FC . curr_mav_state [ 'HOME_POSITION' ] ) {
325
+ h_lat = FC . curr_mav_state [ 'HOME_POSITION' ] . latitude / 10000000 ;
326
+ h_lng = FC . curr_mav_state [ 'HOME_POSITION' ] . longitude / 10000000 ;
327
+ } else {
328
+ h_lat = FC . curr_mav_state [ 'GLOBAL_POSITION_INT' ] . lat / 10000000 ;
329
+ h_lng = FC . curr_mav_state [ 'GLOBAL_POSITION_INT' ] . lon / 10000000 ;
330
+ }
322
331
// buzz set home..
323
332
var coord = ol . proj . fromLonLat ( [ h_lng , h_lat ] ) ;
324
333
rthGeo . setCoordinates ( coord ) ;
You can’t perform that action at this time.
0 commit comments