Course: Robotics

Class: 2012

Date: March 12, 2012

Objectives:

a)      Write a library of movement routines

b)      Implement a wall following algorithm

c)      Combine a) and b) to implement maze navigation

Part 1:       Movement routines

In this task, robotC was used to create the following routines: drive_forward(), reverse(), stop(), turn_left(), and turn_right(). A motor power of 50 was assigned to both motors B and C. In the drive_foward routine, a while loop was created such that the motors continue to move at a power of 50 while the given condition is true. In the stop routine, both motors were assigned power value of 0. For the motor to drive backward (thus the reverse function), motors B and C were assigned a power of -50 each. For the robot to turn right, motor C was given a power of 0, while motor B was given a power of 50. The wait time for the robot to turn at 90 degrees was 1350 milliseconds. Similarly, for the robot to turn left, motor B was given a power of 0 while motor C was given a power of 50. Again the wait time for the robot to negotiate a left 90 degrees turn was 1350 milliseconds.

To navigate the maze, three sensors were attached to the robot. The touch sensor was used to detect collision against obstacles. This enabled the robot to think and act, thereby implementing the next appropriate routine. The ultra-sound sensor was used to measure the distance between the robot and the nearest obstacle to the right side of the robot. The light sensor was used to measure the light intensity at the goal area.

Wall following

The touch sensor was used as the robot’s bumper. When the robot hits a wall or any obstacle, the sensor value was recorded as one. This value is combined with the sonar value to enable the robot determine whether or not to turn right or left. The sonar sensor measured the distance between the robot and the nearest obstacle on the right side of the robot such that if the distance was less than 40 centimeters and the bumper value was 1, then the robot would turn right. Otherwise if the bumper value was 1 and the sonar value was greater than 40 then the robot should turn left. When the robot reaches a dark area (which is supposed to be the goal area) and the reflected light from the ambient sensor measures 15 or less, then the robot is at its goal area, hence it stopped.

Fig1: Image of the maze showing the start and goal

Fig2. Image of the robot starting its navigation

Fig3: The robot uses its sensors to decide the next possible route.

Fig 4: The robot is reaching its goal area

In this task, the PID control was used to correct the movement of the robot. The PID control works such that if the measured speed is not equal to the desired speed, the PID algorithm uses the difference in speed (error) to adjust the motor power that should get the actual speed closer to the desired speed. To implement the PID control algorithm, the PID control was enabled on both motors by setting their nMotorPIDSpeedControl to mtrSpeedReg. To debug the PID control implementation, I navigated to the NXT Device Control Display and noted the changes in motor speed as the robot was suspended and running on a block.Controls

Discussions:

In this task, the robot implemented its required task by navigating from the start area to the goal area. It did well by navigating to its goal area in the first attempt. However, in subsequent attempts, a number of problems cropped up: the touch sensors stop working well and fluctuations in the weather causes the light sensor calibration to be changed from time to time. The malfunctioning of the touch sensor forced me to redesign the bumper. However, the ultra-sound sensor functioned perfectly. After much effort in recalibration of bumper and light sensor values, the robot achieves its goal upon further trials.

In this task, I learnt about sensors and their calibrations. I was able to include the sensor libraries into the code and used them to perform the required task. I was able to navigate to the NXT sensor devices to name the sensors. I learned so many ways to use the NXT sensors such as wall following, line tracking, and touching obstacles. I also noticed how small changes in the environment could cause the robot to deviate from its task or possibly cause its algorithm to malfunction. I also realized that the algorithms that I devised for implementing this task was built on the previous algorithms I implemented on some of my previous task. This made it easy to implement this task in a very short time.

Two problems relevant to Ghana, and the solution of which could involve sensing as an important component are defense, and natural disasters. A couple of years ago, a tanker of oil got lost from Ghana’s territorial waters. Not only that, other items are been smuggled into neighboring countries from time to time. The nation could protect its coastal borders with radar sensors such that where humanly impossible, these sensors could detect and record activities of such prohibited locations. Annual floods have become traditional in the city of Accra. With the help of remote sensing, we could obtain primary data about objects on the earth’s surface including water levels observed from space. The information obtained from the sensor readings could be used to communicate warnings to citizens. This will help provide accurate data for accurate positioning of infrastructure, aid in national development, as well as reduce casualties resulting from natural disasters such as flooding.