java星球机器人建模UML

Your task is to design and implement a system for controlling a Mars rover – a wheeled robot for planetary exploration. The rover will be able to drive around on the planet’s surface, and will have a communications antenna, a camera, and tools for soil analysis.

 

There is no need for any user interface (in the conventional sense). The rover will perform tasks based on signals transmitted from mission control on Earth. For efficiency (since the signals will take several minutes to travel between planets), the rover is intended to work semi-autonomously. Specifically, mission control on Earth will send lists of tasks to be completed by the rover, one after another.

 

Each list of tasks will be identified by a unique integer, sent from Earth along with the tasks themselves. These are the possible tasks that the rover will need to carry out:

 

• Turn qdegrees clockwise (where -180<= q<=180).

• Drive x metres forward (where -100m <= x <=100m).

• Take a soil sample and analyse.

• Take a photo.

• Execute task list i(wherei is the identifying number of any previous list of tasks). In     this case, the rover must simply perform all tasks on that previous task list as if they appeared in the current list.

 

These tasks may occur in any order, and be repeated any number of times.

After each task is complete, the rover must send back a message to Earth. For turning and driving, the return message simply indicates success or failure. For soil analysis and photo taking, the return message will embed the result of that activity.

Each task must not be started until the previous task is complete. If the rover encounters a mechanical fault during one of the tasks (see the next section), the rest of the tasks in the list should be abandoned.

It is possible that a new list of tasks will be received before an existing list is completed.

When this happens, the tasks on the new list must be delayed until all previous lists have been completed or abandoned.

 

 

Existing Classes

 

Make sure you understand all this before you start designing anything!

The following classes are provided for you. (More accurately, you’re going to pretend that they’ve been provided for you.) You may assume that equivalent Python and

C++ classes exist as well.

IMPORTANT: You are not allowed to change anything within any of the following classes. Except for translating them into Python/C++ (if desired), you must use them strictly as they are in your design. (If you fail to heed this, you will certainly lose marks.)

 

These classes work asynchronously. They contain non-abstract methods for performing specific tasks. These methods will return before the task (driving, analysing, etc.) is finished. The task itself will continue in parallel while your code is running (“in the background”, if you prefer to think of it that way). The classes also contain abstract methods, which will be called from some private method within the class (not shown) when one of several things happens that your system must handle.

你可能感兴趣的:(java)