Algorithm for autonomous robot/car

Hi, has anyone some experience with autonomous car? I want make some program for my autonomous car with some sonars - HC-SR04. 

If anyone can help me I will be so happy :) thanks

Maybe you should try to understand what you are trying to do.

Rather than ask for code, consider trying to plan out what you are wanting.

Avoid obstacles

Look for the most open space.

If it’s not ahead, turn until it is ahead.

Drive forward.

Repeat.

Given that batch of functions, you should try writing them as individual parts. Write a function to look for an open area. Write another to turn until the most open area is straight ahead. Write a function that drives forward.

I would like to see you write a single function that would drive the motors as needed, but, that would seem to be outside of your current ability.

:slight_smile:

I dont want a code. Thats why I name this topic - ALGORITHM for autonomous car - because I want only algorithm and I will write code :slight_smile:

re: autonomous car

I really like the force field algorithm.  It can result in nice curved paths through areas crowded with multiple obstacles without ever having to stop and think.  A bot that starts a gentle turn a few feet before an obstacle is a lot better than one that runs into it and then does sharp turns.

To implement it though, you’ll need more sonars 8-12…I would do 12.  You can get them in a six inch diameter circle or less if you orient them vertically.  Horizontally, you’ll need around an 8 inch circle I think.

I am working on another one right now that does this…with 12.  If 0 degrees is straight ahead and 180 is backwards.  I start with the front two at 15 and 45, and then stagger them 30 degrees apart around the circle.  This layout is better than facing one straight ahead, as the important thing is for a sonar to help decide which way to turn…a sonar straight ahead doesn’t help in that choice.

One important part is prioritizing which sonars get fired off, in what order and frequency.  When you are moving fast and forward, you should fire the front half a lot more often than the back.  You still have to fire the back sometimes to keep the minor turns working smoothly.  If you fire them all off, you can’t cycle through them fast enough and you have to slow the bot down.  A bot can overdrive the sonar reaction time pretty easily.

thx

thank you very much! I will look onthat :slight_smile:

code

Hi, @mtriplett …I search for some code of force field algorithm but I didnt find anything. Please, If you have some web or video or article about force field algorithm - please send me that :slight_smile: thanks

neural network

please, what you think about neural network autonomous algorithm??? Probably I will use kohenen maps, what you think about that? :slight_smile: