The assignment will be updated on a regular basis. Clarifications and modifications will be added as and when required. Note that answers should be submitted electronically, using subversion. You will be required to commit one or more files for each question, with specific file names. If you want to commit additional files, for functions that you may have written, that’s fine. Just remember to commit the specified files for each question, since that is what we will be looking for as a starting point for your solution.
This is a group assignment and should be completed in groups of 2, unless permission has been obtained from the course convenor to work by yourself. Both people in the group must contribute equally to the assignment. It is strongly recommended that both people in the group work collaboratively, rather than split the workload and work in isolation. Please note that a engn2219 student can only form a group with another engn2219 student, and not with a comp6719 student. Likewise, a comp6719 student can only form a group with another comp6719 student, and not with a engn2219 student.
Note that all work submitted must be entirely your own work. Make certain you use quality information and that you carefully reference all the material that you use. It is unacceptable to cut and paste another author’s work and pass it off as your own. Anyone found doing this, from whatever source, will get a zero for the assignment. Any material that you wish to quote should have the source clearly referenced. Read the school’s policy on plagiarism, to be found in the Research School of Computer Science Student Handbook.
It is strongly suggested that you start working on the report right away. You can commit as many times as you want. Only the most recent commit will be assessed. Check that your files work on the student system before committing. Please ensure that you copy your committed files to an appropriate folder in your directory on the student system as well.
Note that the ENGN2219 assignment is for the undergraduate students and the COMP6719 assignment for the postgrad students. The two are not interchangeable. If you find problems with this assignment (e.g., something is not clear, or there are broken links), please get in contact with the course lecturer immediately.
Task – Perimeter Protection
First posted: Sat 7 Mar 2015 15:44:46 AEDT Last modified: Sat 14 Mar 2015 16:05:05 AEDT Marks: 100
Mobile robots can be deployed in a variety of scenarios. In this assignment, we will use mobile robots for perimeter detection and protection.
Mobile robots are to be deployed to monitor the perimeter of a protected area. This could, for example, be a remote town or an area within a nature reserve. The area is rectangular in shape. Each robot has a sensor (vision, infrared, etc) with a specified range – a circle of specified radius – within which it can sense other objects. In order to sense other objects (including other robots), the object has to be within the sensor range of the robot. If two robots are physically within each others sensor range, then they can not only sense each other, but also exchange information, if required. Using the sensor, the robots can also sense whether they are inside or outside the perimeter of the protected area. Each robot has a specified maximum speed at which it can move.
The robots need to continuously monitor (patrol) the protected area from the inside of the perimeter, with the intention of protecting it from intruders. Any appropriate strategy can be used to distribute the robots along the perimeter such that together, they cover all of the perimeter. This will involve each robot moving continuously along the part of the perimeter that it is meant to protect.
The robots will initially be located randomly inside a specified square within the area. Each robot is aware of its initial co-ordinates. Each robot will need to move from their initial position, using their sensors to first determine the perimeter of the area that it is meant to protect and then continuously monitor this perimeter.
A robot should not collide with another robot. For the purposes of this assignment, two robots are said to collide if they end up in the same position. We will not worry about checking whether their paths intersect, while on the move. If two robots do collide, they will both be destroyed.
Your task is to simulate the movement of the robots from their initial position to the perimeter, their tracking of the part of the perimeter that they are meant to monitor and then their continuous monitoring of this perimeter. The simulation will end when the user stops it by pressing Ctrl-C on the keyboard.
The initial configuration is to be provided as input from the terminal, by the user. You may assume that all the numbers input will be integers. Also that the rectangles are aligned with the axes. The user is to be prompted for input in the following order:
- The (x,y) co-ordinates of the four corners of the rectangular area in cms, in clockwise order.
- The (x,y) co-ordinates of the four corners of the entry square in cms, in clockwise order.
- Number of robots (a positive integer).
- Range of the sensor of each robot (radius, in cms). They will all have the
same sensor range.
- Maximum speed of each robot (in cms/sec).
Include error checking, so that you report an error if you don’t get a sufficient
number of input parameters, or you are given incorrect input (eg, negative numbers,
where it should be positive). If there are errors, report the errors and exit. Some
sample inputs are given below:
- A configuration with a single robot:
# Rectangular area, in cms
00 0500 500500 5000
# Entry square, in cms
240 240 240 260 260 260 260 240 # Number of robots1 # Range of each sensor (radius, in cms) 25 # Maximum speed of each robot (in cms/sec) 25
- A configuration with multiple robots.
# Rectangular area, in cms 0 0 0 500 500 500 500 0 # Entry square, in cms 240 240 240 260 260 260 260 240 # Number of robots
9 # Range of each sensor (radius, in cms) 25 # Maximum speed of each robot (in cms/sec) 30
In your simulation, you may assume that a single time step is equal to one second. Draw the positions of the robots at each time step. You can use
the drawnow function command for this purpose. You can use the pause command to force a pause between plots. Remember to erase the previous positions when you draw the new positions. Explore how this can be done (you can use a number of different approaches and is quite easy to do. For example, create a new plot each time, although this is inefficient).Draw the perimeter as a thick black line. Draw each of the robots with a small filled red circle to denote its position and a red circle around it to show its sensor range. You can use the rectangle function to draw the rectangles and squares (and even the circles), if you wish. Any approach that works is fine.
Design your program keeping in mind functionality, the potential for reuse and efficiency of code. Your program should be in a file called robots.m. You may use as many functions as required. Functions that you think can be reused must be located in separate files. Document your code as appropriate.
Write a short report on your approach to solving the problem and on the design of your program and save this in a html, pdf or text file with
name design.html, design.pdf or design.txt, respectively. You should submit a draft of your design in early week 5, if you want feedback from your tutor on your proposed design. It is strongly recommended that you do so.
Marking Scheme
The marks will be allocated as follows:
Criteria Description |
Marks |
Your solution and design A write up of your approach to solving the problem and of your program design. Good program construction; appropriate use of data structures and functions; and efficiency of code, including use of builtin operators and functions, where appropriate and error checking. Good program design will involve the creation of appropriate functions. |
25 |
Documentation Appropriate documentation. This includes program and function descriptions, author details and appropriate commenting of code. Also include the appropriate time spent, in hours, and your feedback, if any, on the assignment. |
10 |
This includes use of indentation to make the code easy to read; Coding Style descriptive variable names; and avoiding the use of global variables. |
5 |
The simulation The simulation works correctly. It has appropriate and descriptive title and labels. If your simulation works only in the case where there is a single robot, you will get up to 35 marks. 5 marks will be reserved for good strategy. |