Home        Store        Docs        Blog

Mavlink message for battery status


I was wondering which mavlink message is used by QGC to draw battery info from Pixhawk. After searching the mavlink message definition, I found the message no: 147 to be handling the battery status from the autopilot. But it says that this message does not output the current from the battery. how does QGC read the current from the battery then?

(Patrick José Pereira) #2


As you can see in the BATTERY_STATUS (#147) message:

id uint8_t Battery ID
battery_function uint8_t Function of the battery
type uint8_t Type (chemistry) of the battery
temperature int16_t Temperature of the battery. INT16_MAX for unknown temperature.
voltages uint16_t[10] Battery voltage of cells. Cells above the valid cell count for this battery should have the UINT16_MAX value.
current_battery int16_t Battery current, -1: autopilot does not measure the current
current_consumed int32_t Consumed charge, -1: autopilot does not provide consumption estimate
energy_consumed int32_t Consumed energy, -1: autopilot does not provide energy consumption estimate
battery_remaining int8_t Remaining battery energy. Values: [0-100], -1: autopilot does not estimate the remaining battery.
time_remaining int32_t Remaining battery time, 0: autopilot does not provide remaining battery time estimate
charge_state uint8_t State for extent of discharge, provided by autopilot for warning or external reactions

The “autopilot does not measure the current” is a reference for the return value of -1. All valid fields will return values different from -1 :slight_smile:

(Jacob) #3

Note that ArduSub does not use the current_consumed field. I’m not sure if we report 0 or -1. The current_battery field is updated, however.


How does QGC do current reporting? Some mavlink message involved?

(Patrick José Pereira) #5

With BATTERY_STATUS message, ArduSub will send it with all necessary data.


Thanks. :smile: My bad I didn’t read properly

(Patrick José Pereira) #7

Please let me know if you need any further help.