Battery Monitor

class nodes.navigator_battery_monitor.BatteryMonitor[source]

Monitors the battery voltage measured by the 4 motors on Navigator, publishing a moving average of these measurements to /battery_monitor at a regular interval.

voltage

The average voltage across all of the four motors. None if no reading has occurred yet.

Type

Optional[float]

supply_voltages

The most recent 1000 voltage readings. Each reading is from a separate motor.

Type

List[float]

hw_kill_raised

Whether a hardware kill was raised.

Type

bool

pub_voltage

A publisher to the /battery_monitor topic. Published by the publish_voltage() method.

Type

rospy.Publisher

add_voltage(feedback: Feedback, status: Status) None[source]

This is the callback function for feedback from all four motors.

It appends the new readings to the end of the list and ensures that the list stays under 1000 entries.

Parameters
  • feedback (Feedback) – The feedback from one of the motors.

  • status (Status) – The status of the motor.

hw_kill_cb(msg: Alarm)[source]

Serves as a callback when a hardware kill is activated.

Parameters

msg (Alarm) – The alarm message that activated the hardware kill.

publish_voltage(_) None[source]

Publishes the average voltage across all four thrusters to the battery_voltage node as a standard Float32 message and runs the voltage_check.

Currently runs every second.