Let’s recall the obstacles provided from the objective:
- Cube: 15cm on each dimension
- 4-side Pyramid: 15cm on each dimension, 15cm height
- 3-side pyramid: 15cm on each dimension, 15cm height
- Cylinder: 20cm height, 11 cm diameter, with a base all around (2cm large, 1mm height)
- Reversed 4-side pyramid: 15 cm height, 15cm on other dimensions.
The logic of the code design can be explained in the following steps:
Step 1: Move around the stadium with predefined location constraints like where the centre line of the stadium is and the borders on the sides to avoid .
Step 2: If ultrasonic sensor senses a reply to the signals sent, stop movement and scan the response area.
Step 3: The chain movement is then initiated. Assuming, initially the chain is up, it scans the area at that level and if the detected is not present in that level, the robot chains down until it detects the source of the signal. The same procedure is endured when the chain is down initially. Three ultrasonic sensor values are considered – Left, middle and right. After working with the obstacles, we know the dimensions of each of them and the corresponding ultrasonic values. So, we have trained the robot accordingly. The exact values for each obstacle can be seen in the source code of the project.
Amongst the given objects, the ball is identified when the chain is going down as the height of the ball is less than the others. All others are identified in the upper chain movements.