feat(math): Refactor `espp::RangeMapper<>` to have center deadband and range deadband and remove invert-input. Similar update to `espp::Joystick`. Fixed bug in `espp::Joystick` which introduced non-linearity when configured as a `CIRCULAR` joystick. #261
Remove deprecated invert_input functionality in espp::RangeMapper<>
Rename deadband -> center_deadband
Add range_deadband
Refactor how the map/unmap functions work accordingly
Update range mapper part of example to output a single csv (easier to validate) and to step through all the range in increments of 5 for easier validation / checking.
Update the espp::Joystick to have a range_deadzone which operates similarly to the espp::RangeMapper<>::range_deadzone but which (similar to the center_deadzone_radius) operates on the vector values instead of operating on the individual joystick axes independently.
Refactor joystick to allow the get function to be null and instead to use the .update(raw_x, raw_y) function, and use new protected recalculate(raw_x, raw_y) function in both the update overloads
Fix bug in circular joystick scaling which inadvertently squared the magnitude as opposed to setting the new magnitude
Update joystick example to loop through array of raw values and print out the circular and square joystick outputs for verification
Motivation and Context
Input inversion had been marked as deprecated and has now been removed
Previously the range deadband was possible by modifying the min/max values, however this could lead to values which were almostoutput_min / output_max (in the case of FloatRangeMapper but which were not actually the min/max as expected. This also made it harder to dynamically adjust the deadband around the min/max since the actual min max values could easily be lost. This change makes it more in line with the center, where the center is a known value, and the deadband around it can be adjusted as needed.
How has this been tested?
Building and running the math/example on a QtPy ESP32S3 and plotting the results.
Screenshots (if appropriate, e.g. schematic, board, console logs, lab pictures):
Description
invert_input
functionality inespp::RangeMapper<>
deadband
->center_deadband
range_deadband
espp::Joystick
to have arange_deadzone
which operates similarly to theespp::RangeMapper<>::range_deadzone
but which (similar to thecenter_deadzone_radius
) operates on the vector values instead of operating on the individual joystick axes independently.Motivation and Context
output_min
/output_max
(in the case ofFloatRangeMapper
but which were not actually the min/max as expected. This also made it harder to dynamically adjust the deadband around the min/max since the actual min max values could easily be lost. This change makes it more in line with the center, where the center is a known value, and the deadband around it can be adjusted as needed.How has this been tested?
Building and running the
math/example
on a QtPy ESP32S3 and plotting the results.Screenshots (if appropriate, e.g. schematic, board, console logs, lab pictures):
range_mapper_test.txt range_mapper_test.xlsx
Joystick
joystick_test.xlsx joystick_test.txt
Types of changes
Checklist:
Software
.github/workflows/build.yml
file to add my new test to the automated cloud build github action.