Answered step by step
Verified Expert Solution
Question
1 Approved Answer
An autonomous robot is being designed to step through a simple 2D obstacle course (that is a flat maze). For each step, the robot scans
An autonomous robot is being designed to step through a simple 2D obstacle course (that is a flat maze). For each step, the robot scans three points: to the left, in front, and to the right. The robot stores the results of the scan in a 1x3 vector (v) where each cell is occupied by either a 0 if no wall is scanned or a 1 if a wall is scanned (See Figure 1 for an example). When there is no wall is in front of the robot, then the robot continues to step forward. When the front of the robot is blocked, then the robot turns to face the direction without a wall present. If the robot could turn left or right, then it chooses a random direction. When the robot reaches a dead end, the robot turns by 180 degrees and steps back the way it came 1. Write an algorithm that determines whether the input vector,v is in the correct format (must be a 1 x 3 vector containing only ones and zeros 2. (AMS Submission) Convert the algorithm from question 1 to a MAT- LAB function. If v is in the correct format, then the code will output a 1, if v is in the incorrect format, then the code will output a 0. The function should accept a single input v 3. Write an algorithm that determines which direction the robot should step (assuming v is in the correct format) 4. (AMS Submission) Convert the algorithm in question 3 to a MAT- LAB function. The code should accept a single input v and output a number 1, 2, 3 or 4 for 'go straight', 'turn left', 'turn right' or 'turn around' respectivel;y 0,1,1 Fig. 1. The robot has just taken a step, it scans the three directions around it and finds no wall to the left, a wall directly ahead and a wall to the right, it then stores this information in the vector v-[0,1,1]. The robot will then decide to turn left with an output of 2
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started