How to auto calibrate your ev3 robot.
To command the ev3 robot to travel a distance one needs to convert distance units to motor rotation units. This can be done with trial and error, special calculations or just teach the robot to figure it out!

Step 1: Assumptions

we'll assume you have a bot that moves around with forward motor commands. it could be wheels or treds, it shouldn't matter
we also assume there is a forward facing range finding sensor. usually this is the infrared or ultrasound sensor.

Step 2: Algorithms

we're quite simply having the robot take a measure of its initial range to an object, the drive forward until it reaches a smaller distance then take a new measure. meanwhile we measure the initial and final motor position. we decide the two to get a conversion rate of cm/in to deg/rot.

Step 3: Keep It Safe

the trick is keeping that useful number after we calibrate.
variables are global in the ev3 environment but they are not persistent. instead we must write our useful number to a file saved onto the brick.
one time saving trick is to use a variable but initialize it from a single read operation, instead of constantly reopening the file.

Step 4: Done

now you may change wheel sizes as you experiment with your bot, and not have to change your core programs.
*add video of robot running a distance then change wheels and calibrate for the same distance.

About This Instructable




More by Malkaris:meshlocal, be the Internet. C.H.I.P Introduction (for Nerds) ev3 auto wheel calibration 
Add instructable to: