Poor Alignment when Driving mBot Ranger


@Best_codes Just tested it! It works fairly well, however it still slightly drifts to the left sometimes. Also for some reason it doesn’t stop. Other than those minor things it still works very well!


@techy_apple I’m glad to hear it! You may need to adjust the 3.6 number to make it more or less sensitive. You can also make an offset to correct the drift. I’ll try to get you some codes for that tomorrow. :blush:
As far as it’s not stopping, try adding a stop moving block after the repeat loop (see below):
The left drift may be because that after so long, the gyro can’t really tell the degree so precisely anymore. For example, a slant of a couple degrees isn’t very far from the line here:
But as we go out, though it is still a couple degrees, it is a much longer distance:
And as this can happen even with something as small as say 0.05 degrees, the gyro sensor can only detect as small as about 0.1 degrees, so it can’t keep a straight line forever. I hope this explains it, @techy_apple, and good luck!


@Best_codes I raised the number from 3.6 to 10 and that seemed to fix the issue. Tomorrow my goal is to make the robot make a left turn and continue going. The final goal is to have the robot go around a couch (a very large right angle couch) (and possibly use the ultrasonic sensor (maybe))


@techy_apple Technically, lowering the number would fix the issue, but if it’s working… keep it!

Sounds like fun!

Phew, that’s tough! It’s definitely doable, though. I think I did something like it myself but with my mBot Neo a long time ago. Good luck!


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.