Surface angle sensors for hill climb/descent and/or half-pipe
Maverick last edited by
I saw an old thread, and wanted to start a new one. I want to get a pair of VL53L0X time-of-flight sensors (IR laser distance sensors), and put one on each end of the board. The sensors can update at ~30Hz. Take the difference of both sensors. This, combined with the distance between the sensors, gives you the slope of the board, relative to the surface. Convert slope to angle. Take a ~5 sample (~1/6 second) rolling average, to compensate for noise.
You now have a rolling average of the board's actual angle, relative to the surface.
Feed this into a sufficiently fast microcontroller. Intercept the gyro output, and measure the angle, relative to earth's gravity.
Take the difference between the (1/6 second, or the same time scale as the surface angle) average gravitational angle, and the average surface angle. This is what your correction angle should be. This will change 30 times per second, with a 1/6 second dwell.
ADD the average correction angle to the instant gyro angle, in the microcontroller, then feed the output to the motor controller. The motor controller will think it's being fed info from the gyro, not the surface sensors. It will behave like a stock Onewheel on flat pavement, but will try to remain parallel to the average surface, instead of trying to remain perpendicular to gravity.
With this, you actually could use it in a half pipe, and hill performance would be MUCH better, both up and down.