Apologies if this is a dupe thread, I’m sure I’m not the only person who’s had this concern but I couldn’t find any threads with a similar question.
There are four unique starting positions on the Turning Point arena. How exactly do I go about telling my robot where it’s starting from at the beginning of the game? I was considering using a quick selection screen in the pre-autonomous method, but it turns out that method runs independently of the autonomous method, which just goes ahead anyways. (Also I’m not sure how competition-legal it is to input commands just before the autonomous starts)
Because the field is symmetric you only have to ‘perfect’ two and simply reverse the direction of the turns. with our cortex we used a potentiometer as a selector but this doesn’t work w/V5 so we had to create & run 4 different files.
For ‘knowing’ - we only have 4 drive motors and 2 arm so we wrote a program that echo’s the motor’s encoder reading to the controller:
Controller1.Screen.clearScreen();
Controller1.Screen.setCursor(1,1);
Controller1.Screen.print(“Left Motor: %4.1f”, LeftMotor.rotation(rotationUnits::deg));
We run this as a task and use buttons to zero the encoder
Our team executes each step of pseudocode, records the encoder values, zeros and does next step. When all said and done they simply plug these in to the auton and tweak
That does certainly help, thank you! We were just gonna experiment constantly with different autonomous drafts rather than zeroing and taking down readings.
This doesn’t solve the main problem, unfortunately… Having four separate files just doesn’t seem too reasonable long-term. Surely there has to be some way of telling the robot where it is, then using simple if statements to finalize the process?
I was going to implement a method where the brain displays four squares, and you select which square you’re on prior to the autonomous period. I’m not exactly sure where to place this however, since pre_auton() runs asynchronously from autonomous().
The program I posted allows for eight parameters to be set - alliance color (determines direction of turn), parking or not, shooting preload or not… as many choices as features you have on your robot. It is meant to only have one program to maintain and get feedback about choices made.
We are working on a newer example that hopefully will clear up how to use it effectively.
I’ve run into another issue… Potentiometers simply weren’t giving me correct readings (always output 100% in code, but showed accurate values in the devices menu)
I’ve decided to opt for a simple system where you press one of the controller buttons to select the robot’s position in the arena. However the controller inputs don’t seem to pass for as long as the autonomous is running.
Are controllers completely disabled during the autonomous? Will I need to use another method for this?
It’s perfectly legal. You could also use jumper pins in the 3 wire ports, and run certain scripts based on which are present. You can also just run separate programs by selecting them if you really needed to.