From 30fffb491c776de6837ae0b6b092e706d0be3b4c Mon Sep 17 00:00:00 2001 From: Iampete1 Date: Sat, 14 Aug 2021 22:29:21 +0100 Subject: [PATCH] AP_Vehicle: add AIS --- libraries/AP_Vehicle/AP_Vehicle.cpp | 13 +++++++++++++ libraries/AP_Vehicle/AP_Vehicle.h | 6 ++++++ 2 files changed, 19 insertions(+) diff --git a/libraries/AP_Vehicle/AP_Vehicle.cpp b/libraries/AP_Vehicle/AP_Vehicle.cpp index 8425eb787d..9184eec3da 100644 --- a/libraries/AP_Vehicle/AP_Vehicle.cpp +++ b/libraries/AP_Vehicle/AP_Vehicle.cpp @@ -86,6 +86,12 @@ const AP_Param::GroupInfo AP_Vehicle::var_info[] = { AP_SUBGROUPINFO(esc_telem, "ESC_TLM", 12, AP_Vehicle, AP_ESC_Telem), #endif +#if AP_AIS_ENABLED + // @Group: AIS_ + // @Path: ../AP_AIS/AP_AIS.cpp + AP_SUBGROUPINFO(ais, "AIS_", 13, AP_Vehicle, AP_AIS), +#endif + AP_GROUPEND }; @@ -217,6 +223,10 @@ void AP_Vehicle::setup() efi.init(); #endif +#if AP_AIS_ENABLED + ais.init(); +#endif + custom_rotations.init(); gcs().send_text(MAV_SEVERITY_INFO, "ArduPilot Ready"); @@ -307,6 +317,9 @@ const AP_Scheduler::Task AP_Vehicle::scheduler_tasks[] = { #if HAL_INS_ACCELCAL_ENABLED SCHED_TASK(accel_cal_update, 10, 100, 245), #endif +#if AP_AIS_ENABLED + SCHED_TASK_CLASS(AP_AIS, &vehicle.ais, update, 5, 100, 249), +#endif #if HAL_EFI_ENABLED SCHED_TASK_CLASS(AP_EFI, &vehicle.efi, update, 10, 200, 250), #endif diff --git a/libraries/AP_Vehicle/AP_Vehicle.h b/libraries/AP_Vehicle/AP_Vehicle.h index f5b36abf2c..e6ba27467b 100644 --- a/libraries/AP_Vehicle/AP_Vehicle.h +++ b/libraries/AP_Vehicle/AP_Vehicle.h @@ -51,6 +51,7 @@ #include #include #include +#include class AP_Vehicle : public AP_HAL::HAL::Callbacks { @@ -386,6 +387,11 @@ protected: AP_Airspeed airspeed; #endif +#if AP_AIS_ENABLED + // Automatic Identification System - for tracking sea-going vehicles + AP_AIS ais; +#endif + static const struct AP_Param::GroupInfo var_info[]; static const struct AP_Scheduler::Task scheduler_tasks[];