229Views3Replies

Author Options:

How can I make my robot drive straight using PID and the HC SR04 ultrasonic sensor? Answered

3 Replies

user
rickharrisBest Answer (author)2014-06-11

I have a feeling there is more to your question than your saying.

You can make your robot avoid objects but to make it run a strait line you need to be able to sense the position - with a compass, or an accelerometer or by monitoring the rotation of each wheel. Your SR04 isn't going to help you drive a direct line.

Select as Best AnswerUndo Best Answer

user
HandelSM (author)2014-06-25

So, how could be the code to make my robot run strait using an encoder?
Using PID, I'm searching things about PID but I until don't found a site that explained me it.

Select as Best AnswerUndo Best Answer

user
mpilchfamily (author)2014-06-11

Don't need that to make a robot drive straight. You need that if you want the robot to see objects in front of it so it can either stop or avoid the object.

Select as Best AnswerUndo Best Answer