What is Odometry?

The best reference for coding it is going to be the BLRS post.
It’s too complex to go into detail on how to implement it on the forum, but if you use the formulas on there you should be able to be successful. If that proves to be too difficult, try to learn trigonometry using youtube so you can actually understand what’s happening. If you’re just blindly turning formulas into code without understanding, you’re bound to introduce bugs and have a hard time debugging in the future.

I mean trig is sorta a core component of how it works.

Maybe this video going through everything slowly will help

At some point it comes down to either learning the trig necessary to follow it or waiting until you know the trig.

Brushing off the whole trigonometry thing, I don’t understand a single thing going on in this code block. Is this V5 C++ (I do not have access to PRO and I’m really not sure how a lot of functions work, that’s another thing I have to learn)

This meme post I made a while ago is also relevant.

Yes, it is C++. Maybe visit a website like learncpp.com and go through a couple lessons before asking more questions here.

Would any body be able to post a example code of how to setup odometry and example of it being use in any of the following program softwares vex v5 text, v5 pro, pros, etc.

Nobody is going to give you example code to copy and paste into your code. The best thing would be to give steps

steps
  1. Find position of encoders
  2. Find the difference in encoder position versus previous position
  3. Set previous position
  4. Convert differences to distance
  5. Convert the distances to global x and y change
  6. Update global position

V5 text and V5 pro are pretty much identical. PROS is a little different but the basic way the code works is the same. If you use PROS you can use okapilib which has inbuilt odometry.

Here is some old software in ROBOTC for odometry. It should give you the gist if you want to understand what software implementing it looks like.

task positionTracking() {
	x_Pos=startLocation.x;
	y_Pos=startLocation.y;
	theta=startLocation.theta;
	SensorValue[leftDrive]=0;
	SensorValue[rightDrive]=0;

	int lastLeft, lastRight, leftTicks, rightTicks;

	float leftMM, rightMM, mm;

	while (true) {
		int leftSample = SensorValue[leftDrive];
		int rightSample = SensorValue[rightDrive];

		leftTicks = leftSample - lastLeft;
		rightTicks = rightSample - lastRight;

		lastLeft = leftSample;
		lastRight = rightSample;

		leftMM = (float)leftTicks / LEFT_CLICKS_PER_MM;
		rightMM = (float)rightTicks / RIGHT_CLICKS_PER_MM;

		mm = (leftMM + rightMM) / 2.0;

		theta += (rightTicks - leftTicks) / 9.2345;

		if(theta > 180)
			theta = theta - 360;
		if(theta < -180)
			theta = 360 + theta;

		x_Pos += mm * cosDegrees(theta);
		y_Pos += mm * sinDegrees(theta);

		sleep(5);
	}
}

And some code taking advantage of it

void faceGoal(Goal target){
	long startTime=nSysTime;
	motor[intake]=50;
	motor[indexer]=motor[indexer2]=0;
	turnPID(radiansToDegrees(atan2(target.y-y_Pos,target.x-x_Pos))-theta);
	wait1Msec(1250-(nSysTime-startTime));
}
void gohome(){
	int turn = radiansToDegrees(atan2(-y_Pos,-x_Pos))-theta;
	writeDebugStreamLine("turn %d",turn);
	turnPID(turn);
	drivePID(sqrt((y_Pos*y_Pos)+(x_Pos*x_Pos)),false);
}

faceGoal from any position on the field computes the angle needed to point at the goal and gohome drives to the “home” position which was the center of the field.

That is what i wanted to know thank you :-1:

Implementing pilons Odometry is kind of difficult if you are just starting out. I would advise you start with the odometry highlighted in DAWGMA’s pure pursuit tutorial. It pretty much is just.
Distance =(change in left encoder + change in right encoder)/2

X += distance * cos(heading)
Y += distance * sin( heading)

If you are really struggling and it’s the day before competition I would advise you just to use EZ or if you have the time LemLib. Good luck

For heading just use an IMU

i would advise using ez as it is very easy to set up. Thats what i did for my previous provincials competition