Author Topic: Smooth Steering obstacle avoidance algorithm  (Read 2914 times)

0 Members and 1 Guest are viewing this topic.

Offline WaterPig MasterTopic starter

  • Full Member
  • ***
  • Posts: 62
  • Helpful? 3
  • Hurdy Gurdy playing at Raglan
Smooth Steering obstacle avoidance algorithm
« on: August 09, 2011, 09:21:54 AM »
Hello all,

Just thought I'd post an outline of the algorithm I'm using in Weave (my modular obstacle avoidance robot) at the moment. It's not perfectly implemented, but when it's a bit better I'll post a video of it working.

It works like this:

Robot can see if there is an obstacle to the right or the left.
Program has two 8 bit variables, each corresponding to a direction (one for left and right)
During each loop, these variables are incremented if there is no obstacle and decremented if there is an obstacle in their corresponding direction.

After each loop (right and left sensor polled and variables adjusted), motor control works like this:
MSB is treated as a sign, 1=fwds and 0=backwds. The other 7 bits are used to determine the speed, via PWM. If direction bit = 0, the other 7 bits are complimented.

With a delay introduced into the loop, this produces a robot that, starting from still, speeds up until it gets to full speed. If it sees something to the left, the left motor will slow down through the variable decrementing, then when it hits 127 the direction bit changes, and it starts reversing that motor.

This results in a robot that steers in a fairly pleasant and pseudo-intelligent way, not making rapid jerky movements like mine used to.

I can post PIC asm for this if you like, but it's not pretty… :|


Offline prasanga17

  • Beginner
  • *
  • Posts: 6
  • Helpful? 0
Re: Smooth Steering obstacle avoidance algorithm
« Reply #1 on: June 26, 2012, 08:56:56 AM »
can you please post your pic asm to this forum...
i know it has been so long since you post this but i really like to have a look at your program. thanks


Get Your Ad Here