I am a RedBot beginner. I successfully ran the first example on my RedBot, however I noticed the motors are rotating at different speed, causing the robot to always turning towards one direction. Is there an elegant way to calibrate the motors to make it go streight?
How elegant do you want it to be ? If you have the line following sensors, you could come up with a calibration routine that comes up with a correction % to be applied to the faster side and stores that value in EEPROM. Then in “normal” mode it could retrieve that value from EEPROM and use it to make the 'bot go straight.
I don’t know about an elegant way, but I would just adjust the speed of one motor until it goes straight. I really don’t think it would take longer than a few minutes to do it.
Doesn’t matter. Even if the chassis was straight and parallel to 0.0001" over 10 feet and both motors matched RPM to 0.001%, the chassis will still be affected by tilt of the floor, different friction under each wheel, phase of the moon, etc.
@OP: Ask yourself this: can you drive a car straight from one end of a parking lot to the other without touching the steering wheel?
The only way for the bot to go straight is to use some point of reference and track it.