py_trees_ros_tutorials.mock.battery module

Mock the state of a battery component.

class py_trees_ros_tutorials.mock.battery.Battery[source]

Bases: object

Mocks the processed battery state for a robot (/battery/sensor_state).

Node Name:
  • battery

Publishers:
  • ~state (sensor_msgs.msg.BatteryState)

    • full battery state information

Dynamic Parameters:
  • ~charging_percentage (float)

    • one-shot setter of the current battery percentage

  • ~charging (bool)

    • charging or discharging

  • ~charging_increment (float)

    • the current charging/discharging increment

On startup it is in a DISCHARGING state and updates every 200ms. Use the dashboard to dynamically reconfigure parameters.

shutdown()[source]

Cleanup ROS components.

update_and_publish()[source]

Timer callback that processes the battery state update and publishes.

py_trees_ros_tutorials.mock.battery.main()[source]

Entry point for the mock batttery node.