ida_noeman
20-01-2007, 17:09
Hi FIRST community. We decided to try out scaling our joysticks so that small, exact changes could be made using the middle parts of the joystick. To do this we used an exponential function model. We decided to use a lookup talbe, because we figured we had plenty of space, and we weren't sure whether the processor could do 4 of the calculations each loop without skipping a beat. However, the joysticks did not follow the model, as putting the joysticks full forward had the motors at stop, in addition to the middle and full back. The motors would only run when the joystick was not full forward, backward, or in the middle.
Anybody have any idea why? Is it fixable?
Thanks in advance. :cool:
--
Lemma 1: MOTOR_LEFT, JOY_LEFT are pound defined to you know what and DEAD_ZONE is to fix trim issues, by making some defined number (x2) of middle values of the joystick 127.
Lemma 2: "IN_DEAD_ZONE" is
#define IN_DEAD_ZONE(x) (x <= DEAD_ZONE + STOP && x>= STOP - DEAD_ZONE)
--
(At the beginning of user_routines.c)
rom const unsigned char [] lookup = {0, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 33, 36, 38, 41, 43, 45, 48, 50, 52, 54, 56, 58, 60, 62, 63, 65, 67, 68, 70, 72, 73, 75, 76, 77, 79, 80, 81, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 99, 100, 101, 101, 102, 103, 104, 104, 105, 105, 106, 107, 107, 108, 108, 109, 109, 110, 110, 111, 111, 112, 112, 112, 113, 113, 114, 114, 114, 115, 115, 115, 116, 116, 116, 116, 117, 117, 117, 118, 118, 118, 118, 119, 119, 119, 119, 119, 120, 120, 120, 120, 120, 121, 121, 121, 121, 121, 121, 122, 122, 122, 122, 122, 122, 122, 123, 123, 123, 123, 123, 127, 127, 131, 131, 131, 131, 131, 131, 132, 132, 132, 132, 132, 132, 132, 133, 133, 133, 133, 133, 133, 134, 134, 134, 134, 134, 135, 135, 135, 135, 135, 136, 136, 136, 136, 137, 137, 137, 138, 138, 138, 138, 139, 139, 139, 140, 140, 140, 141, 141, 142, 142, 142, 143, 143, 144, 144, 145, 145, 146, 146, 147, 147, 148, 149, 149, 150, 150, 151, 152, 153, 153, 154, 155, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 173, 174, 175, 177, 178, 179, 181, 182, 184, 186, 187, 189, 191, 192, 194, 196, 198, 200, 202, 204, 206, 209, 211, 213, 216, 218, 221, 223, 226, 229, 232, 235, 238, 241, 244, 247, 250, 254,};
(later, when assigning joysticks)
if (IN_DEAD_ZONE(JOY_LEFT))
JOY_LEFT = STOP;
else
JOY_LEFT = lookup[JOY_LEFT];
(etc for the rest of them.)
LEFT_MOTOR = JOY_LEFT
(etc.)
P.S. The reason that it jumps from 127 to 131 and 123 on each side is so we can adjust our deadzone to whatever we want, but then have a minimum output for the motor, something that will be detectable if we're not calibrated.
Anybody have any idea why? Is it fixable?
Thanks in advance. :cool:
--
Lemma 1: MOTOR_LEFT, JOY_LEFT are pound defined to you know what and DEAD_ZONE is to fix trim issues, by making some defined number (x2) of middle values of the joystick 127.
Lemma 2: "IN_DEAD_ZONE" is
#define IN_DEAD_ZONE(x) (x <= DEAD_ZONE + STOP && x>= STOP - DEAD_ZONE)
--
(At the beginning of user_routines.c)
rom const unsigned char [] lookup = {0, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 33, 36, 38, 41, 43, 45, 48, 50, 52, 54, 56, 58, 60, 62, 63, 65, 67, 68, 70, 72, 73, 75, 76, 77, 79, 80, 81, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 99, 100, 101, 101, 102, 103, 104, 104, 105, 105, 106, 107, 107, 108, 108, 109, 109, 110, 110, 111, 111, 112, 112, 112, 113, 113, 114, 114, 114, 115, 115, 115, 116, 116, 116, 116, 117, 117, 117, 118, 118, 118, 118, 119, 119, 119, 119, 119, 120, 120, 120, 120, 120, 121, 121, 121, 121, 121, 121, 122, 122, 122, 122, 122, 122, 122, 123, 123, 123, 123, 123, 127, 127, 131, 131, 131, 131, 131, 131, 132, 132, 132, 132, 132, 132, 132, 133, 133, 133, 133, 133, 133, 134, 134, 134, 134, 134, 135, 135, 135, 135, 135, 136, 136, 136, 136, 137, 137, 137, 138, 138, 138, 138, 139, 139, 139, 140, 140, 140, 141, 141, 142, 142, 142, 143, 143, 144, 144, 145, 145, 146, 146, 147, 147, 148, 149, 149, 150, 150, 151, 152, 153, 153, 154, 155, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 173, 174, 175, 177, 178, 179, 181, 182, 184, 186, 187, 189, 191, 192, 194, 196, 198, 200, 202, 204, 206, 209, 211, 213, 216, 218, 221, 223, 226, 229, 232, 235, 238, 241, 244, 247, 250, 254,};
(later, when assigning joysticks)
if (IN_DEAD_ZONE(JOY_LEFT))
JOY_LEFT = STOP;
else
JOY_LEFT = lookup[JOY_LEFT];
(etc for the rest of them.)
LEFT_MOTOR = JOY_LEFT
(etc.)
P.S. The reason that it jumps from 127 to 131 and 123 on each side is so we can adjust our deadzone to whatever we want, but then have a minimum output for the motor, something that will be detectable if we're not calibrated.