AP_Vehicle: move beacon up to AP_Vehicle

Instantiate the AP_Beacon object, its BCN parameters, init and scheduler task in AP_Vehicle so all vehicles share a single beacon instance.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Peter Barker
2026-06-30 10:28:56 +10:00
committed by Peter Barker
co-authored by Claude Opus 4.8
parent 5019c62483
commit d1dc639074
2 changed files with 24 additions and 0 deletions
+14
View File
@@ -292,6 +292,12 @@ const AP_Param::GroupInfo AP_Vehicle::var_info[] = {
AP_SUBGROUPINFO(rpm_sensor, "RPM", 32, AP_Vehicle, AP_RPM),
#endif
#if AP_BEACON_ENABLED
// @Group: BCN
// @Path: ../AP_Beacon/AP_Beacon.cpp
AP_SUBGROUPINFO(beacon, "BCN", 33, AP_Vehicle, AP_Beacon),
#endif // AP_BEACON_ENABLED
AP_GROUPEND
};
@@ -428,6 +434,11 @@ void AP_Vehicle::setup()
AP::gripper().init();
#endif
// init beacons used for non-gps position estimation
#if AP_BEACON_ENABLED
beacon.init();
#endif // AP_BEACON_ENABLED
// init_ardupilot is where the vehicle does most of its initialisation.
init_ardupilot();
@@ -621,6 +632,9 @@ const AP_Scheduler::Task AP_Vehicle::scheduler_tasks[] = {
#if HAL_GYROFFT_ENABLED
FAST_TASK_CLASS(AP_GyroFFT, &vehicle.gyro_fft, sample_gyros),
#endif
#if AP_BEACON_ENABLED
SCHED_TASK_CLASS(AP_Beacon, &vehicle.beacon, update, 400, 200, 24),
#endif // AP_BEACON_ENABLED
#if AP_AIRSPEED_ENABLED
SCHED_TASK_CLASS(AP_Airspeed, &vehicle.airspeed, update, 10, 100, 41), // NOTE: the priority number here should be right before Plane's calc_airspeed_errors
#endif
+10
View File
@@ -81,6 +81,11 @@
#include <AP_Gripper/AP_Gripper.h>
#endif
#include <AP_Beacon/AP_Beacon_config.h>
#if AP_BEACON_ENABLED
#include <AP_Beacon/AP_Beacon.h>
#endif // AP_BEACON_ENABLED
#include <AP_RPM/AP_RPM_config.h>
#if AP_RPM_ENABLED
#include <AP_RPM/AP_RPM.h>
@@ -376,6 +381,11 @@ protected:
AP_Gripper gripper;
#endif
#if AP_BEACON_ENABLED
// beacon (non-GPS positioning) library
AP_Beacon beacon;
#endif // AP_BEACON_ENABLED
#if AP_IBUS_TELEM_ENABLED
AP_IBus_Telem ibus_telem;
#endif