Post by Frisbone on Oct 2, 2013 6:58:32 GMT -5
So I'm plodding down the path of creating a static double array that is used for this purpose and I wanted to present my idea to see if you also think it makes sense from a flexibility standpoint. I wanted to make it so the data could be both complied in and perhaps downloaded fairly easily - but calculated on a separate machine. So here are the characteristics:
- ASSUME: There is a radians/second minimum (RS_MIN) and radians/second range (RS_RANGE) that we are interested in detecting and converting that are based on realistic physical movement of our controller.
- ASSUME: We accept that we will only get so accurate with the conversion - especially since we know that the DAC devices we use have limited resolution (whether a digital POT, DAC, or PWM) - we call this MAX_RESOLUTION (probably around 256 for full range)
- Through experimentation we see that at least with call of duty we know there is not a linear relationship between angular rate and voltage. We use a formula to describe the curve. We DERIVE a formula for each axis based on all sensitivity levels based on the observed hyperbolic curve y=1/(Ax+B). We use sample data to identify A and B for each sensitivity level.
- We establish an array of doubles the size of MAX_RESOLUTION.
- The upper half o the array is for positive values, lower have is for negative values. ASSUME: formula for upper/lower halves are NOT the same.
- BUILD: Array offset implies angular rate (128 to 255 are positive ranging from RS_MIN to RS_RANGE+RS_MIN in equal divisional increments, 127 to 0 are negative values ranging from -RS_MIN to -RS_RANGE-RS_MIN). We use the formulas to pre-calculate each resulting joystick volatge % from the angular velocity range values for each sensitivity level.
Using the data:
- Software will need to switch which array it uses based on the current sensitivity setting and what game is selected.
- When having an angular rate calculated and needing to convert to JY instruction, following steps apply:
* Take the input angular rate and
a) add the minimum if negative (RS_MIN)
if > 0 make it zero
if < -RS_RANGE make it -RS_RANGE
b) subtract the minimum if positive
if < 0 make it zero
if > RS_RANGE, make it RS_RANGE
* divide by RS_RANGE / (MAX_RESOLUTION / 2.0)
* Convert to integer
* If angular rate is negative, subtract from MAX_RESOLUTION/2-1
* If angular rate is positive, add to MAX_RESOLUTION/2
* Use this as offset into array to read JY PWM/DAC rate instruction
I'm not sure the format that this array should exist. Standard text CSV, XML, etc. I suppose it should be limited to what the Arduino can support to follow past logic - no idea what kind of XML support exists and what overhead it adds.
Andy has been rather silent lately - running low on free time? Or has a certain someone arrived?
-
- ASSUME: There is a radians/second minimum (RS_MIN) and radians/second range (RS_RANGE) that we are interested in detecting and converting that are based on realistic physical movement of our controller.
- ASSUME: We accept that we will only get so accurate with the conversion - especially since we know that the DAC devices we use have limited resolution (whether a digital POT, DAC, or PWM) - we call this MAX_RESOLUTION (probably around 256 for full range)
- Through experimentation we see that at least with call of duty we know there is not a linear relationship between angular rate and voltage. We use a formula to describe the curve. We DERIVE a formula for each axis based on all sensitivity levels based on the observed hyperbolic curve y=1/(Ax+B). We use sample data to identify A and B for each sensitivity level.
- We establish an array of doubles the size of MAX_RESOLUTION.
- The upper half o the array is for positive values, lower have is for negative values. ASSUME: formula for upper/lower halves are NOT the same.
- BUILD: Array offset implies angular rate (128 to 255 are positive ranging from RS_MIN to RS_RANGE+RS_MIN in equal divisional increments, 127 to 0 are negative values ranging from -RS_MIN to -RS_RANGE-RS_MIN). We use the formulas to pre-calculate each resulting joystick volatge % from the angular velocity range values for each sensitivity level.
Using the data:
- Software will need to switch which array it uses based on the current sensitivity setting and what game is selected.
- When having an angular rate calculated and needing to convert to JY instruction, following steps apply:
* Take the input angular rate and
a) add the minimum if negative (RS_MIN)
if > 0 make it zero
if < -RS_RANGE make it -RS_RANGE
b) subtract the minimum if positive
if < 0 make it zero
if > RS_RANGE, make it RS_RANGE
* divide by RS_RANGE / (MAX_RESOLUTION / 2.0)
* Convert to integer
* If angular rate is negative, subtract from MAX_RESOLUTION/2-1
* If angular rate is positive, add to MAX_RESOLUTION/2
* Use this as offset into array to read JY PWM/DAC rate instruction
I'm not sure the format that this array should exist. Standard text CSV, XML, etc. I suppose it should be limited to what the Arduino can support to follow past logic - no idea what kind of XML support exists and what overhead it adds.
Andy has been rather silent lately - running low on free time? Or has a certain someone arrived?
-