Assignment 2

Due: Wednesday, Jan. 31 at 5:00 p.m.

This assignment can be completed in pairs or individually.  However, you are strongly encouraged to complete it in pairs.

The objective of this assignment is to design a system for controlling a set of SRV-1 robots.  The user of this system will launch a text-based application (similar to TicTacToeApplication) and will execute such tasks as adding robots to the system, grouping them, and sending commands to individual robots or groups of robots.  The particular use cases your design should address are given in the next section.  Note that you are not asked to implement this system!  Your main priority is to partition the system into manageable classes and specify the interactions between classes.  Whatever design principles or patterns which have been presented in class prior to the submission date should be utilized (where appropriate) and discussed in the report.

Ultimately, the ability to connect with a robot will be provided by a NetworkConnection class.  One instance of NetworkConnection should be used for communication with one robot.  You can assume that this communication occurs over a wireless LAN (NetworkConnection takes care of the details).

The connect method will return false if the address is incorrect, or the robot is turned off or malfunctioning.  The send method sends a string to the robot and returns the robot’s response.  The strings sent to the robots will adhere to this protocol.  Please don’t get carried away and try to represent all of these possible commands.  The point is that the robot expects command strings of a certain format and will produce corresponding response strings of another format.  Your design should incorporate components to represent the commands and their responses.

The robots themselves will not be identical.  The optional features are ultrasonic sensors and wheel encoders.  Note that if a robot does not have a particular sensor, then certain commands will be invalid.  If the user issues an invalid command, they should be told.

In terms of UML diagrams, class and sequence diagrams should be your final output.  You should design down to the level of detail where the public methods of all classes are given.  You are recommended to begin your design on paper, or use a whiteboard.  Once you have a clear idea of the final shape of your design, you can use a tool such as Visual Paradigm to draw the corresponding UML diagrams.  Your submission should be a written report with embedded diagrams (e.g. screenshots from Visual Paradigm), with explanatory text to guide the reader through the diagrams and explain interesting design choices.

Use Cases

The system should satisfy all of the use cases given below:

Note that ENFA stands for “an error message is printed and no further action is taken”.

  • AddRobot: The user supplies the robot’s address (a string) and specifies its optional sensors (whether it has wheel encoders and/or ultrasonic sensors).  The address field should be unique so if there is an existing robot with that address then ENFA.  The robot will be added to the “default” group.
  • ClearGroups: Clear all stored information about the groups that each robot belongs to.  The group for all robots will be changed to “default”.
  • AddRobotToGroup: The user supplies a robot address and group name (both strings) to add the robot to a group.  If the address is unknown then ENFA.  If the robot already belongs to a group then it is transferred to its new group.  If the robot does not have a group, it is added to the new group.
  • SendCommand: The user supplies a robot address or group name and a command string.  The command string is first compared against the list of known commands.  If it fails to match any known command format then ENFA.  If the robot address or group name is non-existent then ENFA. Otherwise, the given command is sent to the robot or group (i.e. all robots in the group). If any transmission fails then ENFA.  Most commands elicit a response from the robot (e.g. the command to print the battery level).  If there is such a response, it will be checked against the expected response format for the given command.  If there is a match the response string will simply be displayed.  However, if the response does not match then a warning message will be printed: “Unexpected response from robot!”


First you will need to enrol yourself in the appropriate group in Brightspace (D2L).  Under “Communication” look for “A2 Groups” and enrol yourself in one.  If submitting as an individual, you still need to join a group.  If submitting as a pair, make sure both individuals are added to the group.

Submit a PDF document generated from your word processor.  If you are doing this assignment in pairs then clearly indicate both partner names on the title page.