@@ -7709,6 +7709,46 @@ def GSF(self):
7709
7709
raise NotAchievedException ("Did not get %s" % want )
7710
7710
still_want .remove (m .get_type ())
7711
7711
7712
+ def GSF_reset (self ):
7713
+ '''test the Gaussian Sum filter based Emergency reset'''
7714
+ self .context_push ()
7715
+ self .set_parameters ({
7716
+ "COMPASS_ORIENT" : 4 , # yaw 180
7717
+ "COMPASS_USE2" : 0 , # disable backup compasses to avoid pre-arm failures
7718
+ "COMPASS_USE3" : 0 ,
7719
+ })
7720
+ self .reboot_sitl ()
7721
+ self .change_mode ('GUIDED' )
7722
+ self .wait_ready_to_arm ()
7723
+
7724
+ # record starting position
7725
+ startpos = self .mav .recv_match (type = 'LOCAL_POSITION_NED' , blocking = True )
7726
+ self .progress ("startpos=%s" % str (startpos ))
7727
+
7728
+ # arm vehicle and takeoff to at least 5m
7729
+ self .arm_vehicle ()
7730
+ expected_alt = 5
7731
+ self .user_takeoff (alt_min = expected_alt )
7732
+
7733
+ # watch for emergency yaw reset
7734
+ self .wait_text ("EKF3 IMU. emergency yaw reset" , timeout = 5 , regex = True )
7735
+
7736
+ # record how far vehicle flew off
7737
+ endpos = self .mav .recv_match (type = 'LOCAL_POSITION_NED' , blocking = True )
7738
+ delta_x = endpos .x - startpos .x
7739
+ delta_y = endpos .y - startpos .y
7740
+ dist_m = math .sqrt (delta_x * delta_x + delta_y * delta_y )
7741
+ self .progress ("GSF yaw reset triggered at %f meters" % dist_m )
7742
+
7743
+ self .do_RTL ()
7744
+ self .context_pop ()
7745
+ self .reboot_sitl ()
7746
+
7747
+ # ensure vehicle did not fly too far
7748
+ dist_m_max = 8
7749
+ if dist_m > dist_m_max :
7750
+ raise NotAchievedException ("GSF reset failed, vehicle flew too far (%f > %f)" % (dist_m , dist_m_max ))
7751
+
7712
7752
def fly_rangefinder_mavlink (self ):
7713
7753
self .fly_rangefinder_mavlink_distance_sensor ()
7714
7754
@@ -9851,6 +9891,7 @@ def tests2b(self): # this block currently around 9.5mins here
9851
9891
self .AltEstimation ,
9852
9892
self .EKFSource ,
9853
9893
self .GSF ,
9894
+ self .GSF_reset ,
9854
9895
self .AP_Avoidance ,
9855
9896
self .SMART_RTL ,
9856
9897
self .RTL_TO_RALLY ,
0 commit comments