Collision Avoidance and More

by Puck on February 8th, 2010

The initial rover collision avoidance algorithm was created so that the rover would turn his SONAR turret back and forth and attempt to detect an obstacle within 3 feet in any direction.  It worked well enough but was probably too aggressive.  When the Rover got close to a wall he got very suspicious when he probably didn’t need to.

Rover's Turret sweeping a constant forward arc for obstacles.

Rover will detect an obstacle anywhere within the 3 foot arc.

When the rover is operating near a wall, 3 feet of lateral clearance is too much.   It prevents him from traveling in parallel to a wall or from passing through any hallway less than 6 feet wide.

As the Rover attempts to navigate this hallway, the 3 foot detection radius registers as a false obstacle.

As the Rover attempts to navigate this hallway, the 3 foot detection radius registers the hallway as a false obstacle.

3 feet of clearance on the left + 3 feet of clearance on the right

=

6 feet minimum lateral clearance

If you would believe my high school math teacher we might be able to find a use for math in the real world.  In fact, there is a handy ratio function that lets us trim down the obstacle detection field.

Calculating a ratio to scale the obstacle field.

Calculating a ratio to scale the obstacle field.

If our obstacle detection is 3 feet and we want 10 inches of clearance on either side for the wheels, we can use the ratio to get there like this:

  • y – axis (Forward Obstacle Detection) = 36 inches (3 feet)
  • x – axis (Lateral Obstacle Detection) = 10 inches
  • 36 inches – 10 inches = 26 inches

We just plug our numbers into this equation and out drops our new detection zone:

Obstacle distance at angle Theta = (RATIO x 26 inches) + (10 inches)

Crunching these numbers we get the following results:

  1. -90 degrees = (0.0 x 26″) + 10″ = 10″ – (Looking Left)
  2. -45 degrees = (0.5 x 26″) + 10″ = 23″ – (Looking Left & Forward)
  3. 0 degrees = (1.0 x 26″) + 10″ = 36″ – (Looking Forward)
  4. +45 degrees = (0.5 x 26″) + 10″ = 23″ – (Looking Right & Forward)
  5. +90 degrees = (0.0 x 26″) + 10″ = 10″ – (Looking Right)

That changes the shape of the obstacle detection field from a half-circle into this triangle:

The obstacle field is trimmed to allow for more lateral clearance.

The obstacle field is trimmed to allow for more lateral clearance.

With this little bit of math we can more easily travel through a narrow hallway.  This modified detection algorithm is what we used in the successful obstacle avoidance test video.  The best part is that while we travel parallel to a wall we won’t detect it as an obstacle but if we start to drift into it, the Rover will still detect it.

From → C Programming, Rover

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS