Power & Battery Management

This section covers power management, battery monitoring, and electrical systems.

AP_BattMonitor (Battery Monitor)

Header: libraries/AP_BattMonitor/AP_BattMonitor.h

Inheritance: None (top-level class)

Description: Battery monitoring system for voltage, current, capacity tracking, and failsafe functionality. Essential for safe flight operations and battery management.

Key Features:

  • Multiple battery backend support (Analog, SMBus, DroneCAN, INA2XX)

  • Voltage and current monitoring

  • Capacity tracking (mAh consumed)

  • Cell voltage monitoring for smart batteries

  • Battery failsafe functionality

Detailed Documentation:

AP_BattMonitor Detailed Reference - Detailed AP_BattMonitor API Reference

Related Classes (Backends):

  • AP_BattMonitor_Analog - Analog voltage/current sensor

  • AP_BattMonitor_SMBus - SMBus smart battery

  • AP_BattMonitor_DroneCAN - DroneCAN battery

  • AP_BattMonitor_INA2XX - INA2XX current sensor

  • AP_BattMonitor_EFI - Engine fuel monitoring

Usage Example:

AP_BattMonitor *battery = AP_BattMonitor::get_singleton();

// In main loop
battery->read();

if (battery->healthy()) {
    float voltage = battery->voltage();
    float current = battery->current();
    float remaining = battery->capacity_remaining_pct();

    Serial.printf("V: %.2fV, A: %.2fA, %%: %.1f%%\n",
                voltage, current, remaining);
}

AP_RPM (RPM Sensors)

Header: libraries/AP_RPM/AP_Rangefinder.h

Inheritance: None (top-level class)

Description: RPM (Revolutions Per Minute) sensor interface for motor and propeller speed monitoring.

Related Classes:

  • AP_RPM_Backend - Base class for RPM backends

Usage Example:

AP_RPM *rpm = AP_RPM::get_singleton();

// Get RPM readings
float rpm_value = rpm->get_rpm(0);