From a32738fd5f982e3ef0e3f263cc3f691bce794e5a Mon Sep 17 00:00:00 2001 From: Julien BERAUD Date: Tue, 8 Dec 2015 11:38:43 +0100 Subject: [PATCH] AP_OpticalFlow: Update test declaration Declare a dummy vehicle to get a dummy ahrs. No problem since this code is not used apart from compilation. Needed to declare an optical flow. --- .../AP_OpticalFlow_test.cpp | 25 ++++++++++++++++++- .../examples/AP_OpticalFlow_test/make.inc | 4 +++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/libraries/AP_OpticalFlow/examples/AP_OpticalFlow_test/AP_OpticalFlow_test.cpp b/libraries/AP_OpticalFlow/examples/AP_OpticalFlow_test/AP_OpticalFlow_test.cpp index 40debb68e0..31e8753a0b 100644 --- a/libraries/AP_OpticalFlow/examples/AP_OpticalFlow_test/AP_OpticalFlow_test.cpp +++ b/libraries/AP_OpticalFlow/examples/AP_OpticalFlow_test/AP_OpticalFlow_test.cpp @@ -3,12 +3,35 @@ * Code by Randy Mackay. DIYDrones.com */ +#include +#include +#include +#include #include +#include +#include +#include #include +#include const AP_HAL::HAL& hal = AP_HAL::get_HAL(); -static OpticalFlow optflow; +class DummyVehicle { +public: + AP_GPS gps; + AP_Baro barometer; + Compass compass; + AP_InertialSensor ins; + AP_SerialManager serial_manager; + RangeFinder sonar {serial_manager}; + AP_AHRS_NavEKF ahrs{ins, barometer, gps, sonar, EKF, EKF2, + AP_AHRS_NavEKF::FLAG_ALWAYS_USE_EKF}; + NavEKF EKF{&ahrs, barometer, sonar}; + NavEKF2 EKF2{&ahrs, barometer, sonar}; +}; + +static DummyVehicle vehicle; +static OpticalFlow optflow(vehicle.ahrs); void setup() { diff --git a/libraries/AP_OpticalFlow/examples/AP_OpticalFlow_test/make.inc b/libraries/AP_OpticalFlow/examples/AP_OpticalFlow_test/make.inc index 9a70c94fe3..9831431a03 100644 --- a/libraries/AP_OpticalFlow/examples/AP_OpticalFlow_test/make.inc +++ b/libraries/AP_OpticalFlow/examples/AP_OpticalFlow_test/make.inc @@ -21,3 +21,7 @@ LIBRARIES += DataFlash LIBRARIES += Filter LIBRARIES += GCS_MAVLink LIBRARIES += StorageManager +LIBRARIES += AP_NavEKF +LIBRARIES += AP_NavEKF2 +LIBRARIES += AP_RangeFinder +LIBRARIES += AP_SerialManager