Skip to content

Switch angle sensors to use integer instead of floating point#542

Open
Moddingear wants to merge 1 commit into
simplefoc:devfrom
Moddingear:integer_angle
Open

Switch angle sensors to use integer instead of floating point#542
Moddingear wants to merge 1 commit into
simplefoc:devfrom
Moddingear:integer_angle

Conversation

@Moddingear
Copy link
Copy Markdown
Contributor

Instead of using floating point for the angle, use integer, as most angle sensors already quantify the angle.

This makes it more straightforward, and doesn't lose any precision due to floating point. Revolutions and angle are accumulated within a single variable.

Performance-wise, on a STM32G431, it doesn't change anything (loop speed 18311Hz float vs 18230Hz integer), but this is to be expected, as I haven't touched any of the FOC code.

I also have the corresponding changes done in Arduino-FOC-Drivers, but it's a fork of Phoque2_CurrentSense because i'm using that to test. It makes the CalibratedSensor more staightforward, but in the case of true analog sensors, such as the MXLemming, it requires quantization.

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.

1 participant