Task 3 – Treasure Hunt



The semester is still running and robotics as well. And we have had the privilege to work with the NXT and Lego mindstorm kit to perform fascinating tasks. In my last report, I described the tasks that we were engaged in. These tasks always improved, in terms of logic application and testing. Task 3 was a great field of an adventure that blew our minds and strength, however, it was an interesting experience in the world of robotics.


In task 3, we were asked to perform two major sub-tasks, which was to implement wall following using any two control principles that we studied in class, and rebuild our robot if necessary, to go treasure hunting in a sample world. Edem and I implemented the bang-bang and the P control for wall following, and we are going to discuss it in detail.


This task was very interesting and exciting in the sense that we programmed our robot to follow a given wall. Bang-bang was the simplest since the robot only had to follow the wall, given a distance away from the wall. Whenever the robot was closer to the wall than the given distance, it moved away and whenever the robot was far from the given distance from the wall, it moved closer. Here is a pseudocode for the wall following:

if (robot is close to wall) {

move away from wall;



move close to wall;




The robot moved in a zig-zag motion provided the conditions given it were satisfied. There was one interesting aspect of the wall following that we experienced. The robot was able to follow the wall whenever it was parallel to the wall. However, when it approached a curve, it struggled making a turn. It either crushed into that angle or it kept spinning in circles. Then we had to figure out a way to prevent this problem of collision and spinning. The two main instruments that helped us implement the wall following was the ultrasonic sensor in the mindstorm kit and the motors. The ultrasonic sensor helped the robot keep a certain distance from the wall while the motors moved the robot at a given speed. Therefore we had to make changes with respect to these two instruments.

With the motors, we wanted to maintain a slow pace, since we realized that when the robot moved very fast, negotiating a curve with the current algorithm will not be effective. So we programmed the motors within a range between 20 and 30, to get the required speed for the robot. In addition we had to change values for the ultrasonic sensor which was also in a range between 8cm and 12cm. So to make it work, we tried different values.


This task was the most involving among the two main tasks. Our robots were supposed to locate treasures (bottles covered with colored paper) and deposit them to their respective color goals. With the sensors provided in the mindstorm kit, this task seemed involving but easy to implement until we had to bring our ideas into reality.


Communicating with your robot to perform specific tasks has to deal with breaking down the problem into modules, so that the given task could be achievable. This makes it even easy for the programmer to understand and view the results that the robot gives after a specific task. Locate colored treasures and place them at their respective drop-off zone was the task, and as easy as it sounded, we were amazed the number of modules we came up with when we put our thoughts together. The functions we came up were: openArm(), closeArm(), locateBottle(), locateObstacle(), moveForward(), rightTurn(), moveBack(), explore(), stayInArena() and dropBottle(). These modules had definite tasks to perform as their names suggest and that is how we implemented them. This was our idea of how the robot was going to complete the task given the different modules stated before:

  • The robot explores the given world.
  • When it locates a treasure, it stops and picks up the treasure.
  • It uses wall following to locate the particular goal area.
  • Returns to do the exploration and runs these steps till it’s done.

This task gave us a real sense of the world in many ways. We had assumed how the world in which the robot was going to operate would be and how it was going to accomplish the task but we realized that there were more real issues to deal with, like when the bottles fell through the maneuvering of the robot, how was the robot going to locate that particular treasure with respect to the position of the RBG sensor, and place it at its destination. Another interesting task we realized was how we could make certain modules more accurate and effective. For instance, with the wall following, the robot had to move in accuracy so that it could deposit the treasure at the specified goal.

We had different modules working separately but as in a unit, the robot couldn’t complete its mission. We are still working to put all modules together and work effectively. This task also emphasized the fact that testing is a very essential part in robotics.


Traffic coordination: Due to the increasing rate of the population in the city, many cars are found in most busy areas in Accra. For example, the Tetteh Quarshie interchange is one area whereby people use to move from one point to another most often. Sometimes traffic could be so severe that it could be compared to an auction sale. Even though this project was to ease traffic in the area, it seems the purpose of this project is redundant. What could be done in this area to make the purpose of the interchange more effective is with the help of traffic lights. Traffic lights help ease traffic in an area, and we can include cameras to monitor the size of traffic at given times to determine the flow of traffic in a given time of the day. For instance, the Tetteh Quarshie interchange really gets choked during the morning hours and evening and so we can use the cameras to find out how many cars are present in a given time of the day and use it to determine how long a traffic light to stay on and off. This will make the traffic lights more dynamic in terms of functionality and not static.


Some areas in Ghana are close to water bodies and whenever it rains heavily, these places get flooded, causing so many problems like loss of lives and property. One way we can monitor floods in an area is the use of an ultrasonic sensor. The sensor can determine the normal depth of a river or water body and also have a high peak that whenever the level of a water body approaches that level, an alarm could be sent out to the organization that is monitoring the levels in water bodies and perhaps the people in the area. With this, an area can know how they are faring in terms of the water level and take measures to reduce the damage that flood causes.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s