Skip to content

Battery Model Tutorial

acschang edited this page Jun 18, 2020 · 4 revisions

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 will drain at a constant rate (power_load) while the vehicle's joints are actuated.
    • In the case of a UGV, battery depletion will only occur when a command is applied on the cmd_vel topic.
    • In the case of a UAV, constant battery depletion will begin after the UAV velocity controller is activated by publishing a velocity command on the cmd_vel topic.
      • To stop battery depletion of the UAV, stop sending commands to cmd_vel then disable the UAV velocity controller by publishing False to the velocity_controller/enable topic. Disabling the UAV velocity controller will halt the vehicle's rotors so ensure the UAV is landed before disabling the controller.
      • To reactivate the velocity controller controller, publish True on the velocity_controller/enable topic. Battery depletion will not resume until a new velocity command is published on the cmd_vel topic.

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)
Clone this wiki locally