@@ -461,10 +461,11 @@ def joinFigXAxes(self, ax1, ax2):
461461 def posNED (self , fig = None , axs = None ):
462462 if fig is None :
463463 fig = plt .figure ()
464- ax = fig .subplots (3 , (2 if self .residual else 1 ), sharex = True , squeeze = False )
464+ ax = fig .subplots (4 , (2 if self .residual else 1 ), sharex = True , squeeze = False )
465465 self .configureSubplot (ax [0 ,0 ], 'North' , 'm' )
466466 self .configureSubplot (ax [1 ,0 ], 'East' , 'm' )
467467 self .configureSubplot (ax [2 ,0 ], 'Down' , 'm' )
468+ self .configureSubplot (ax [3 ,0 ], 'Distance from start' , 'm' )
468469 fig .suptitle ('INS NED - ' + os .path .basename (os .path .normpath (self .log .directory )))
469470 refLla = None
470471 refTime = None
@@ -475,6 +476,7 @@ def posNED(self, fig=None, axs=None):
475476 self .configureSubplot (ax [0 ,1 ], 'North Residual' , 'm' )
476477 self .configureSubplot (ax [1 ,1 ], 'East Residual' , 'm' )
477478 self .configureSubplot (ax [2 ,1 ], 'Down Residual' , 'm' )
479+ self .configureSubplot (ax [3 ,1 ], 'Distance Residual' , 'm' )
478480 # Use 'Ref INS' if available
479481 for d in self .active_devs :
480482 if self .log .serials [d ] == 'Ref INS' :
@@ -506,6 +508,8 @@ def posNED(self, fig=None, axs=None):
506508 continue
507509 if refLla is None :
508510 refLla = lla [0 ]
511+ ned = lla2ned (refLla , lla )
512+ dist = np .sqrt (np .sum ((ned - ned [0 ,:])** 2 , axis = 1 ))
509513 tow = self .getData (d , DID_INS_2 , 'timeOfWeek' , True )
510514 time = getTimeFromGpsTow (tow , True )
511515 ind = getValidTimeInd (time ) & (lla [:,0 ] != 0 )
@@ -515,6 +519,7 @@ def posNED(self, fig=None, axs=None):
515519 ax [0 ,0 ].plot (time , ned [:,0 ], label = self .log .serials [d ])
516520 ax [1 ,0 ].plot (time , ned [:,1 ])
517521 ax [2 ,0 ].plot (time , ned [:,2 ])
522+ ax [3 ,0 ].plot (time , dist )
518523
519524 if (np .shape (self .active_devs )[0 ]== 1 or SHOW_GPS_W_INS ):
520525 timeGPS = getTimeFromGpsTowMs (self .getData (d , DID_GPS1_POS , 'timeOfWeekMs' , True ))
@@ -544,9 +549,11 @@ def posNED(self, fig=None, axs=None):
544549 for i in range (3 ):
545550 intNed [:,i ] = np .interp (refTime , time , ned [:,i ], right = np .nan , left = np .nan )
546551 resNed = intNed - refNed
552+ resDist = np .sqrt (np .sum (resNed ** 2 , axis = 1 ))
547553 ax [0 ,1 ].plot (refTime , resNed [:,0 ], label = self .log .serials [d ])
548554 ax [1 ,1 ].plot (refTime , resNed [:,1 ])
549555 ax [2 ,1 ].plot (refTime , resNed [:,2 ])
556+ ax [3 ,1 ].plot (refTime , resDist )
550557
551558 self .legends_add (ax [0 ,0 ].legend (ncol = 2 ))
552559 if self .residual :
0 commit comments