Let's Make Robots!

How to program a 3 point turn

I may seam very advanced or "Intelligent" when a robot is navigating it's way out of a tough corner, but here is how

Sometimes I have gotten feedback like "Wow, it even does 3-point turns".. or "5 point turns".. or "It is even getting itself out of trouble" when I have shown people my project named "Wall racers" and similar projects.


Yesterday I was focused on making something else on this project - and because I have done some of these things so many times, I did not even think about it, but I had actually given this robot that ability.

It stroke me, because I was looking for something else that it should do, concentrated I was looking at a test run.. and it got too close to a corner to steer out.. and WOW! This not finished robot just reversed and maneuvered itself out in a way I had not expected, not seen before - and drove on. I thought it was about time to share this little trick.

I include the Wall Racers video as example, because at 00:59 and later, it gets stuck, and get's out again using this technique. 


THE TRICK: Work with 2 levels, one called "Attention", and one called "Danger". This as opposite to just "If distance is greater than.. then.."

Let us assume that your robot can look to each side somehow, and that it constantly is fed the distance in front / to the sides perhaps.

Let us assume longer distance means higher value (like the raw return from a SRF05 that I usually work with)

Let Attention = 300

Let Danger = 150

Constantly, when checking distance in front, make a check if it is less than Attention. 


1: (See the top video)

First the "normal" navigation:

If distance in front < Attention then Steer free, based on knowledge you have, turn the robot to the side where distance is greater.

Constantly check distance in front, and when checking distance, make a check if it is less than Attention.

If distance in front is not less than Attention, then return to normal mode, we got out without trouble.

To here is how many first robots goes. And if they get too close, they still try to steer free.. However:


2: (See the top video)

If distance in front is less than Danger, we have to make a 3 point turn. So A) steer to the opposite side, and B) start reversing.

While reversing:

Constantly check distance in front, and do not stop before

Distance in front > Attention. Note: this is greater than "Attention", not "just > Danger", in here lies the whole trick :) Without this, you will just get jammed.

(or *Safety override = true (more about this below))


3:(See the top video) 

Then, just get back to normal drive (As in step 1), it will drive free by nomal turning the rest of the way :) And if necessary, the thing will make a 5 or more point turn out of it, by magic :)

On the video, in the end, the bot sees me, the cameraman, and starts from 1, would make another 3 point in front of me if it was to continue..



*Safety override: At this point your bot is actually reversing, and will not stop beforeit has a clear path in front. But it may actually be stuck on something, unable to reverse any further.

On RWR (Robot Wall Racers) I simply have a counter at this part, so if the car is not free within 3 seconds, it just goes in "Help me"- mode; Turning all off.

One could also make it try to drive forward again, see if it helps, and one could have sensors at the back, and make double-sided 3-point turns..



Since this sort of makes the robot "bounce" in some situations where you may actually just want it to "drive around", you may follow up with some "get back on track-code"or some "Get back and stick to the wall you where bouncing", depending on purpose of obstacle avoidance in general..




Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I like the "help me" mode idea.  I may use that, with a "help me" LED, so that I can visualize when the robot needs help.  My first robot will move much slower, so that I can mentally "follow" its commands, and determine if it's made the right decisions. 

Thanks !

Duane S

The three point turn is sometimes nessesary.


I was just starting to try to wrap my head around this subject! Thanks for beating me to it :)
how do you know when you are stuck?  I understand how to get it out of a stuck position, but i dont know how it can figure out when it needs to shout out for help, or help itself

I would love to give you a better answer, but please rad the text again. I believ eit is al there. If you ned a code example, have a look at the wal racers.

- If this does not help you, please try to point me to which part of my instructions you do not get, thanks.

im eager to make a radio sensor. help me


Well if Frits won't help I will! Please post a seperate forum topic. This topic is about how to make a robot make a 3 point turn, not about How to make a radio sensor. You also need to post specifics. What do you want to do with it? What is your definition of a radio sensor? One that communicates over radio waves? One that detects the presence of a radio? One that clucks like a chicken that got smacked with a radio? Help me to help you.