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.

Overhead shot Side shot

  • 1
    Hi Donna! Could you please tell (or even show) us more about your robot and its program? The best would be if you attached a photo of the robot and a screenshot of the program, but even a textual description would allow us to help you better.
    – zovits
    Mar 27 '19 at 12:27
  • 1
    Hi Zovits! Here's the program: task main() { TextOut(0,LCD_LINE1, "HELLO GENIE"); Wait(SEC_3); OnFwd(OUT_AB, 30); Wait(SEC_3); } But I don't know how to put the pictures in. Mar 27 '19 at 13:24
  • 1
    This page in the Help section describes how can one embed images: bricks.stackexchange.com/help/formatting The program seems to be correct, and if assume that (1) the two drive motors are connected to the A and B ports and (2) use the same gearing to drive (3) wheels with the same diameters (4) with no mechanical blockages or friction then the robot should indeed go straight. Can you please verify these four assumptions?
    – zovits
    Mar 27 '19 at 14:05
  • Add picture to original post, as far as I know your assumptions are correct. However I did wondered if one of the motors could be running slightly slower then the other as in a text book I have says that you might have to sink them so they run identity? Mar 27 '19 at 14:44
  • If that is the case you could try using the OnFwdSync command to eliminate another possible source of the error.
    – zovits
    Mar 28 '19 at 13:06

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.