- add function joystick_generateCommandsShaking that generates motor
commands from joystick data
- pulses motors:
- intervals depend on joystick radius
- direction depends on joystick position (currently only on-x-axis and on-y-axis
supported)
As already did for http joystick:
- Add different config options tolerance zero for X and Y axis for
normal/actual joystick.
This makes it possible to set Y tolerance to a lower value resulting in
a more responsive turning action, with still having a large range around
X axis for turning mode
Fix several bugs noticed while testing the preceding commits in dev
branch:
- Fix bug in function scaleCoordinate
- scaling was wrong resulting in negative/inverted values at start of axis
- Adjust timeout value from 30s to 5min
- Fix http joystick behaivor
- calculate angle, radius and evaluate position AFTER the coordinates
have been scaled in control.cpp (bug introduced when switching applying tolerance
on controller instead of in the app)
- Add independent toleranceZero for X and Y axis -> unnecessary to have
large tolerance for x axis... makes turning more sensitive
- Fix stack overflow in control task
- controller crashed repeatedly when logging output was enabled in
control task
- -> doubled stack size at task creation in main.cpp
currently works, position hast to be evaluated AFTER coordinate scaling
- joystick.cpp/hpp:
- move method scaleCoordinate from joystick class to public function
- modify scaleCoordinate function to accept float values instead of
ADC pin, change tolerance parameters to percent instead of absolute
number
- change method getData to use the public function now
- control.cpp:
- use scaleCoordinate function in http mode
- calculate radius in http mode
- config.cpp
- adjust tolerance thresholds for joystick to percent
- App.js
- disable "snap to zero" feature -> just scale joystick output to
value of -1 to 1
Move section that defines joystick position enum to a separate function
(outside of joystick class), this makes it usable for other inputs as
well
- create new function joystick_evaluatePosition
- call the new function in joystickgetData (where code was initially)
- change function joystick_generateCommandsDriving to accept joystick
data struct instead of joystick object as parameter -> makes the
function usable with other input than hardware joystick too
- add new function to joystick.hpp/cpp
- reads data from joystick and generates commands for driving in
"joystick" mode
- returns struct with commands for both motors
- main.cpp
- add code for testing the new function
- enable 5v regulator (needed for pullups AB left motor)
- add newly created motorRight to handle function
- add new struct with two motorcommands to motorctl.hpp
- Create class 'evaluatedJoystick'
- evaluates a joystick with 2 analog signals
- scales the adc input to coordinates with detailed tolerances
- calculates angle and radius
- defines an enum with position information
- Add joystick configuration and class instance to config.cpp
- Add code for testing the new class to main.cpp
- Add joystick.cpp to cmakelists
now function `joystick.getData` can be used globally to obtain a struct with
current position data of the joystick