Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Maze Transverse Question : I am trying to build an autonomous(moves by itself) robot car that is suppose to be able to tranverse through a

Maze Transverse Question :

I am trying to build an autonomous(moves by itself) robot car that is suppose to be able to tranverse through a maze through start and finish.I started using this by the right wall follower algorithm. Currently I have two sensors that are attached to the car, an ultrasensor(tells how far something is), so we it can not see a wall, it turns left and a button in front so when it hits a wall, it can turn left.

The ultra sensor can dectect how far things are in a range so with this wall algo, it should constant see a value between 1 and 255 and if it can not see a wall, the sensor will be at 255. Can someone help me finish my pseudo code for this code and tell me if this logic would work? I feel like the timer logic isn't right.

// Program

state = 0 // change states, 0 - foward, 1 - bump into wall, reverse, 2 - turning car

timer = 0 // need a timer for car to react to potential actions that it can take

while 1 // infinite loop, robot car needs to run auto

pause(0.1); // using matlabs so there is a pause function

switch state

case 0: //foward

Car.MoveFoward // not a real object, but its moving foward

if(Touch Sensor activated)

state = 1;

timer = 1;

elseif(ultrasensor == 255) // if cant see wall turn left

state = 2;

timer = 2;

end

case 1: // reverse

Car.MoveBackwards // moves back

if(timer == 1)

state = 2;

timer = 2;

end

case 2: // done reversing, turns

Car.MoveLeft // moves left

if(time == 2)

state = 0;

timer = 0;

end

end // ends the while loop --

Sorry for poor formatting, Chegg does not give many opitions.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions