|
|
|
@ -1970,7 +1970,49 @@ function'''
@@ -1970,7 +1970,49 @@ function'''
|
|
|
|
|
self.reboot_sitl() |
|
|
|
|
self.assert_receive_message('ADSB_VEHICLE', timeout=30) |
|
|
|
|
|
|
|
|
|
def test_adsb(self): |
|
|
|
|
def ADSB(self): |
|
|
|
|
self.ADSB_f_action_rtl() |
|
|
|
|
self.ADSB_r_action_resume_or_loiter() |
|
|
|
|
|
|
|
|
|
def ADSB_r_action_resume_or_loiter(self): |
|
|
|
|
'''ensure we resume auto mission or enter loiter''' |
|
|
|
|
self.set_parameters({ |
|
|
|
|
"ADSB_TYPE": 1, |
|
|
|
|
"AVD_ENABLE": 1, |
|
|
|
|
"AVD_F_ACTION": mavutil.mavlink.MAV_COLLISION_ACTION_MOVE_HORIZONTALLY, |
|
|
|
|
"AVD_F_RCVRY": 3, # resume auto or loiter |
|
|
|
|
}) |
|
|
|
|
self.reboot_sitl() |
|
|
|
|
self.takeoff(50) |
|
|
|
|
# fly North, create thread to east, wait for flying east |
|
|
|
|
self.start_subtest("Testing loiter resume") |
|
|
|
|
self.reach_heading_manual(0) |
|
|
|
|
here = self.mav.location() |
|
|
|
|
self.test_adsb_send_threatening_adsb_message(here, offset_ne=(0, 30)) |
|
|
|
|
self.wait_mode('AVOID_ADSB') |
|
|
|
|
# recovery has the vehicle circling a point... but we don't |
|
|
|
|
# know which point. So wait 'til it looks like it is |
|
|
|
|
# circling, then grab the point, then check we're circling |
|
|
|
|
# it... |
|
|
|
|
self.wait_heading(290) |
|
|
|
|
self.wait_heading(300) |
|
|
|
|
dest = self.position_target_loc() |
|
|
|
|
REALLY_BAD_FUDGE_FACTOR = 1.25 # FIXME |
|
|
|
|
expected_radius = REALLY_BAD_FUDGE_FACTOR * self.get_parameter('WP_LOITER_RAD') |
|
|
|
|
self.wait_circling_point_with_radius(dest, expected_radius) |
|
|
|
|
|
|
|
|
|
self.start_subtest("Testing mission resume") |
|
|
|
|
self.reach_heading_manual(270) |
|
|
|
|
self.load_generic_mission("CMAC-circuit.txt", strict=False) |
|
|
|
|
self.change_mode('AUTO') |
|
|
|
|
self.wait_current_waypoint(2) |
|
|
|
|
self.test_adsb_send_threatening_adsb_message(here, offset_ne=(0, 30)) |
|
|
|
|
self.wait_mode('AVOID_ADSB') |
|
|
|
|
self.wait_mode('AUTO') |
|
|
|
|
|
|
|
|
|
self.fly_home_land_and_disarm() |
|
|
|
|
|
|
|
|
|
def ADSB_f_action_rtl(self): |
|
|
|
|
self.context_push() |
|
|
|
|
ex = None |
|
|
|
|
try: |
|
|
|
@ -3616,7 +3658,7 @@ function'''
@@ -3616,7 +3658,7 @@ function'''
|
|
|
|
|
|
|
|
|
|
("ADSB", |
|
|
|
|
"Test ADSB", |
|
|
|
|
self.test_adsb), |
|
|
|
|
self.ADSB), |
|
|
|
|
|
|
|
|
|
("SimADSB", |
|
|
|
|
"Test SIM_ADSB", |
|
|
|
|