Clone wiki

subt / tutorials / batterymodel

Back to How-to Guides

Battery Model

Batteries are modeled as a linear countdown. The countdown for the UGVs (X1 & X2) is 90 minutes of simulation time, and 20 minutes for the UAVs (X3 & X4). Once the countdown reaches zero, a robot will no longer be able to move.

Note: Batteries begin to drain when vehicle motion starts.

The current battery state for each robot can be obtained through topic <robot name>/battery_state, which publishes sensor_msgs/BatteryState. Message fields to keep an eye on:

  • power_supply_status, which can be:
    • 4 for POWER_SUPPLY_STATUS_FULL, while it hasn't started discharging
    • 2 for POWER_SUPPLY_STATUS_DISCHARGING, while it is discharging
  • percentage, which goes from 1.0 (full) to 0.0 (empty)

Back to How-to Guides