# Turns with the help of track width and wheelbase

hello, good evening everyone, I address you in the most attentive and loving way so that I can ask you a question and see if any of you colleagues could answer it for me, well, let’s begin, the truth is that I would like to know how I can do a tour accurately without the need for a gyroscope or gyro sensor like that, and also without using the drivetrain of the vexcode studio software, I would just like to know what kind of operations are done to have an exact turn only with the help of the track width and the distance of axes, without more to say I say goodbye sending you a cordial greeting.

Hello! I have had this problem myself in the past. It’s just a byproduct of vex not releasing the source code for the header files that form the classes like drivetrain. Anyways, it is not too difficult to understand that moving in a straight line is simple to code. One rotation of each drive motor forwards (given you have already reversed the motors on one side so that forward does move it forward) moves the robot (diameter of wheel * pi) using Circumference = diameter * pi.
Now, the more difficult thing is to do the turning. So, assuming all of the motors spin at the same speed whether forward or back, the robot rotates on a point that is the midpoint of the 4 wheels. (one side of the drivebase goes forward and the other goes in the opposite direction depending on direction of travel.) The distance from each wheel to said midpoint is ((sqrt(wheelbase^2+trackwidth^2))/2) and the robot spins in a circle of this radius, so the distance that the wheels have to travel for a full 360 degree rotation is sqrt(wheelbase^2+trackwidth^2) * pi using the same formula. Dividing by 360 gives distance that you have to travel per degree.
I will just say that these formulae are not that accurate or precise because the wheel is not going to have an exact diameter, the foam tiles are squishy etc. etc. but it will be the best you can do without any gyro. If you want to improve the accuracy of the stuff I said above, you can just use a PID, for which there are many, many posts on the forum that are more helpful than anything I will say.

1 Like