|
|
|
@ -1867,6 +1867,31 @@ class AutoTestCopter(AutoTest):
@@ -1867,6 +1867,31 @@ class AutoTestCopter(AutoTest):
|
|
|
|
|
if ex is not None: |
|
|
|
|
raise ex |
|
|
|
|
|
|
|
|
|
def configure_EKFs_to_use_optical_flow_instead_of_GPS(self): |
|
|
|
|
'''configure EKF to use optical flow instead of GPS''' |
|
|
|
|
ahrs_ekf_type = self.get_parameter("AHRS_EKF_TYPE") |
|
|
|
|
if ahrs_ekf_type == 2: |
|
|
|
|
self.set_parameter("EK2_GPS_TYPE", 3) |
|
|
|
|
if ahrs_ekf_type == 3: |
|
|
|
|
self.set_parameters({ |
|
|
|
|
"EK3_SRC1_POSXY": 0, |
|
|
|
|
"EK3_SRC1_VELXY": 5, |
|
|
|
|
"EK3_SRC1_VELZ": 0, |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
def optical_flow(self): |
|
|
|
|
'''test optical low works''' |
|
|
|
|
self.start_subtest("Make sure no crash if no rangefinder") |
|
|
|
|
self.set_parameter("SIM_FLOW_ENABLE", 1) |
|
|
|
|
self.set_parameter("FLOW_TYPE", 10) |
|
|
|
|
|
|
|
|
|
self.configure_EKFs_to_use_optical_flow_instead_of_GPS() |
|
|
|
|
|
|
|
|
|
self.reboot_sitl() |
|
|
|
|
self.change_mode('LOITER') |
|
|
|
|
self.delay_sim_time(5) |
|
|
|
|
self.wait_statustext("Need Position Estimate", timeout=300) |
|
|
|
|
|
|
|
|
|
# fly_optical_flow_limits - test EKF navigation limiting |
|
|
|
|
def fly_optical_flow_limits(self): |
|
|
|
|
ex = None |
|
|
|
@ -1876,14 +1901,7 @@ class AutoTestCopter(AutoTest):
@@ -1876,14 +1901,7 @@ class AutoTestCopter(AutoTest):
|
|
|
|
|
self.set_parameter("SIM_FLOW_ENABLE", 1) |
|
|
|
|
self.set_parameter("FLOW_TYPE", 10) |
|
|
|
|
|
|
|
|
|
# configure EKF to use optical flow instead of GPS |
|
|
|
|
ahrs_ekf_type = self.get_parameter("AHRS_EKF_TYPE") |
|
|
|
|
if ahrs_ekf_type == 2: |
|
|
|
|
self.set_parameter("EK2_GPS_TYPE", 3) |
|
|
|
|
if ahrs_ekf_type == 3: |
|
|
|
|
self.set_parameter("EK3_SRC1_POSXY", 0) |
|
|
|
|
self.set_parameter("EK3_SRC1_VELXY", 5) |
|
|
|
|
self.set_parameter("EK3_SRC1_VELZ", 0) |
|
|
|
|
self.configure_EKFs_to_use_optical_flow_instead_of_GPS() |
|
|
|
|
|
|
|
|
|
self.set_analog_rangefinder_parameters() |
|
|
|
|
|
|
|
|
@ -6860,6 +6878,10 @@ class AutoTestCopter(AutoTest):
@@ -6860,6 +6878,10 @@ class AutoTestCopter(AutoTest):
|
|
|
|
|
"Test magnetometer failure", |
|
|
|
|
self.test_mag_fail), |
|
|
|
|
|
|
|
|
|
("OpticalFlow", |
|
|
|
|
"Test Optical Flow", |
|
|
|
|
self.optical_flow), |
|
|
|
|
|
|
|
|
|
("OpticalFlowLimits", |
|
|
|
|
"Fly Optical Flow limits", |
|
|
|
|
self.fly_optical_flow_limits), # 27s |
|
|
|
|