Using throttle to manipulate Autonomous Mode

I am attempting to help the students code in multiple autonomous modes for multiple different positions. We are currently testing two different ones and ran into a problem. Whenever we enable it tries to do both autonomous modes and kind of ‘jumps’ around. Are we doing something wrong?

Are the conditional terminals in the while loop set to Stop If True, or Continue If True?

If they’re set to Stop, then that means that the while loop will run when the throttle isn’t at 1/-1, which is the opposite of what you want.

Ah, I see got it now… I knew it was something simple, we’ll be testing it in a few minutes hopefully it will work now. Thanks!

This may not be what your looking for, but we have found it easier to use inputs from the Driver Station itself instead of a joystick. It allows you to set multiple autonomi up and accurately pick which one to use, instead of relying on a throttle which may get bumped.

instead of using axis=1 or axis=-1, use axis>0 and axis<0. It is (almost???) impossible to get it at exactly 1, so both would be false, meaning that both would run

The other comments will improve the code, but you will still find an odd jerk at the beginning as the while loops will both run at least once. You may find it even a bit better to surround the loop with a case statement and change the loops to run forever. The case can be the Boolean results of the compare, or you convert it to an enum or integer using scaling, and put the code in various frames of the case.

Greg McKaskle

That has got to be the most creative use of the while loop I have ever seen! I would suggest that, since has already been mentioned, you put your code into a case structure, and you use the DS switches wired into a build array. Then you can do a boolean array to number and have up to 2^8 autonomous modes!