Go Down

### Topic: autonomous car algorithm help  (Read 1 time)previous topic - next topic

#### Gilr

##### Nov 18, 2015, 11:22 am
Hello everyone,

I'm planning a small autonomous car project which supposed to drive in boarded area and keep 25cm distance from the fence that used to be the board of the area.(the fence can be any shape and not just circle).
I'm using arduino mega 2560, the car has 4 wheels controled by using the PWM option.
I though about using 2 ultrasonic sensors, the first one in the front side and the second at the left side of the car (the car will drive clockwise and "keep the fence").
I will be happy to get some ideas for possible algorithms to solve the problem!

Thanks
Gil

#### PaulS

#1
##### Nov 18, 2015, 12:52 pm
Quote
I will be happy to get some ideas for possible algorithms to solve the problem!
What is the problem? Reading the sensors? Changing the speed of the motors?

#### Gilr

#2
##### Nov 25, 2015, 08:25 pm
the problem is how to write the code that will make the car drive and keep 30cm from the fence no matter what shape the fence is (with two ultrasonic sensors one at the front and the other at the side of the car)

thanks

#### PaulS

#3
##### Nov 28, 2015, 12:56 am
the problem is how to write the code that will make the car drive and keep 30cm from the fence no matter what shape the fence is (with two ultrasonic sensors one at the front and the other at the side of the car)

thanks
How would YOU walk along the fence, keeping an arms length away, having one arm out to the side and one sticking out front? How is the arm sticking out front going to help?

#### Gilr

#4
##### Dec 04, 2015, 10:08 pm
hi,
the front arm can help me to know when the fence from the front is near and i got to start turnning..

#### jremington

#5
##### Dec 05, 2015, 02:24 am
The algorithm for following a fence is pretty simple. Assuming the fence is on the left,

Check distance to fence.
If you are closer to the fence than desired, steer right.
If  you are farther from the fence than desired, steer left.
Check for obstacles and take appropriate action.
Go back to check distance.

Quote
the car has 4 wheels controled by using the PWM option.
How do you steer?

#### Gilr

#6
##### Dec 06, 2015, 01:56 pm
Thank you! I steer by driving faster with the wheels of the other side i wang to steer.
Now i have problem with the turnning radius which is like 1.5m.
Any help to improve it?
Thanks

#### PaulS

#7
##### Dec 06, 2015, 02:00 pm
Quote
I steer by driving faster with the wheels of the other side i wang to steer.
The greater the speed differential, the smaller the radius. Turn the inside wheels in reverse to make it even smaller.

#### TomGeorge

#8
##### Dec 07, 2015, 01:35 pm
Hi,
How big is this car?

Can you post a picture of it please.

Have you done any code for the car at all?

What is your electronics, programming, arduino, hardware experience?
Is this a school/college/university project?

Tom.....
Everything runs on smoke, let the smoke out, it stops running....

#### MarkT

#9
##### Dec 11, 2015, 02:59 pm
Have you played with the sensors and seen how accurate/inaccurate/noisy the values they return
are?  You will probably have to code round the imperfections in the sensor data (a lot of robotics
is like this - dealing with imperfect data)
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

#### AWOL

#10
##### Dec 11, 2015, 07:56 pm
Quote
the problem is how to write the code that will make the car drive and keep 30cm
The original post said 25cm.
Which is it?

Go Up