25
Maze Running Robots EGR106 Project Spring 2004

Maze Running Robots EGR106 Project Spring 2004. Project Goal Computer control (through a Matlab program) of a Lego robot to: 1.Explore a maze (start to

  • View
    224

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Maze Running Robots EGR106 Project Spring 2004. Project Goal Computer control (through a Matlab program) of a Lego robot to: 1.Explore a maze (start to

Maze Running Robots

EGR106 Project

Spring 2004

Page 2: Maze Running Robots EGR106 Project Spring 2004. Project Goal Computer control (through a Matlab program) of a Lego robot to: 1.Explore a maze (start to

Project Goal

Computer control (through a Matlab program) of a Lego robot to:

1. Explore a maze (start to end)

2. Recognize the final room to drop cargo

3. Return the robot to its starting place

START

END

Page 3: Maze Running Robots EGR106 Project Spring 2004. Project Goal Computer control (through a Matlab program) of a Lego robot to: 1.Explore a maze (start to

• You will not be assembling the robot, but controlling it

• Basic control will be through a Matlab function

Typical robot circa 2002

Page 4: Maze Running Robots EGR106 Project Spring 2004. Project Goal Computer control (through a Matlab program) of a Lego robot to: 1.Explore a maze (start to

Maze Assumptions

• Size is known • Start is at the lower

left corner, robot pointing up/north

• Drop site for the cargo is at the upper right corner

START

END

Page 5: Maze Running Robots EGR106 Project Spring 2004. Project Goal Computer control (through a Matlab program) of a Lego robot to: 1.Explore a maze (start to

The Robot Interface

MATLAB function robot.m:

[l,c,r] = robot(command)

• one input value

• three binary outputs

Page 6: Maze Running Robots EGR106 Project Spring 2004. Project Goal Computer control (through a Matlab program) of a Lego robot to: 1.Explore a maze (start to

• Value for command (plus the robot always looks around):

0 drive forward one unit (room)1 turn left by 90o 2 turn right by 90o

3 do nothing (just look around)4 play a sound (drop the cargo)≥ 10 initialize and run the simulator

Page 7: Maze Running Robots EGR106 Project Spring 2004. Project Goal Computer control (through a Matlab program) of a Lego robot to: 1.Explore a maze (start to

• Three binary output variables:– Returned for all commands – Denote the presence or absence of wall

openings from the current room/orientation– Left, Center, Right walls only – Value = 1 for opening present, 0 for no opening

• Note – result is dependent upon the orientation of the robot.

Page 8: Maze Running Robots EGR106 Project Spring 2004. Project Goal Computer control (through a Matlab program) of a Lego robot to: 1.Explore a maze (start to

Output is

[ L, C, R ] = [ 1 0 0 ]

Output is

[ L, C, R ] = [ 1 1 0 ]

Page 9: Maze Running Robots EGR106 Project Spring 2004. Project Goal Computer control (through a Matlab program) of a Lego robot to: 1.Explore a maze (start to

Robot Simulator

• Useful for program development – Virtual robot, much faster than the

real thing– Available 24/7 (download file)– Includes multiple practice mazes

to test your programs – maze and robot progress shown in a figure window

Page 10: Maze Running Robots EGR106 Project Spring 2004. Project Goal Computer control (through a Matlab program) of a Lego robot to: 1.Explore a maze (start to
Page 11: Maze Running Robots EGR106 Project Spring 2004. Project Goal Computer control (through a Matlab program) of a Lego robot to: 1.Explore a maze (start to

Programming Notes

4 parts:1. Search/wander the maze

2. Build a map of what you see

3. Drop the cargo; analyze the map

4. Return to start

Page 12: Maze Running Robots EGR106 Project Spring 2004. Project Goal Computer control (through a Matlab program) of a Lego robot to: 1.Explore a maze (start to

1. Search/wander the maze– Make good moves – remember that the goal is

to get to the upper right corner; don’t just make random turns, aim the robot

– Keep track of the robot location – row and column notation makes it easy to recognize the end room

– Orientation determines where the robot goes

Page 13: Maze Running Robots EGR106 Project Spring 2004. Project Goal Computer control (through a Matlab program) of a Lego robot to: 1.Explore a maze (start to

2. Build a map of what you see– At the beginning you know nothing of the

maze; for each new room visited, you learn a bit more

– Use the map to help the exploration (i.e. recognize areas/directions to be ignored, don’t revisit rooms, …)

– One idea on mapping is …..

Page 14: Maze Running Robots EGR106 Project Spring 2004. Project Goal Computer control (through a Matlab program) of a Lego robot to: 1.Explore a maze (start to

A map “matrix” for a M by N maze: – Number the rooms 1 to M*N– The (m,n) and (n,m) entries (identical) describe

the connection between rooms m and n using 3 values:• connection unknown• no direct connection • a direct connection

Page 15: Maze Running Robots EGR106 Project Spring 2004. Project Goal Computer control (through a Matlab program) of a Lego robot to: 1.Explore a maze (start to

Example Map1 2 3 4 5 6 7 8 9 10 11 12

1

2

3

4

5

6

7

8

9

10

11

12

Legend:

white = not adjacent

red = closed wall green = open wall

1 2 3

1 0 119

65

1 2

7 8

4

Page 16: Maze Running Robots EGR106 Project Spring 2004. Project Goal Computer control (through a Matlab program) of a Lego robot to: 1.Explore a maze (start to

3. Drop the cargo; analyze the map– Identify the end room by beeping – Use the map matrix to find a short path back

to start – While many ideas could be tried, one simple

analysis tool is Bellman’s flooding algorithm…..

Page 17: Maze Running Robots EGR106 Project Spring 2004. Project Goal Computer control (through a Matlab program) of a Lego robot to: 1.Explore a maze (start to

Bellman’s flooding algorithm:– Start analysis at the “end” room– Assign costs to each room of going from that

room to the end– Sequentially expand to connected adjacent

rooms– Stop when you hit “start”

Page 18: Maze Running Robots EGR106 Project Spring 2004. Project Goal Computer control (through a Matlab program) of a Lego robot to: 1.Explore a maze (start to

0

0

1

2

2

0

1

2

2

3

34

0

1

0

1

2

2

3

3

0

1

2

2

3

345

5

67

6

Page 19: Maze Running Robots EGR106 Project Spring 2004. Project Goal Computer control (through a Matlab program) of a Lego robot to: 1.Explore a maze (start to

• Path identified by tracing from “start” to “end” following decreasing costs

• Result: room path

1, 2, 6, 10, 11, 7, 8, 12

0

1

2

2

3

345

5

67

6

1 2 3

1 0 119

65

1 2

7 8

4

forward

Page 20: Maze Running Robots EGR106 Project Spring 2004. Project Goal Computer control (through a Matlab program) of a Lego robot to: 1.Explore a maze (start to

4. Return to start– Convert reverse

path to robot commands

12, 8, 7, 11, 10, 6, 2, 1

1 2 3

1 0 119

65

1 2

7 8

4

3

1

2

3

2

04

56

5

67

reverse

Page 21: Maze Running Robots EGR106 Project Spring 2004. Project Goal Computer control (through a Matlab program) of a Lego robot to: 1.Explore a maze (start to

12 8 7 11 10 6 2 1

robot(1)robot(1)robot(0)

robot(2)robot(0)

robot(2)robot(0)

robot(1)robot(0)

robot(1)robot(0)

robot(0) robot(2)robot(0)

1 2 3

1 0 119

65

1 2

7 8

4

Page 22: Maze Running Robots EGR106 Project Spring 2004. Project Goal Computer control (through a Matlab program) of a Lego robot to: 1.Explore a maze (start to

Team Deliverables• Working program(s):

– electronic copy for testing

– written description (with examples)

• Written report:

– details of format later

• Oral Presentation to class:

– each person describes an aspect of the work

• Due May 4 (final class day)

Page 23: Maze Running Robots EGR106 Project Spring 2004. Project Goal Computer control (through a Matlab program) of a Lego robot to: 1.Explore a maze (start to

Scoring in the Demonstration

• Sum of two parts (a lower score is better):– 1 point per forward movement while searching – 2 points per forward movement while returning

• Must: – Drop the cargo in the “end” room– Return to “start”– Not cross walls

Page 24: Maze Running Robots EGR106 Project Spring 2004. Project Goal Computer control (through a Matlab program) of a Lego robot to: 1.Explore a maze (start to

Schedule

• Today:– meet your team (Preassigned)– brainstorm issues and ideas, ask questions

• Homework (due this Thursday):– team name

Page 25: Maze Running Robots EGR106 Project Spring 2004. Project Goal Computer control (through a Matlab program) of a Lego robot to: 1.Explore a maze (start to

Schedule (continued)

• April 15, 20, 22, 27 & 29– in-class work time– Quiz 3 on the 20th – weekly reviews with me (5 minute schedule per

team)

• May 4: – Presentations including maze running demos