EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next...

36
EECS 367 Lab Assignment 1 Code Overview Michigan EECS 367 Introduction to Autonomous Robotics | ROB 511 Robot Operating Systems | Fall 2020

Transcript of EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next...

Page 1: EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next Wednesday, September 18 • Quiz 1 during regular lecture time and location • Assignment

EECS 367 LabAssignment 1 Code Overview

Michigan EECS 367 Introduction to Autonomous Robotics | ROB 511 Robot Operating Systems | Fall 2020

Page 2: EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next Wednesday, September 18 • Quiz 1 during regular lecture time and location • Assignment

AdministrativeNext Wednesday, September 16:

Quiz 1 held on Gradescope between 12:00am-11:59pm• 60 minute time limit• You can start anytime on September 16 but should finish within one hour• Answers can be updated many times during the quiz• Please don't communicate with classmates in any form during the quiz; it’s against the course honor code• Grades will be published soon after the quiz deadline

Assignment 1 due at 11:59pm via your Git repo

Make sure your Git repo is set up correctly! Can you…Pull update from upstream master?Pull grading from origin master?

Page 3: EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next Wednesday, September 18 • Quiz 1 during regular lecture time and location • Assignment

Lab Takeaways1. Stencil overview

2. Walk through heap insert function

3. Validate implementation

4. Search canvas introduction

5. Data structure considerations

Page 4: EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next Wednesday, September 18 • Quiz 1 during regular lecture time and location • Assignment

Assignment 1 Overview

Points Section Feature

4 All Heap implementation

8 All A-star search

2 Grad BFS

2 Grad DFS

2 Grad Greedy best-first

Page 5: EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next Wednesday, September 18 • Quiz 1 during regular lecture time and location • Assignment

KinEval Stencil

Bulk of the code needed to complete

Assignment 1

Starter code for Javascript intro and

heap debugging

Page 6: EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next Wednesday, September 18 • Quiz 1 during regular lecture time and location • Assignment

Heapsort Tutorial

Page 7: EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next Wednesday, September 18 • Quiz 1 during regular lecture time and location • Assignment

Heapsort Tutorial HTML

heapsort.html

Specifies JavaScript source file to make available in HTML.

Uncomment this line!

Page 8: EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next Wednesday, September 18 • Quiz 1 during regular lecture time and location • Assignment

Heapsort Tutorial HTML

heapsort.html

Represent heap as a JavaScript array

Repeatedly call heap insert method

Print state of heap to screen

Page 9: EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next Wednesday, September 18 • Quiz 1 during regular lecture time and location • Assignment

Heapsort Tutorial Results

Without heap.js implementation With heap.js implementation

Page 10: EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next Wednesday, September 18 • Quiz 1 during regular lecture time and location • Assignment

Heapsort Tutorial JavaScript

heap.js

Page 11: EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next Wednesday, September 18 • Quiz 1 during regular lecture time and location • Assignment

Heap Insert1. Add new element into first open

spot in tree (end of heap)

11

5

3

4

8

2

Page 12: EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next Wednesday, September 18 • Quiz 1 during regular lecture time and location • Assignment

Heap Insert1. Add new element into first open

spot in tree (end of heap)

2. If new element is smaller than parent, swap with parent

11

5

3

4

2

8

Page 13: EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next Wednesday, September 18 • Quiz 1 during regular lecture time and location • Assignment

Heap Insert1. Add new element into first open

spot in tree (end of heap)

2. If new element is smaller than parent, swap with parent

3. Repeat step 2 until heap property holds

11

5

2

4

3

8

Heap property: For min heaps, the value of the parent node must always be less than or equal to the value of

the child node

Page 14: EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next Wednesday, September 18 • Quiz 1 during regular lecture time and location • Assignment

Heap Insert

11

5

3

4

8

2

11

5

3

4

2

8

11

5

2

4

3

8

1. Add

2. Swap

3. Repeat swap

Page 15: EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next Wednesday, September 18 • Quiz 1 during regular lecture time and location • Assignment

Heap Insert

11

5

3

4

8

2

11

5

3

4

2

8

11

5

2

4

3

8

1. Add

2. Swap

3. Repeat swap

Page 16: EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next Wednesday, September 18 • Quiz 1 during regular lecture time and location • Assignment

Heap Insert

11

5

3

4

8

2

11

5

3

4

2

8

11

5

2

4

3

8

1. Add

2. Swap

3. Repeat swap

Page 17: EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next Wednesday, September 18 • Quiz 1 during regular lecture time and location • Assignment

Heap Insert

11

5

3

4

8

2

11

5

3

4

2

8

11

5

2

4

3

8

1. Add

2. Swap

3. Repeat swap

Page 18: EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next Wednesday, September 18 • Quiz 1 during regular lecture time and location • Assignment

Heap Insert

11

5

3

4

8

