| 284 | } |
| 285 | |
| 286 | void handleBattery(const sensor_msgs::BatteryState& msg) |
| 287 | { |
| 288 | for (auto const& voltage : msg.cell_voltage) { |
| 289 | if (voltage < low_battery_threshold && |
| 290 | voltage > 2.0) { // voltage < 2.0 likely indicates incorrect voltage measurement |
| 291 | // notify low battery every time |
| 292 | notify("low_battery"); |
| 293 | } |
| 294 | } |
| 295 | } |
| 296 | |
| 297 | int main(int argc, char **argv) |
| 298 | { |