|
Re: Robot won't go straight
So if you push the joystick straight forward and give the identical values to the PWMs on both sides, the robot will curve (say) left going forward, and right in reverse.
Whether the motors "prefer" to go more easily one direction than another, you have different friction to overcome in the drive mechanisms on each side of the robot, or there is 'Victor bias', you have to do SOMETHING!
We have used this test:
Record the PWM output values required to start the left side wheels moving, in both forward and backward directions. Ours are something like 127+8 and 127-15.
Repeat on the right side. We found 127-8 and 127+15.
Allowing for the sign, it looks symmetrical doesn't it?
To solve this problem simply, just add a constant of 15-8 = 7 to the PWM on the slower side to make the motors spin the same. When going forward, add the constant to one wheel, in reverse add the constant to the other one.
|