Degrees to Inches

Hello, I am attempting to convert the distance on my DrivePID from degrees to inches. Do any of you have suggestions on how how to accomplish this?

Take your degrees and multiply it by pi/180 (radians conversion) then multiply that by the radius of your wheel in inches.

2 Likes

Wouldn’t it be multiplied by diameter instead of radius?

Nah they are right. Radians * radius = distance. The first step just converts degrees to radians.

2 Likes

Alright so would it look like this? The radius of my wheels are 1.625 inches.

// Degrees to Inches

float degree;

float inch = degree * M_PI/180 * 2.0625;

double desiredValue = inch;

If the radius of your wheels is 1.625, you should be multiplying M_PI/180 by 1.625 instead of 2.0625

Yeah your right, I forgot to adjust the code. So would that be it?