#Robotics Handling water tower or obstacles

David Meego - Click for blog homepageKeeping the momentum going, here is the next article in this series to help you prepare of the Robocup Junior Australia competition.

Your robot should now be able to line follow and navigate intersection markers successfully, so the next task is to make sure it can handle obstacles (previously known as the water tower) that might be placed in front of it. This challenge can be a little tricky as the robot will need to leave the line and then find the line again to continue line following.

Like the previous article, this article will be broken down into two sections. The first section will discuss detecting an obstacle and the second section will cover methods to navigate past the obstacle.

Please note that all of the methods below are assuming that the robot has two colour sensors, one on each side of the line.

Detecting an Obstacle

Detecting an obstacle is usually handled using either a touch sensor or an ultrasonic sensor. There are pros and cons for each type of sensor:

Touch Sensor Pros

  • Always works at detecting obstacles
  • 100% Reliable at fixed range
  • Will not detect pillars of raised sections as obstacles

Touch Sensor Cons

  • Can knock over obstacle if it hits too hard
  • Uses an extra sensor port
  • Can trigger when coming down from See-Saw

Ultrasonic Sensor Pros

  • Single sensor can be used for rescue and obstacle detection, which frees up a sensor port
  • Looks a little wider than a touch sensor (unless a bar is used)

Ultrasonic Sensor Cons

  • Ultrasonic must be forward looking to detect obstacles
  • Not always reliable at very short ranges
  • Could detect pillars of raised sections if range set too high

You can decide what sensor works best and design your robot hardware accordingly. I have built robots with both touch sensors and forward looking ultrasonic sensors. Using a forward looking Ultrasonic can free up a sensor port which can be used for a Gyroscope sensor which can help with the rescue part of the challenge (more on that in a later article).

Detecting the obstacle is as simple as watching for the touch sensor to be pressed or for the ultrasonic sensor to read a low value. This code can be a MyBlock or subprogram inside your main program loop. Once an object has been detected, I would recommend playing a sound so you know the obstacle handling code is now in play.

For more information about playing sounds, see the section in the previous article:

Navigating an Obstacle

Once an obstacle has been detected, your robot will need to leave the line and move around the obstacle and regain the line within 30cm (as per 2019 rules). There are a couple of approaches you could use (see step 4a or 4b), shown in the examples below:

Step 1: Line follow until you detect an obstacle, then stop

Step 1: Line follow until you detect an obstacle, then stop

Step 2: Play a sound and then move backwards to make space to turn

Step 2: Play a sound and then move backwards to make space to turn

Step 3: Turn away from the line

Step 3: Turn away from the line

Step 4a: Move around the obstacle using three straight lines in a half hexagon shape, or

Step 4a: Move around the obstacle using three straight lines in a half hexagon shape, or

Step 4b: Move around the obstacle using a curve by running the outside motor faster

Step 4b: Move around the obstacle using a curve by running the outside motor faster

Step 5: Continue moving until the outside sensor sees the line

Step 5: Continue moving until the outside sensor sees the line

Step 6: Stop moving and return to the line following code

Step 6: Stop moving and return to the line following code

Notes:

  • The obstacle might be larger than you practiced with and can have a diameter or diagonal length of 15cm (as per 2019 rules).
  • The obstacle might have square edges which your robot could get caught on.
  • Be careful not to go too wide as you don’t want to fall off the tile, especially if it is raised.

More Information

For more information on robotics and the EV3 Basic extensions to Microsoft Small Basic, check out the following links:

Hope you find this information useful.

David

This article was originally posted on http://www.winthropdc.com/blog.

Please post feedback or comments

This site uses Akismet to reduce spam. Learn how your comment data is processed.