Your robot must navigate from the initial position to the exit traveling only in straight lines. If it encounters any obstacle, it will be deflected at same angle with the same speed. (e.g. if it was...

Your robot must navigate from the initial position to the exit traveling only in straight lines.
If it encounters any obstacle, it will be deflected at same angle with the same speed. (e.g.
if it was to hit the top boundary at vx= 50 and vy= 25, it will exit the collision at vx= 50
and vy= −25.)
Your only decision is at what angle w.r.t. the horizontal axis should the robot be initially
set off. However, the mathematics involved in such calculation contains far too many vari-
ables and would not scale well if additional obstacles are introduced. Therefore, you must
test each run stochastically by randomizing the angle of departure (θ) between 0◦and 90◦
over numerous trials to find the optimized one.
To do so for each run (see Table 1 for parameters), set up 10 bins. For each bin, there
should be at least 10,000 trials to produced the optimized angle for that bin. Then, in or-
der to avoid outliers, you will average the θ value for all 10 bins for the finalized predictive
“best angle”.
Table 1: Run Parameters
object parameter run 1 run 2 run 3
map / outer boundary x size 1000 1000 1000
y size 300 500 500
center wall shape rectangle rectangle rectangle
x size 100 100 100
y size 150 350 350
center x location 500 500 500
center y location 150 250 250
robot shape circular circular circular
radius 25 25 25
initial center x location 50 50 50
initial center y location 50 50 50
initial speed (units/s) 100 100 100
exit x size 50 50 50
y size 50 50 50
center x location 975 975 975
center y location 275 475 275
time dt 0.1s 0.1s 0.1s
22 Required Functions
Your finished script is required to have and use the following functions:
2.1 Function 0 - Draw Rectangle and Circles
The functions for plotting empty rectangles (draw_rec(x,y,l,w,c)) and plotting solid
circle (draw_cir(x,y,r,c)) are given in the project description on the course webpage.
You must use draw_rec to draw the outer boundary, center obstacle, and exit box; you
must use draw_cir to draw the robot.
2.2 Function 1 - Plot Map
Develop a function called:
function plot_map(map, wall, ball, exit)
Where the function would plot the simulation map that include the map boundaries, the
center wall as the obstruction, the robot in the shape of a solid circle, and the exit as a
empty rectangle.
map matrix of the map vertices
e.g. map = [map_x_min, map_x_max; map_y_min, map_y_max]
wall matrix of the wall vertices
exit matrix of the exit box vertices
ball vector for robot’s shape information
e.g. ball = [ball_x, ball_y, ball_r]
Please call draw_rec and draw_cir functions here to draw the corresponding objects.
point.
Mar 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here