Help · Guide

ROS 2 battery monitor: level, voltage and warnings in a browser

Most ROS 2 robots publish battery data, but someone on site still has to notice when it’s getting low. This guide shows the battery in a browser and warns at the level you choose.

Step 1: Find your battery topic

$ ros2 topic list | grep -i batt
$ ros2 topic echo /battery_state --once

Most 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 warning

If 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 check

It 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.1

Open http://<robot-ip>:8080.

What happens at low battery

Styri Core is read-only: it shows and warns, and never sends the robot to dock.

Try it free

Styri Core is free and open source. One command.

$ docker run --rm --network host ghcr.io/styri-dev/styri-core:v0.3.1

Rather have it running on your robots this week? We’ll set it up remotely for a fixed price. See Styri Setup →