Battery Life Estimator (UAV)
Predict remaining flight time under current load and wind using a simple empirical model you can calibrate from 5–10 past flights.
What it does
- Calibrate a model from your flight logs (payload, speed, wind, flight time).
- Estimate total flight time for a given payload & airspeed.
- Estimate remaining time based on current pack voltage (via a LiPo voltage→SOC curve).
Model (MVP)
We fit a linear model on the inverse of total flight time (minutes):
1 / T ≈ b0 + b1 * payload_kg + b2 * v_air^2
where v_air = ground_speed_mps + headwind_mps (tailwind is negative).
Then we estimate remaining time as:
T_remaining ≈ T_total * SOC(voltage_per_cell)
SOC is mapped from an industry-typical LiPo 3.3–4.2 V per cell curve (see code).
This is deliberately simple, fast, and explainable. You can later add more features (temperature, altitude, prop type) or non-linear terms.
Quick start
-
Put your flights into a CSV with columns:
flight_time_min– total flight time (minutes)payload_kgground_speed_mpsheadwind_mps– positive=headwind, negative=tailwind
-
Calibrate and save a model:
python battery_life_estimator.py calibrate --csv example_flights.csv --out model.json
- Estimate total flight time for a new config:
python battery_life_estimator.py estimate-total --model model.json --payload-kg 0.6 --ground-speed-mps 10 --headwind-mps 2
- Estimate remaining time using current voltage (per-cell):
python battery_life_estimator.py estimate-remaining --model model.json --payload-kg 0.6 --ground-speed-mps 10 --headwind-mps 2 --voltage-per-cell 3.85
Example data
See example_flights.csv for a fake-but-plausible dataset to test the pipeline.
Notes
- Voltage→SOC mapping uses a smoothed interpolation of typical LiPo discharge (4.20V=100%, ~3.50V≈20%, 3.30V≈0%). Always set your own conservative landing threshold.
- The model assumes steady-state cruise. Hover-heavy profiles or aggressive maneuvers will deviate.
- For quads,
v_air^2works well as a first-order proxy; for fixed-wing you may want lift/drag terms and throttle% if available.
License
MIT
Metadata
Release files for uav-battery-estimator 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| uav_battery_estimator-0.1.0.tar.gz | 5.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| uav_battery_estimator-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.7 kB
Release files / uav_battery_estimator-0.1.0.tar.gz
| Download URL | uav_battery_estimator-0.1.0.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5f9d8ea8bdbbef237f9719c738b870a5a55449dc545f2cb0db227b3273e1f9d8
|
|
BLAKE2b-256 checksum How to use checksums |
924d0763625fde000a92f51c832b33dafb4ced248a8ef197a66377db7838b7d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / uav_battery_estimator-0.1.0-py3-none-any.whl
| Download URL | uav_battery_estimator-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
39d19953b974b662254268f3c825cd07d99e306d80864c6afdb73926046d40e2
|
|
BLAKE2b-256 checksum How to use checksums |
603452961c568ffd73b8aad9951284f67447bac6dc5a8cc5617d05f9131bcb38
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Security for uav-battery-estimator 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.