Last year was the first year for our team. Due to this, we are not completely familiar with the code. Our robot is very sensitive to the joysticks that came with the kit and is hard to control in a productive manner. Very little changes have been made to the default code. We are wondering if anyone would be able to help us solve this sensitiviy problem. Is there a way to do this in the code? Is there a way to change the scale on the joystick so all the way forward isn’t something like 255 but instead 100? We have been looking mostly at user_routines.c near lines 224 in the default code for a possible solution. Is this the right place to start or is there a different place? Any help would be appreciated.
That code is in PBASIC (as used on the previous generation of controllers), but you probably should be able to rewrite it. (Chalk it up as a learning experience. :D) Basically, that link teaches you how to set up the motor to speed up on an exponential curve, instead of linear. Slow when you start, but still full power when you push it all the way up.
Step number one is to understand what the output is expecting. 255 is arguably an illegal output and 100 would not cause your robot to go forward, but actually go reverse. A good start would be to read the Programmer Reference Guide from Innovation FIRST.
Ive been looking at this problem, but rather than a software solution, I would be interested in a hardware solution. Ive been looking at using a potentiometer as a solution.
I would set up a resistor divider to get .5vcc from the OI and send that to pin 1 on the pot, the signal from the joystick would go to pin 3 and pin 2 would go to the input on the OI. That way the driver could adjust the scale quickly, from no scaling to locked at 127
I know the rules prohibit messing around inside joystick, but allow a custom control box, so I would think that a box in the middle would be in a bit of a grey area. Can anyone lend any clarification to this? I just think that why should we devote processor cycles to something that can be done in hardware so simply. Plus I’m more comfortable with electronics than coding, so I’m sure that plays a role in it too.
Tristan Lall did this to our robot last year using software. We use the older black Flightsticks which have a wheel on them. In fact, the default code still shows variables like “p1_wheel” from these old joysticks =).
The wheel worked as a speed limiter which would scale the total range of the joystick down. Our reason for this was to demo the robot to children, and allow them to drive without fear of breaking things.
I believe this code is UNTESTED, so programmer beware. However the concept alone should prove useful:
FYI, we did this in ADDITION to our cubic transfer function, and here Tristan (who once was a driver for Team188) has modified our tank drive code for his preferred one-stick drive.