1

My arduino robot has two dc motors as two wheels and have mounted an IR led on it. I get current position of the robot as (x,y) coordinates in the arena using camera which is mounted at the top of the arena..

My robot communicates with PC through bluetooth. I can read current position of robot on pc with the help of camera. Robot uses arduino motor shield to drive DC motors.

Which is the best method to move robot through the waypoints for a robot with DC motors without encoders?

  • 1
    What have you tried so far? Can you get the robot to drive around (e.g. forward a while, turn left, back a while, turn right)? Can you talk over bluetooth from the PC to the robot? – AMADANON Inc. Oct 1 '15 at 1:31
  • Yes I can control robot movements using keyboard as a joystick. And I can talk over Bluetooth from the PC to the robot – ronroo Oct 1 '15 at 7:10
2

With the arrangement you have described I would say it's very very hard to do what you want.

  • You know where the robot is
  • You know where the robot has to get to
  • You can easily calculate the direction the robot has to go in (simple trigonometry from school)

But:

You don't know what direction the robot is facing, so you don't know how to turn the robot to get it to drive in the direction you need.

So either you need some kind of calibration procedure whereby the computer moves the robot in different directions and watches what the IR LED does to determine what direction the robot is facing so it can move it to face the right way (tricky to do, and rather messy), or some way for the computer to visually calculate the direction of the robot.

The latter is probably the easiest. Instead of just one IR LED on the top of the robot you would need an array of IR LEDs on top of the robot forming a shape. What that shape is can be up to you, but there is one big constraint: It must have a clear direction to it (i.e., it must have no rotational symmetry. Triangles are good since they only need 3 LEDs. An equilateral triangle though wouldn't work since in three different rotations it would look the same. However, a single LED at the front of the robot, with two LEDs at the back of the robot, with the two back LEDs closer together than the distance from the front to the back, would not have any rotational symmetry.

You could then, (theoretically, assuming you have control over the camera software), get the three points from the play area and calculate the direction the robot is facing (tangent from mid-way between the two close points passing through the distant point) so you can then calculate the angle the robot would need to turn through so it is facing the direction you need it to.

Remember in math class, doing trigonometry (sin, cos, tan, pythagoras, etc) thinking "Why the hell do we need to know this stuff?!", well, now you know.

  • Other option: use 2 LEDs of different colour, like RED and GREEN. That will simplify the calculation, as it only requires calculating the line passing through 2 points. For supporting multiple robots: use blinking patterns, each robot could encode its unique ID, as long as it's not too fast for the camera. – Igor Stoppa Oct 1 '15 at 12:59
  • @IgorStoppa I assumed the use of IR LEDs was specifically stipulated because it was easier for the camera to isolate from the backround image. Using visible LEDs would require considerably more complex processing. – Majenko Oct 1 '15 at 13:04
  • It should be a matter of running a 1-pass filter on the image. Should be piece of cake for OpenCV. – Igor Stoppa Oct 1 '15 at 13:06
  • If IR leds is a requirement, you might still get away with having two LEDs, and have one on continuously, the other strobing; depending on the camera, either the strobing one will be dimmer (ideally), or will be there sometimes, not there the rest of the time. – AMADANON Inc. Oct 2 '15 at 1:13
0

This depends if you want the hypothetical best solution, or if good enough is good enough.

If good enough is good enough, I'd take the following approach:

Work out the distance from your robot to the first waypoint; move forward. Work out how fast you're moving towards (away from) the goal. Turn left a bit, go forwards again; did things improve (less away from/more towards)? If not, turn slightly right. Keep turning this way (left or right), and going forward a bit; whenever your speed towards to the goal gets worse, change your turning direction.

This should get you to where you are going.

Then, start making improvements.

If you are moving away from the goal (distance is increasing), your rotates can be quite sharp; as your approach speed to the goal increases, make the rotates smaller.

You could also try rotating while driving - if you are driving forward, and want to turn slightly left, run your left wheel at 90% of the speed of the right.

With a bit of trial and error, you should be able to end up with a table - work out your approach speed, look up in a table (or formula) how fast your slower wheel should go - from 0% (or even 100% reverse!) if moving away from your goal, to 100% if you are going at your driving speed towards your goal. Remember that if you are turning, you will approach it more slowly than if you are going straight. And if you start to turn and things get worse, then you are turning the wrong way.

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.