Skip to main content Skip to navigation

CS313 Robot Lab 4 & 5

The Final Task

Your robot is trapped in Gridworld, a place where you can only move along a grid painted on the floor. You need to find the way out (which you know is located in the top right hand corner) and escape. You have no other prior knowledge of the world. You also need to calculate the fastest route so you can tell the other robots and help them escape too. Easy you think, i'm an expert line follower. However some of the paths are blocked, meaning some of the lines will be impassable (you can detect objects in front of you using the sonar sensor).

grid world

The size of the grid, the number of cells and their relative dimensions may vary, but the way out will always be in the top right-hand corner. Lab tutors will place obstacles on the grid - you can assume that once you start to explore the environment, it will not change.

Your task is to:

  1. Systematically explore the grid and create a full representation of which paths are blocked. How you achieve this is up to you, but it is suggested you build on the previous exercises. You can assume that the robot always starts at A = 0,0.
  2. Provide a mechanism to store and view the map created by the robot. This can either be by saving it to a file and transferring it back to the computer, or by printing it to the robot’s LCD screen.
  3. Calculate the shortest unobstructed path to the way out, and write a message to send to the other robots. The message can be saved to a file and transfered back to the computer, or printed to the robot’s LCD screen.

It is important to remember that debugging an NXJ robot can prove to be difficult. Any test printed through the use of System.out.println will be pushed to the screen on the NXJ brick. However you can write to text files that are stored on the NXT brick in the same way you would from a standard Java program. These are then accessed using the NXJ Browser.

When programing, be considerate of how you will validate your code is working as expected. Consider writing state checks and debug text to a file, or make use of the LeJOS debugger. Debugging will become far easier if validation is built into your code from the beginning.

An important consideration here is the limited hardware capability your robot has, which will place a constraint on the amount of data you will be able to store. It is worthwhile ensuring you regularly delete old programs and data files from your NXT brick to avoid running out of storage space.

Good luck!

Once you have completed the task, go back to the assignment rubric and make sure you have everything you need to write your report. Do you have evidence for your solutions? Have you explored fully the behaviour and limitations of the robot in the real world? Are you able to critically reflect on your approaches and solutions to the tasks?