I've started to build a robot, but when it drives it veers off to the left even though I'm just telling it to go straight. I think I need to do something to the motors but I don't know what or how. I'm programming an NXT block.
Veering off a little bit is normal. Can it be reduced? Yes. There are several possibilities to consider, one of which is the programming. Put a pin in the hub of each wheel to serve as a marker, spin the wheels so the in the same position. Write a program to go straight for 20 revolutions. Hold the robot in the air, run the program, and examine the location of the pins. The should match. Differences can be programming issues, but more likely the position sensors in the motors. Try switching swapping one motor and retrying the test.
More likely, putting the robot on the ground and running the program will show the pins match, but the robot veered. Again, several possible causes, one likely cause is the friction on one side of the robot is greater. Changing to a caster will reduce the friction and might help. Another possibility is that the motors are a bit wobbly and allow the axles to bend so they do not match. This can often be helped by adding a skirt on the outside of the robot to support the axles from the outside.
OnFwdSync
command to eliminate another possible source of the error. – zovits Mar 28 '19 at 13:06