Step 1: Find your battery topic
$ ros2 topic list | grep -i batt$ ros2 topic echo /battery_state --onceMost robots use sensor_msgs/BatteryState (ros2 topic info /battery_state shows the type). Note whether percentage is 0–1 or 0–100.
Step 2: Map it in styri.yaml
battery:
topic: /battery_state
percentage: percentage
percentage_scale: 100 # 100 if it sends 0–1, 1 if it already sends 0–100
voltage: voltage
warn_below: 25
fault_below: 10
min_voltage: 23.0 # optional low-voltage warningIf your robot sends charge as a plain number (for example std_msgs/Float32), point topic at it and set percentage: data. Set percentage_scale: 1 if the number is already 0–100, and voltage: false, since a plain number has no voltage field.
Step 3: Run and check
$ docker run --rm --network host -v "$PWD/styri.yaml:/etc/styri/styri.yaml:ro" ghcr.io/styri-dev/styri-core:v0.3.1 styri checkIt listens for five seconds and prints PASS or FAIL for the battery and voltage, with the value it read. Then start Styri with the same file mounted:
$ docker run --rm --network host -v "$PWD/styri.yaml:/etc/styri/styri.yaml:ro" ghcr.io/styri-dev/styri-core:v0.3.1Open http://<robot-ip>:8080.
What happens at low battery
- Below
warn_below: the battery tile turns amber, and the robot status shows WARNING with the level, for example “Battery low — 22 %. Send to dock soon.” - Below
fault_below: the tile turns red, and the status shows FAULT - Below
min_voltage: the voltage tile turns amber and the status shows WARNING, whatever the percentage says - Each drop below a threshold, and each change of the robot’s status, is written to the activity log
Styri Core is read-only: it shows and warns, and never sends the robot to dock.