How to set potision of robot during Autonomous?

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)

Any help would be greatly appreciated, thanks!

Human interaction with your robot is perfectly acceptable before the match starts.

As for exact ideas to solve your problem, the viable methods are heavily dependent on what electronics system you’re using – Cortex or V5.

I’m using VCS with a V5 Brain. Pretty much all of the electronics on our robot are V5.

V5 rocks in this regard but not in others.

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.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

Hope this helps…

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?

agree - I #just posted questions/ code for our auto selector based on potentiometer values - this may help should it work for you?

void autonomous( void ) {

    autoSelect = Selector.value(analogUnits::range12bit);
    if(autoSelect <=800){		//BLUE 2
	else if (autoSelect >800 && autoSelect <=1500){	//BLUE FLAG
	else if (autoSelect >1500 && autoSelect <=2200){	//NO Autonomous
	else if (autoSelect >2200 && autoSelect <=2800){	//RED FLAG
	else if(autoSelect >2800){						//RED 2
	else{															//catch all
		return;}//neutral position
}//end autonomous

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().

Actually yeah, just having the potentiometer already in position prior to starting the game would be totally viable. I’ll see what I can do!

V5 - VCS look at this code:
WalshBots Autonomous Feature selector

It is a good starting point for configuring what your V5 robot does during autonomous.

wow - box selector would be neat! Not sure how different from brain’s default except only one program to maintain…

Pre-Auto simply runs once doesn’t it? We start a task in pre-auto to echo the selector -> controller

Be aware our pot selector doesn’t work properly - likely our code

just found this reply - hope it’d be of interest 2U

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?

My team has a custom stencil that we use to place the robot in the exact same way every time for our auton

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.

How do I set that up with a V5 brain? I thought there was no way of detecting that on V5?

Theoretically if you just set up a generic “digital” sensor you can read it’s value as 1 or 0. Forget how we have it set up specifically.