Question: Overview: There is one problem which has two major parts. You need to submit your solution as per guidelines mentioned above. Your solution should be

Overview:

There is one problem which has two major parts. You need to submit your solution as per guidelines mentioned above. Your solution should be generic and will be tested with different data in the same format.

Problem:

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 vehicle and the project is chosen as finalist in WAITTA awards (http://inciteawards.org.au/finalists/) in the category of Research and Innovation Project of the year Postgraduate Tertiary Student. Ray Barker (lab demonstrator in the course) is the member of the team which developed the testbed and is going to present the project to judges for the award. You can watch his 60 seconds pitch at: https://www.youtube.com/watch?v=ow3AwdkZjmE&feature=youtu.be. 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.

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 perform the following actions:

Move North

Move West

Move East

Move South

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.

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.

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 instructions for each microcar and, the second list contains the names of the files (including locations if required) containing the actual actions.

The two csv files will contain lines in the following format: Action, time - where each action will be specified as:

N, t, s = Move North for t seconds with speed s meters per second

E, t, s = Move East for t seconds with speed s meters per second

W, t, s = Move West for t seconds with speed s meters per second

S, t, s = Move South for t seconds with speed s meters per second

The function will return six lists:

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 computation.

Additionally the data will adhere to the following constraints:

There will never be a missing instruction. The number of expected and actual instructions will always match.

Both files will contain valid instructions only.

Note: you may need to import CSV library module for reading files in your function.

Part 2:

In addition to the function described above, write a second function plotmicrocar which will accept the same arguments and perform the same calculations as before 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.

We expect these plots to be generated as sub-plots and match the example templates. You need to ensure that scatter plots are square in size and have same dimensions for easy of understanding of the results. In addition, the dimensions should be larger 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 writing plotmicrocar function, dont re-write your code and 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:

exp1.csv

exp2.csv

act1.csv

act2.csv

You can download the files from LMS from the same location of assignment sheet (click here). 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. Remember the data presented in the chart is sample only and is not correct or related to the sample data files.

Hints and help:

Here is some example code on opening and processing a CSV file in Python:

import csv

with open('filename', 'r') as file:

reader = csv.reader(file)

for row in reader:

print(row)

where filename includes the .csv extension r indicates you wish to only read the file. There are many other options such as w for writing and rw for both reading and writing etc. There are also other methods to read CSV files as discussed in the lectures

Note: This is a significantly larger assignment than the first, your solution should lie around 100 lines of code and you are suggested to start early.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!