Intro
The Boe-Bot Robot kit is an educational kit available from Parallax perfectly suited for robotics amateurs and enthusiasts. The kit comes with the essential components, the main robot and a few extra sensors but more components are available to extend its functions. The programming is done through Basic Stamp Editor software provided by the company, and the programming language is a modified version of BASIC. The code can afterward be downloaded through USB to the Basic Stamp microcontroller on Boe-Bot's main board.
This kit was used to complete an Autonomous Robotic Vehicle project at Wentworth Institute of Technology, in the Spring 2012 semester, for an Independent Study with prof. Thomas Goulding, chair of the CS department. After getting comfortable mounting the necessary sensors each time, programming them and adjusting them, my teammate and I had to present a final project, for which we used a down-scaled version of the 2012 TEPRA Robotics Competition challenge. The project was split in two as it consisted of two parts, which required two different sets of sensor, the completion of a specific track and parallel parking. This page is dedicated to the presentation of the first part only.
Specifications
The track as defined by the competition is displayed below:
The track is a simulation of real world driving conditions where:
The black solid lines represent the outer and inner boundaries of the road.
The dotted line in the middle of the road separates the two opposite traffic lanes.
The short black lines at the turns represent a STOP sign.
The autonomous vehicle should be placed at any place in either lane and complete the track:
Staying within the lane boundaries.
Stopping at the "STOP" signs.
Distinguishing and determining left and right turns.
Avoiding obstacles and returning to its lane.
Project Development
For practical purposes, the actual track was scaled down to a common 4x2 ft white carton and black electrical tape was used to illustrate the above figure. Furthermore, due to lack of space, both sides of the carton were used, one for the left turns challenge and the other for the right turns. However there is only one code for both aspects. After the modification the tracks looked like this:
1. Line Following - Light Sensors
The most fundamental aspect of the project was to develop a line following technique specific for this track. A previously completed line following track is shown below:
However, in the above demonstration four light sensors were grouped together in the front of the vehicle; the middle two constantly scanning black color and the other two at the edges constantly scanning white color. The differentiation between black and white provides sufficient data to manouvre the robot. For example when the three left sensors read black, that indicates a left turn, and when only one of the middle sensors reads black, that means the robot is going out of track (this is caused from the servos not having identical parameters, therefore behavior) and needs a small adjustment.
In our scenario we only needed one sensor in the front side, to detect the STOP line, and three sensors on the right side to go along the track (this way we didn't have to worry about going out of the lane). Those three sensors were placed in the following configuratio: The two outer sensors were mounted at the same length out of the main body, while the middle sensor was shorter. Using this approach, whenever the two outer sensors would read black and the middle one would read white, the robot would move forward. Any other combination would indicate an "out of track" situation.
2. Turns Differentiation
By constantly tracking the right line, the inner bound of the track, it is easily able to distinguish right turns from left turns after the STOP line.
If after the stop line, the right sensors read black, then the upcoming turn is a left. Otherwise it is a right turn.
3. Obstacle Avoidance - IR Detectors
This part can be completed by utilizing two Infrared, IR, sensors, one in the front of the robot and one in the right side.
When the front sensor detects an object:
Stop the robot.
Pivot the robot 90° to the left and utilize the right IR sensor.
Keep going forward until the IR sensor detects the edge of the obstacle plus some safety distance for the next turn.
Pivot the robot 90° to the right and utilize the right IR sensor.
Keep going forward until the IR sensor detects the first edge of the obstacle (same as before)
Keep going forward until the IR sensor detects the last edge of the obstacle plus some safety distance for the next turn.
Pivot the robot 90° to the right and stop using the IR sensors.
Keep going forward until the front light sensor detects the black line of the track.
Perform a regular 90° left turn to get back to track.
Code
At the bottom of the page.
Code Notes
If the above code is useful for your own project keep in mind that:
The servo values in the above code need to be changed accordingly.
The actual performance of the robot will vary due to friction, battery levels and other physical parameters.
Under ideal conditions all routines work correctly. For a broader approach the code is missing error correction and alignment. This can also mean mechanical adjustments to the position of the light sensors, as well as addition/removal of them.
The PAUSE function's values are exaggerated on purpose; first, to allow time for the sensors to act; second, to allow the programmer to see what is being executed each time.
An extra IR detector can be mounted on the back side of the robot to incorporate the parallel parking function in the given configuration. Otherwise, an Ultrasonic Distance Detector would be more suitable for this task alone.