Commit Graph
12 Commits
Author SHA1 Message Date
SaibernardandJacob Dahl 1a3f7971b9 fix(battery): stop a charging battery from disabling battery failsafes (#29012)
* fix(battery): don't let a charging battery switch off the battery failsafes

Since #28422 a DroneCAN battery that sets its charging flag reports
WARNING_CHARGING, which is 7. The battery check keeps the highest warning
across batteries and, while armed, only lets it rise, but the failsafe has
no action for 7. So one charging report outranked a real emergency on
another pack and stayed latched until disarm, and a vehicle that armed
while still charging on a dock never got a low battery failsafe at all.
The driver also replaced a real low, critical or emergency warning with
charging, so a nearly empty pack on a charger still passed the arming
check.

The driver now reports charging only while the pack has no real warning,
and the battery check treats charging as no warning when it picks the
worst one. MAVLink still shows charging while the pack has no warning.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Saibernard Yogendran <bernie97@seas.upenn.edu>

* test(commander): cover a charging battery in the battery check

A charging pack doesn't outrank another pack's emergency, charging at
arming doesn't latch over a later low or critical warning, and charging
on its own is no warning. All three fail without the fix.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Saibernard Yogendran <bernie97@seas.upenn.edu>

* docs(msg): say WARNING_CHARGING is a state, not a severity

The DroneCAN driver only reports charging when no other warning applies,
and the battery check and HIGH_LATENCY2 stream rely on that and on not
ordering it against the real warnings.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

* fix(mavlink): don't flag a charging battery as failed in HIGH_LATENCY2

WARNING_CHARGING is 7, so the greater-than-LOW test set
HL_FAILURE_FLAG_BATTERY for every healthy pack on a charger.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

---------

Signed-off-by: Saibernard Yogendran <bernie97@seas.upenn.edu>
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
Co-authored-by: Jacob Dahl <dahl.jakejacob@gmail.com>
2026-10-06 19:19:01 -06:00
Freey0 a9a5681000 feat(uavcan): parse STATUS_FLAG_CHARGING from BatteryInfo (#28422)
* feat(uavcan): parse STATUS_FLAG_CHARGING from BatteryInfo

- Map UAVCAN STATUS_FLAG_CHARGING to uORB STATE_CHARGING
- Cover both Raw and Filter data paths
- Enables MAVLink BATTERY_STATUS.charge_state to report CHARGING(7)

* refactor(msg): rename STATE_UNHEALTHY/STATE_CHARGING to WARNING_UNHEALTHY/WARNING_CHARGING

Rename for naming consistency: these enum values belong to the
'warning' field, so they should use the WARNING_ prefix like the
other values (WARNING_NONE, WARNING_LOW, etc.).

Also fix @enum annotation from 'WARNING STATE' to 'WARNING'.
2026-08-30 20:37:06 -06:00
Hamish Willee 2857ad59dc fix(battery): Add invalid sentinel for BatteryStatus remaining_capacity_wh and nominal_voltage (#27236) 2026-04-30 18:19:12 +10:00
Hamish Willee 6bf73d9d89 docs: uORB messages doc standard tweaks 2026-03-04 10:01:40 +01:00
Jacob DahlandHamish Willee e6c49edd20 docs: battery: clarify BAT${i}_SOURCE parameter documentation (#26071)
* docs: battery: clarify Power Module option to state that it works additionally for onboard Analog

* Update src/lib/battery/module.yaml

Co-authored-by: Hamish Willee <hamishwillee@gmail.com>

* Update src/lib/battery/module.yaml

Co-authored-by: Hamish Willee <hamishwillee@gmail.com>

* Update src/lib/battery/module.yaml

* Apply suggestions from code review

* Update msg/versioned/BatteryStatus.msg

---------

Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
2025-12-17 09:58:41 -09:00
Claudio ChiesandBeat Küng 24d06047bd UAVCAN: Add device tracking and information publishing (#25617)
* uavcan: collect node info and publish every second

* UORB: Add DeviceInformation Message

Format DeviceInformation.msg with standard comment spaces

* SENS: add getter for device_id

* UAVCAN: add publishing of DeviceInformation based on publised message type, and Node Information

* LOG: add deviceInformation

* MSG:BAT: fix comment to be inline with the max_instaces

* UAVCAN: DeviceInformation, incorporated feedback

* UAVCAN: DeviceInformation, incorporated feedback

* UAVCAN: DeviceInformation, Fixed bug with Powermonitor

---------

Co-authored-by: Beat Küng <beat-kueng@gmx.net>
2025-12-16 14:53:44 -09:00
Claudio Chies d3acee315a BAT: Consolidate the highest feasible number of batteries into just 3 2025-09-22 15:02:24 +02:00
Hamish WilleeandPX4BuildBot 799f910ca9 uORB message layout fixes (#25581)
* uORB message layout fixes

* Apply suggestions from code review

---------

Co-authored-by: PX4BuildBot <bot@pixhawk.org>
2025-09-19 09:06:01 +10:00
Matthias Grob eccfb18b51 battery_status message: remove serial_number which is now in battery_info message 2025-06-17 09:05:22 +02:00
Hamish WilleeandMatthias Grob e6e42fa043 BatteryStatus.msg - docs update (#24789)
* BatteryStatus.msg - docs update
* Update msg/versioned/BatteryStatus.msg
* Units/enum/range before description
* Update msg/versioned/BatteryStatus.msg
* Apply suggestions from code review

Co-authored-by: Matthias Grob <maetugr@gmail.com>

* MOve MAX_INSTANCES to top

* Fix up full stops

---------

Co-authored-by: Matthias Grob <maetugr@gmail.com>
2025-06-12 16:06:13 +02:00
Sebastian DomoszlaiandMatthias Grob b5f37c9fa6 Simplify Battery-related Enum Naming (#24265)
* Simplify battery-related enum naming

* Fix mistakenly removed string in enum names

* Fix missing renamings

* Update outdated file

* msg: Increase battery_status version since the enum naming was changed

* Revert message version increase

---------

Co-authored-by: Matthias Grob <maetugr@gmail.com>
2025-02-28 11:42:40 -09:00
GuillaumeLaine 4fe7d713d3 msg: introduce message versioning 2024-12-13 16:34:37 +01:00