Quote:
Originally Posted by Ether
Would this work?
- Apply joystick commands -127 to 0 to 127 and measure the Vic's output voltage1 for each one.
- Normalize those measured voltages to the (floating-point) range -127.0 to 0 to +127.0
- From this data, for each desired whole number output (in the range -127 to +127), determine (by simply looking at the measured data)2 the integer value required to come nearest to the desired output. Put these integers into an array (-127 to +127).
- The index of the array is the output you want (-127 to +127), and the value stored at that index is the value you should command. No lookup search or interpolation required.
1 stalled? or free? probably makes a difference. not sure whether you want average or rms voltage.
2 or just let a spreadsheet do it for you
|
The only downside I see to this approach would be a "loss of precision". Say PWM duty cycle 150 produces a speed of 74, PWM 151 has a speed of 74.5, PWM 152 has a speed of 75. If you wanted to command a speed of "74.5", there is an exact PWM value for that speed. But by quantizing the available speeds into whole number outputs, you would end up never using PWM 151.
If that isn't splitting hairs, though, I don't know what is.