GoPi5Go-Dave is testing a ROS 2 "Battery Node"

Having the INA219 sensor allows the creation of a ROS 2 “Battery Node” to use for making the decision when to get off the dock based on charging current, since the charger never thinks it has reached a “full charge”, and the voltage curve is flat for the last 2/3rds of the charging cycle.

I have to work out what to use for the percent charged calculation though.

And for some reason running the ROS 2 Battery Node is totally confusing my non-ROS test_docking program that also accesses the INA219. Probably because I am using “Auto Gain” and not setting the max_expected_current as a hint to the Auto Gain.

Charging:

---
header:
  stamp:
    sec: 1716666051
    nanosec: 457859008
  frame_id: base_link
volts: 11.226889610290527
milliamps: -1494.268310546875
watts: 16.95975685119629
watthours: 1.0987751483917236
charging: true
capacity: 24
percent: 4
---

Discharging:

---
header:
  stamp:
    sec: 1716668117
    nanosec: 457610516
  frame_id: base_link
volts: 10.207626342773438
milliamps: 675.731689453125
watts: 6.855284690856934
watthours: 3.5803658962249756
charging: false
capacity: 24
percent: 85

2 Likes