2

11

5

3

4

2

8

11

5

2

4

3

8

1. Add

2. Swap

3. Repeat swap

Page 19: EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next Wednesday, September 18 • Quiz 1 during regular lecture time and location • Assignment

Heap Insert

11

5

3

4

8

2

11

5

3

4

2

8

11

5

2

4

3

8

1. Add

2. Swap

3. Repeat swap

Page 20: EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next Wednesday, September 18 • Quiz 1 during regular lecture time and location • Assignment

Heap Insert

11

5

3

4

8

2

11

5

3

4

2

8

11

5

2

4

3

8

1. Add

2. Swap

3. Repeat swap

Page 21: EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next Wednesday, September 18 • Quiz 1 during regular lecture time and location • Assignment

Heap Insert

11

5

3

4

8

2

11

5

3

4

2

8

11

5

2

4

3

8

1. Add

2. Swap

3. Repeat swap

Page 22: EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next Wednesday, September 18 • Quiz 1 during regular lecture time and location • Assignment

Heap Insert

11

5

3

4

8

2

11

5

3

4

2

8

11

5

2

4

3

8

1. Add

2. Swap

3. Repeat swap

Page 23: EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next Wednesday, September 18 • Quiz 1 during regular lecture time and location • Assignment

Heap Insert Result

Page 24: EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next Wednesday, September 18 • Quiz 1 during regular lecture time and location • Assignment

Lab Takeaways1. Stencil overview

2. Walk through heap insert function

3. Validate implementation

4. Search canvas introduction

5. Data structure considerations

Page 25: EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next Wednesday, September 18 • Quiz 1 during regular lecture time and location • Assignment

Steps 1-3 Breakout Rooms

Page 26: EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next Wednesday, September 18 • Quiz 1 during regular lecture time and location • Assignment

Search Canvas Infrastructure

infrastructure.jsIn the initSearch()

function, which instantiates global variables and starts

your algorithms

q_start_config = q_init

start location in world

q_goal_config = q_goal

goal location in world

q_init and q_goalcan be specified in URL

Page 27: EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next Wednesday, September 18 • Quiz 1 during regular lecture time and location • Assignment

Search Canvas

Open search_canvas.html in your browser

Available URL parameters described in search_canvas.html file

World coordinates go from (-2, -2) to (7, 7)

Page 28: EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next Wednesday, September 18 • Quiz 1 during regular lecture time and location • Assignment

Search Canvas

Open search_canvas.html in your browser

Available URL parameters described in search_canvas.html file

World coordinates go from (-2, -2) to (7, 7)

World coordinates = (-2, -2)Canvas coordinates = (0, 0)

World coordinates = (7, 7)Canvas coordinates = (800, 800)

Default q_init = (0, 0)

Default q_goal = (4, 4)

Page 29: EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next Wednesday, September 18 • Quiz 1 during regular lecture time and location • Assignment

Search Graph

World coordinates = (-2, -2)Canvas coordinates = (0, 0)

World coordinates = (7, 7)Canvas coordinates = (800, 800)

G: search graph

Page 30: EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next Wednesday, September 18 • Quiz 1 during regular lecture time and location • Assignment

G: search graph

G[i][j]: search graph cell is a JavaScript object

.x and .y specify cell center in world coordinates.distance specifies path length to start through .parent nodeCell height and width = eps

eps

eps

i

j

(G[i][j].x, G[i][j].y)

Search Graph

Page 31: EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next Wednesday, September 18 • Quiz 1 during regular lecture time and location • Assignment

Collisions Test configuration at visited cellcenter for collision:

testCollision([G[i][j].x,G[i][j].y])

Page 32: EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next Wednesday, September 18 • Quiz 1 during regular lecture time and location • Assignment

Graph Search Initializationgraph_search.js

Important to identify discrete start indices

within graph from continuous world

position

Page 33: EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next Wednesday, September 18 • Quiz 1 during regular lecture time and location • Assignment

Graph Search Iteration

draw.jsIn animate() function, which is responsible for

calling your iterate functions

Page 34: EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next Wednesday, September 18 • Quiz 1 during regular lecture time and location • Assignment

Graph Search Iterationgraph_search.js

Ensure your implementations are isolated to single search steps!

Including excessive loops may cause browser to become unresponsive.

Once search has completed, turn off iteration: search_iterate = false;

Page 35: EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next Wednesday, September 18 • Quiz 1 during regular lecture time and location • Assignment

Lab Takeaways1. Stencil overview

2. Walk through heap insert function

3. Validate implementation

4. Search canvas introduction

5. Data structure considerations

Page 36: EECS 367 Lab: Assignment 1 Code Overview - AutoRob · 2020-01-02 · Administrative • Next Wednesday, September 18 • Quiz 1 during regular lecture time and location • Assignment

Steps 4-5 Breakout Rooms