Lab 3 Part 1
CITS2401 Computer Analysis and Visualisation Semester 2, 2019
Due date: Friday 5:00 pm, 25 October 2019 Total marks: 30
Assignment submission instructions:
Submit 1 Python file via the CITS2401 page on LMS -> Labs -> Lab 3: Analysis and visualisation with Python -> Lab 3 (Part 1/3)
Submit one Python file under the filename: YourSurname_Studentnumber e.g. Smith_902787889
You have unlimited attempts to upload your solution. However, only the last submission before deadline will be considered and graded. You need to contact Unit Coordinator for late submission if you are making submission after the due date.
Ensure your solution works on ECM computers because it will be graded on ECM computers using Thonny. In addition, ensure that you have submitted the correct file and completed the submission process.
You are required to use libraries which are discussed in the lectures. No other libraries are allowed to be used.
Failure to follow the submission guidelines may result in the award of zero grade.
Plagiarism.
All work submitted should be your own. I am sure that you agree that this is for your own good!! If you do not agree, please note that we have ways to detect plagiarism in code. Incidences of plagiarism will be taken seriously and will involve follow-up with head of school and consequences to academic results.
Question
There is one problem which has two major parts. Your solution should be generic and will be tested with different data in the same format. You need to submit your solution as per guidelines provided above.
Real-time Optimization, Scheduling and Logistics (ROSL) research group (http://www.ecm.uwa.edu.au/research/real-time-optimisation-scheduling- logistics) in Department of Computer Science and Software Engineering (CSSE) bought Remote-controlled Zen Wheel microcars for its research (http://zenwheels.com/). Researchers developed a testbed for testing different algorithms for autonomous vehicles and the project was chosen as finalist in WAITTA awards 2018 in the category of Research and Innovation Project of the year Postgraduate Tertiary Student. You can watch the 60 seconds pitch at: https://www.youtube.com/watch?v=ow3AwdkZjmE&feature=youtu.be and read about the details on IEEE website (https://ieeexplore.ieee.org/abstract/document/8452376). You can also visit Room G04 in CSSE building to have a look at the project.
While working on the project, researchers developed an interface which can execute pre-determined programs. However, it is found that movement of microcars is not perfect and will sometimes perform an incorrect action.
Dr. Ghulam Mubashar Hassan Page 1 of 4 Unit Coordinator CITS2401
Researchers when testing their latest development maintain a copy of the intended program but also track what movements have actually been made externally. Each car can move at any angle with respect to East direction at any speed for any time.
Researchers have performed a series of trials where multiple microcars have been tested in sequence and have bundled all the data into two csv files per microcar. One contains the instructions given to each microcar and other contains the actions performed by each microcar. In some cases, researchers were unable to get the actual values, so they inserted NA for missing values in csv files.
Your task, given both files is to find:
The final displacement of each microcar from the origin (in both horizontal and vertical axes).
The total distance travelled by each microcar.
Note: you are allowed to import only those library modules which are discussed in
the lectures.
Part 1:
Write a function microcar which accepts two inputs. The two inputs are two lists of strings containing names of csv files (including locations if files are not in the same folder where file containing the function is stored): the first list contains the names of the files (including locations if required) containing the expected instructions for each microcar and, the second list contains the names of the files (including locations if required) containing the actual actions of each car corresponding to the expected instructions provided to them.
The two csv files will contain lines in the following format: Angle, time, speed where each action will be specified as:
A, t, s = Move at an angle of A degrees with respect to East direction (positive horizontal axis) for t seconds with speed s meters per second.
D r . G h u l a m M u b a s h a r H a s s Aa n Unit Coordinator CITS2401
dx = d*cos(A) East
P a g e 2 o f 4
o
dy = d*sin(A)
The function should return six numpy arrays:
The expected horizontal displacements for each microcar
The expected vertical displacements for each microcar
The actual horizontal displacements for each microcar
The actual vertical displacements for each microcar
The expected distances travelled by each microcar
The actual distances travelled by each microcar
All displacements and distances are to be presented in meters and rounded to 2 decimal places for the final returned lists. Keep the data rounded to at least 10 decimal places for all intermediate computations.
Additionally the data in the csv files will adhere to the following constraints:
There will never be a missing instruction.
The missing actual readings for microcar are replaced by NA in the actual
csv file for the microcar. If you find NA then ignore the entire instruction
(row in csv file) for both actual as well as expected csv files for the microcar.
The number of expected and actual instructions for a microcar will always be
the same.
Both files will contain valid instructions only.
Part 2:
In addition to the function described above, write a second functionplotmicrocarwhich will accept the same arguments and perform the same calculations as microcar function but will additionally create the following plots:
A bar-plot comparing the expected and actual distance covered by each microcar.
A scatter-plot of the expected final horizontal and vertical displacements for each microcar.
A scatter-plot of the actual final horizontal and vertical displacements for each microcar.
I expect these plots to be generated as sub-plots and match the example template. You need to ensure that scatter plots are square in size and have same dimensions for ease of understanding of the results. In addition, the dimensions should be large enough such that microcar displacements should not be at the corner of the plots. Dont forget the guidelines of plots explained to you during the lectures.
Note:when writingplotmicrocarfunction, dont re-write your code. Make a function call to your original microcar function to generate your data.
Examples and Sample Data:
You can get a sense of what we expect by looking at the following sample data files for 2 microcars:
expected1.csv expected2.csv actual1.csv
actual2.csv
Dr. Ghulam Mubashar Hassan Unit Coordinator CITS2401
Page 3 of 4
You can download the files from LMS -> Labs -> Lab 3: Analysis and visualisation with Python -> Data files for Lab 3 (Part 1/3). Your command to call the second function containing lists of these files may look like
plotmicrocar([exp1.csv,exp2.csv],[act1.csv,act2.csv])
The sample plot is presented for guidance in Figure 1. Remember the data presented in the chart is sample only and is not correct or related to the sample data files.
Figure 1: Sample plot for guidance. This is not related to sample data files
Marks distribution:
Part 1:
Function definitions including name, input, outputs, etc.: 1 mark
data files reading: 4 marks
data processing and generating outputs: 14 marks
Part 2:
Function definition including name, input, outputs, etc.: 1 mark
Functionality to calculate data for plotting: 3 marks
Visualisation: 7 marks
Dr. Ghulam Mubashar Hassan Unit Coordinator CITS2401
Page 4 of 4
Reviews
There are no reviews yet.