Go Down

### Topic: distance sensing navigation algorithms anyone? (Read 2903 times)previous topic - next topic

#### AgeingHippy

##### Aug 08, 2011, 01:17 am
Hey guys. Now that I have my robot base working (3D printed base & caterpillar tracks and turns on a carpet!! wohoo) I am attempting to add some intelligence.

First step is some pointless and continuous wandering around without bumping into things using a sharp IR distance sensor on a small servo.

Can anyone point me to some algorithms for said navigation using a distance sensor. Even high level pseudo code (probably preferred) would be good to compare with my currently non-functioning navigation approach.

cheers

#### keeper63

#1
##### Aug 08, 2011, 05:47 am

Hey guys. Now that I have my robot base working (3D printed base & caterpillar tracks and turns on a carpet!! wohoo) I am attempting to add some intelligence.

First step is some pointless and continuous wandering around without bumping into things using a sharp IR distance sensor on a small servo.

Can anyone point me to some algorithms for said navigation using a distance sensor. Even high level pseudo code (probably preferred) would be good to compare with my currently non-functioning navigation approach.

cheers

Completely untested pseudocode:

Code: [Select]
`Loop: While (Read Distance From Sensor) < MinimumDistance MoveBackwardBySmallAmount TurnByRandomAmountRandomlyLeftOrRight End If MoveForward`

I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

#### AgeingHippy

#2
##### Aug 17, 2011, 02:06 pm
Hi All

I would still like some pointers to navigation algorithms that are proven to work.

My current process is roughly as follows

Code: [Select]
`main loop {  if first time in main loop { navigate() }  else { scanWhileDriving() }}navigate() {  while not clearAhead() {    scanForPath()    turnTowardsPath()  }  goForeward}scanWhileDriving() {  Scan 30 degrees each side of straight ahead (60 deg  to 120 deg)  if anything closer than collisionThreshold detected {    stop    navigate()  }}clearAhead() {  Scan at [60, 75, 90, 105, 120] degrees (90 being straight ahead)  if anything closer than clearPathThreshold { return false }  else { return true }}scanForPath() {  Scan 80 degrees each side of straight ahead ( 10 deg to 170 deg)  Return furthest distance >= clearPathThreshold and angle distance found at}turnTowardsPath() {  lookStraighAhead  turn leftOrRightBasedOnAngle until furthestDistance found}`

I would appreciate any comments or pointers or even some grown-up navigation algorithms...

I placed the while not clearAhead in the navigate loop because when it turns towards the clear distance it stops turning when the wheels will still have collision danger...

#### RandyMan

#3
##### Aug 20, 2011, 02:06 am
I'm working on the same thing.
I building a robotic lawnmower.
Have a look at SLAM. I'm using a sonic sensor because I think it can give me better range and more accurate. I will use IR to sense close objects perhaps from behind.
I have the sensor mounted so I can pan and tilt.
There are a few other techniques if you google but I thought SLAM was the best choice for me.

#### AntR

#4
##### Aug 22, 2011, 05:01 pm
Have you considered taking a braitenberg vehicle approach, this works pretty well for obstacle avoidance.

http://en.wikipedia.org/wiki/Braitenberg_vehicle

Or perhaps Potential Fields would be more suitable - have a read of "AI Robotics" by Robin Murphy, this is a good reference book as a starter and it pretty readable.

Go Up