Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Battery percentage calculator #138

Merged
merged 1 commit into from
Aug 30, 2021
Merged

Battery percentage calculator #138

merged 1 commit into from
Aug 30, 2021

Conversation

MoffKalast
Copy link
Contributor

@MoffKalast MoffKalast commented Jul 9, 2021

This PR should address the issue that one of our clients has raised and I've noticed as well: full charge voltage level is off by about 30%, and the max possible achievable percentage is like 77% which is odd for just about everyone. From what I've tested there's no way our usual 7.2Ah 12S lead acids can go above ~26.1V when not plugged into a charger.

Aside from a fix for that I've also ported my usual battery calculation system, which uses a lookup table along with level interpolation and should be much more accurate than the simple interpolation we had before. It also adds li-ion support if we ever needed that, but it'll need to be extended via a launch param when we actually need it.

There is some debate to be had if we should label 2V per cell as "empty" and 0% or 50% as it actually technically is. I think for now it may be best to keep the real values inside ROS as a baseline and then fudge it further up the line when it's displayed to layman users only.

Sources:
https://files.slack.com/files-pri/T04BZFRLG-F027D2SGB4N/untitled.png
http://www.solarnavigator.net/battery_charging.htm

Also closes #127 I guess, and fixes some indents because we yet again have mixed tabs and spaces for some reason.

@MoffKalast MoffKalast requested review from GreTimotej and removed request for dorkamotorka July 19, 2021 13:43
@MoffKalast MoffKalast merged commit e3e071e into kinetic-devel Aug 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Offset battery state so 50% reads as 0%
1 participant