 # Doing autonomous without V5

#1

Any idea on how to do autonomous without a V5 vision sensor?
We do not have the legacy light sensors.
Edit: We need to figure out where on the field we are and what side we are on…

#2

All V5 motors have built-in encoders and the ability to set RPM and/or distance. You would just have to write functions to convert “ticks” to distance units, and measure/run accordingly.

#3

We need to figure out where on the field we are and what side we are on…

#4

You can also program multiple auton codes to the Brain…it’s another built-in thing.
If you look at diagrams of the field, you can get rough estimates because the floor tiles are ~18" squares, if I recall.
To get diagonals, just do pythagorean theorem. The diagonal distance across one square is ~25.5".

#5

Floor tiles are actually 24" by 24".

#6

To clarify what Royal Freedom means, you can just build a potentiometer with an axle that can switch between autons. You don’t actually need the robot to detect by itself what side of the field you can be on.

Ex: If the potentiometer value is 0-200:
Run Auton 1.
If the potentiometer value is 200-400:
Run Auton 2.

Etc.

Alternatively, you could use jumper clips to do the same thing.

Ex: If Port 1 = 1
Run Auton 1
If Port 2 = 2
Run Auton 2

This is just pseudocode, I don’t have robotC on this laptop.

#7

Potentiometers on ROBOTC have a range from 0-4095. If you have around… 4 autons (One auton per color and side), you can divide 4095 by 4 and (close to) evenly distribute all of the autons around the potentiometer. In this case with 4 autons, auton selection on the pot would range from 0 - 1024, 1024 - 2048, 2048 - 3071, and 3071-4095.
If you are using ROBOTC, you can do something similar to this:

``````

int autonnumber;
int potvalue = SensorValue[Pot];

//Set which auton to run depending on the potentiometer value
if(potvalue  <= 1024) autonnumber = 1;
else if(potvalue  <= 2048) autonnumber = 2;
else if(potvalue <= 3071) autonnumber = 3;
else if(potvalue <= 4095)  autonnumber = 4;

//Run the autonomous selected
if(autonnumber == 1){
//Autonomous 1
}
elseif(autonnumber == 2){
//Autonomous 2
}
else if(autonnumber == 3){
//Autonomous 3
}
else if(autonnumber ==4){
//Autonomous 4
}

}

``````

During driver control, you could also display the selected auton onto an LCD (They are discontinued so if you do not have one it may be hard to find) to ensure that you know the selected auton is the one you want as well. If you don’t have an LCD, you can look at the pot value in the debug sensor values.
Hopefully this helps of some sort 