User Tools

Site Tools


reu:scouter_project

Scouter Project

Tasks

  1. Create a robot that can move forward any distance that is specified by the user.
  2. Make the program gather sensory input after the robot has traveled the desired distance. This sensing is to be done concurrently.
  3. Have the robot store this data in a file then redisplay it to the user after returning to the starting point.

Procedure

  1. Design a function that allows the user to choose the distance that is traveled by the robot. Once the user has given the input for the distance, the robot should travel the given distance and not move until all of the sensory data has been collected.
  2. The gathering of the sensory data is to be done concurrently. This approach calls for three threads that will gather each type of data. There are three threads because there are only three sensors whose data are actually meaningful for an environment scouting robot. The data that is gathered should not be only one reading. Have the threads take a series of readings and average them.
  3. The threads write all data to a file that is stored on the NXT Brick's flash memory. The threads should write to the file their data and what type of data it is. Since the NXT Brick has little flash memory, each thread should identify its data with a preceding char that will signal to the reader of the file what type of data is to follow.
  4. The robot should then return to the user. This should be a simple reversal of the robot's direction and forward movement of the same distance that was traveled in the beginning. The robot should then read the data that is in the file and output a summary of all the results to the user.

Final Remarks

  1. For simplicity, have the user choose between three or four distances for the robot to travel.
  2. The ultra-sonic sensor takes 30 milliseconds to issue a ping and read the reflections that are returned from the ping. Take this into account.
  3. When writing to a file, threads can overwrite each other when one thread is writing to a file. Avoid this phenomenon by the using synchronization.
  4. Do not use temporary storage. In other words, do not store the data that is gathered by the robot into a String, and then output the String to the user. The file that is written to and read from should be available in the NXT Brick's flash memory even after the program terminates.
  5. It may be a surprise that the code within the leJOS API currently does not have an implementation for the join method. In other words, the join method that is provided in the leJOS NXJ library is useless. Make sure to take this into account when developing the functionality of the main program/thread.
  6. Remember to close the streams.
  7. Create a non-threaded version first then implement threading. This approach will help in debugging.
reu/scouter_project.txt · Last modified: 2009/02/03 08:56 by jtk