Joystick Driver - Calibration, Best Practices
Keith Young
Posts: 569
So I dusted off my old Logitech Extreme 3D Pro I hacked with a Propeller 5+ years ago. Didn't take too long to get it back up and running. Set it up so it can be called easily as an object from a function. Got it to drive an ActivityBot. Now I'm looking to add features and polish the driver and demo.
I'm now trying to get in a callable calibration. The obvious part is below in pseudocode:
while trigger = 0
update max and min for rudder, aileron, elevator, throttle
while trigger = 0
update average resting, centered position
Here's the thing, I'm an Engineer and don't know a ton about the intricacies of float, int, long, etc. I have a feeling I'm going to end up with equations for calibration such as elevator = 29.02478 * ADC.Input - 125.8465. Is this a good way to do it?
For example, when using the joystick with XBEE I pretty much always want to deal with a Decimal since transmitting a Float is a nightmare.
However some people might want Float.
So for example should I have a Joystick.CalibrateDec( ) and a Joystick.CalibrateFloat( ) etc?
Are there any best practices for sending out a good calibrated value?
Should I send out calibrated data from the Joystick driver object, or for example send out some array of calibration numbers that the main users program will then use to calibrate?
If I am sending out clean decimal values (or at least trying to) how do I handle the equation since M and B will probably be floating. Do I multiply both by 1000, and divide somewhere later by 1000 to stay in integer land?
Sorry if this sounds like a silly question.
For a little background here is a very old version of the driver I demo'd
Hopefully I'll have a cool video of this driving an ActivityBot next week. I have another free robotics class and I have a feeling it's going to be a hit.
Thanks!
Edit - This is written in SPIN by the way, with PASM for sampling all the buttons.
I'm now trying to get in a callable calibration. The obvious part is below in pseudocode:
while trigger = 0
update max and min for rudder, aileron, elevator, throttle
while trigger = 0
update average resting, centered position
Here's the thing, I'm an Engineer and don't know a ton about the intricacies of float, int, long, etc. I have a feeling I'm going to end up with equations for calibration such as elevator = 29.02478 * ADC.Input - 125.8465. Is this a good way to do it?
For example, when using the joystick with XBEE I pretty much always want to deal with a Decimal since transmitting a Float is a nightmare.
However some people might want Float.
So for example should I have a Joystick.CalibrateDec( ) and a Joystick.CalibrateFloat( ) etc?
Are there any best practices for sending out a good calibrated value?
Should I send out calibrated data from the Joystick driver object, or for example send out some array of calibration numbers that the main users program will then use to calibrate?
If I am sending out clean decimal values (or at least trying to) how do I handle the equation since M and B will probably be floating. Do I multiply both by 1000, and divide somewhere later by 1000 to stay in integer land?
Sorry if this sounds like a silly question.
For a little background here is a very old version of the driver I demo'd
Hopefully I'll have a cool video of this driving an ActivityBot next week. I have another free robotics class and I have a feeling it's going to be a hit.
Thanks!
Edit - This is written in SPIN by the way, with PASM for sampling all the buttons.