diff --git a/ArduPlane/ArduPlane.cpp b/ArduPlane/ArduPlane.cpp index 7d27791de5..438d274964 100644 --- a/ArduPlane/ArduPlane.cpp +++ b/ArduPlane/ArduPlane.cpp @@ -70,6 +70,7 @@ const AP_Scheduler::Task Plane::scheduler_tasks[] = { SCHED_TASK(update_compass, 10, 200, 39), SCHED_TASK(calc_airspeed_errors, 10, 100, 42), SCHED_TASK(update_alt, 10, 200, 45), + SCHED_TASK_CLASS(AP_AngleSensor_AS5600, &plane.aoa_sensor, update, 10, 200, 46), SCHED_TASK(adjust_altitude_target, 10, 200, 48), #if AP_ADVANCEDFAILSAFE_ENABLED SCHED_TASK(afs_fs_check, 10, 100, 51), diff --git a/ArduPlane/Plane.h b/ArduPlane/Plane.h index df180b6f74..f3d6a4b10f 100644 --- a/ArduPlane/Plane.h +++ b/ArduPlane/Plane.h @@ -74,6 +74,7 @@ #include #include +#include //Magnetic Encoder library, line added by Cole #include // Optical Flow library #include @@ -100,6 +101,8 @@ #include "tuning.h" #endif + + // Configuration #include "config.h" @@ -239,6 +242,8 @@ private: AP_RPM rpm_sensor; #endif + AP_AngleSensor_AS5600 aoa_sensor{2, 0x36}; //This is code added by Cole + AP_TECS TECS_controller{ahrs, aparm, landing, MASK_LOG_TECS}; AP_L1_Control L1_controller{ahrs, &TECS_controller}; diff --git a/ArduPlane/system.cpp b/ArduPlane/system.cpp index 5aabf77331..e90b808b62 100644 --- a/ArduPlane/system.cpp +++ b/ArduPlane/system.cpp @@ -175,6 +175,8 @@ void Plane::init_ardupilot() g2.ice_control.init(); #endif + //Code added by Cole, initialize AS5600 sensor + aoa_sensor.init(); } #if AP_FENCE_ENABLED diff --git a/ArduPlane/wscript b/ArduPlane/wscript index 930fec0b53..b4964c9a50 100644 --- a/ArduPlane/wscript +++ b/ArduPlane/wscript @@ -24,6 +24,7 @@ def build(bld): 'AP_LTM_Telem', 'AP_Devo_Telem', 'AC_AutoTune', + 'AP_AngleSensor', 'AP_Follow', 'AC_PrecLand', 'AP_IRLock',