Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

There are 3 main layout parts: 1. Top Left: a track with 2 lanes, on which the R

ID: 3600700 • Letter: T

Question

There are 3 main layout parts:

1. Top Left: a track with 2 lanes, on which the RED car moves in real time

2. Top Right: a dynamic display of the main metrics we are interested in as the car moves

3. Bottom: controls for the driver to Start/Stop engine, Accelerate (increase engine RPM), Brake (with friction against the rotating wheels), and a Steering Wheel (showing the Steering Angle with respect to the front of the car always). The Steering Wheel could be controlled by Touch, Tap, or Drag.

The physics of the car movement and response is described in the following webpage:

http://www.asawicki.info/Mirror/Car%20Physics%20for%20Games/Car%20Physics%20for%20Games.html

Deliverables:

1. Android App

2. Show the following:

a. All your formulas,

b. All your assumptions

Android Car Simulator DISPLAY Metrics: Position (x,y) Velocity Acceleration Engine rpm 0-60mph Time Braking Distance Slip Angle Steering Angle (X) Start/Stop Brake Accelerate

Explanation / Answer

function []=moving_cars()
figure('units','normalized','outerposition',[0 0 1 1])
x = linspace(0,30,10);
y2=0.6;
y3=0.2;
y4=-0.2;
axis([0,20,-0.4,1.5])
ax = gca;
hold on
//%road
plot(x,y2*ones(size(x)), 'LineWidth', 1,'Color','black')
hold on
plot(x,y3*ones(size(x)),'--', 'LineWidth', 1,'Color','black')
hold on
plot(x,y4*ones(size(x)), 'LineWidth', 1,'Color','black')
hold off
axis off
title('( Moving cars Simulation )')
set(gcf,'color','w')
//%load image data
[imageData0, map, alpha] = imread('00.png', 'png');
[imageData1, map, alpha] = imread('20.jpg', 'jpg');
[imageData2, map, alpha] = imread('27.jpg', 'jpg');
//%create Figure and Axes objects
f1 = figure(1);
a0 = axes('Parent', f1);
a1 = axes('Parent', f1);
a2 = axes('Parent', f1);
//%Add Image objects to axes
image(imageData0, 'Parent', a0);
image(imageData1, 'Parent', a1);
image(imageData2, 'Parent', a2);
//%Resize and move the Image objects
set(a0, 'Units', 'Pixel', 'Position', [-160 150 150 70],'Box','off','Visible','off');
set(a1, 'Units', 'Pixel', 'Position', [-160 150 150 70],'Box','off','Visible','off');
set(a2, 'Units', 'Pixel', 'Position', [-160 150 150 70],'Box','off','Visible','off');
axis off
//%generate the train
Train= car_train()
//%moving the cars
check_type(Train,a0,a1,a2);
end
function [Cars]= car_train()
//%create random car train (10 cars between 1:2)
Cars = round((2-1).*rand(5,1) + 1);
end
function[]= check_type(Cars,a0,a1,a2,a3,a6)
for k = 1:length(Cars)
if(Cars(k)==1)
for i=1:2:1800
set(a1, 'Position', get(a0,'Position') + [i 0 0 0]);
drawnow
end
elseif(Cars(k)==2)
for i=1:2:1800
set(a2, 'Position', get(a0,'Position') + [i 0 0 0]);
drawnow
end
end
end
end

function[]= check_type(Cars,a0,a1,a2,a3,a6)
for i=1:2:1800
for k = 1:length(Cars)
if(Cars(k)==1)
set(a1, 'Position', get(a0,'Position') + [i 0 0 0]);
drawnow
elseif(Cars(k)==2)
set(a2, 'Position', get(a0,'Position') + [i 0 0 0]);
drawnow
end
end
end
end