Jelly battery: report charging from 27.1 V, not 27.6 V - #322
Open
shawnpatel wants to merge 1 commit into
Open
shawnpatel wants to merge 1 commit into
shawnpatel wants to merge 1 commit into
Conversation
The panel showed a resting 100 % while Jelly was on the charger: the lift board read 27.5 V, under the old 27.6 V threshold, and everything above the curve's 26.66 V top clamps to 100 %. The charger's 29.2 V absorption voltage only arrives at the very end of a charge. Measured on Jelly with this board: 27.5 V on the charger (nearly full), 27.0 V for the same pack full and unplugged. Charging now sets at 27.1 V and, with hysteresis in BatteryEstimator, clears below 27.05 V so it does not flicker. A low pack early in a charge can still sit under the threshold; voltage alone cannot tell that apart from a full pack at rest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The control panel showed Jelly at a resting 100 % while it was on the charger. The lift board read 27.5 V, below the old
CHARGING_VOLTS = 27.6, and every voltage above the resting curve's 26.66 V top clamps to 100 %. The charger only reaches its 29.2 V absorption voltage at the very end of a charge, so the old threshold missed almost all of it.Measurements (Jelly, lift board ADC)
ADC noise between samples is ~10 mV.
Change
CHARGING_VOLTS27.6 → 27.1 V, with newCHARGING_CLEAR_VOLTS = 27.05 V:BatteryEstimatortrackschargingwith hysteresis so it doesn't flicker near the threshold, and still treats the charger connecting/leaving as a step instead of averaging across it.robot.batterydocstring,docs/api/robot.mdx) updated with the measured values and the limitation.Known limitation
Early in a charge, a low pack can sit under 27.1 V and show a resting (too high) percentage — voltage alone can't separate that from a full pack at rest. Detecting the step when the charger is plugged/unplugged would close that gap, but needs a recording of that step on the real board first. The full-pack margin (27.0 vs 27.1 V) comes from one reading; if a full pack is seen reading above 27.1 V at rest, raise the threshold.
Testing
uv run pytest tests/test_battery.py tests/test_jelly_link.py— 62 passed (new: bulk-charge voltage reads charging, measured full-rest 27.0 V does not, hysteresis, reset clears charging).estimate_batteryagainst the live readings: 27.01 V → not charging, 27.5 V → charging.🤖 Generated with Claude Code
Note
Low Risk
Changes only Jelly battery telemetry thresholds and smoothing; a full pack reading above 27.1 V at rest could still false-trigger charging, which is documented and narrow.
Overview
Fixes the control panel showing 100 % at rest while Jelly was on the charger: bulk charge often sits around 27.5 V, below the old 27.6 V threshold, so
chargingstayed false even thoughpercentclamped to 100 %.CHARGING_VOLTSdrops 27.6 → 27.1 V (Jelly-measured gap between ~27.0 V full/unplugged and ~27.5 V on the charger). AddsCHARGING_CLEAR_VOLTS = 27.05 VsoBatteryEstimatorkeepscharginglatched until the rail falls below the clear level, avoiding flicker near the threshold. Charger plug/unplug is still treated as a voltage step (not smoothed). SmoothedBatteryStatusnow uses the estimator’s hysteresis flag instead of re-derivingchargingfrom raw threshold on each sample.Docs (
batterymodule docstring anddocs/api/robot.mdx) note the new thresholds, thatpercentis meaningless while charging, and that early bulk charge can still read as resting if the rail stays under 27.1 V. Tests cover bulk-charge detection, full resting pack, hysteresis, and reset behavior.Reviewed by Cursor Bugbot for commit 7810101. Configure here.