Quick viewing(Text Mode)

Download Presentation

Download Presentation

Robots for the Kid in All of Us Nikhil J. Nanivadekar Robots for the Kid in All of Us

GS.com/Engineering Nikhil J. Nanivadekar

Copyright © 2017 Goldman Sachs. All rights reserved. INTRODUCTION

3

Introduction Agenda AGENDA

5

Demos Dijkstra’sAlgorithm on EV3 JREvs Compact Profiles Dijkstra’s A*and at a glance Java vs EV3 Programmer App LiveProgramming Demo Robot video Robot

• •

• Agenda Robot Video ROBOT VIDEO

7

https://youtu.be/EXdtbkYDRgI Robot Video AGENDA

8

Demos Dijkstra’sAlgorithm on EV3 JREvs Compact Profiles Dijkstra’s A*and Algorithm at a glance Java vs EV3 vs Java Programmer App LiveProgramming Demo Robotvideo

• •

• Agenda Java vs EV3 Programmer App EV3 PROGRAMMER APP 10

Availableat Mindstorms website interface Legos Visual graphical and programming EV3 ProgrammerAppdistributed by

• •

• EV3 Programmer App LEJOS 11

open source Bettermotor control,faster processing, project Doesnot run Lego software Write codesimilar toa standardJava Runsstandard

• •

• Lejos THIRD PARTY LIBRARIES

12 is a JavaVirtual Machine

Run similarRun to a standardJavaproject classpath Easyintegration with third partylibraries Upload jarsto EV3on and reference Lejos

• •

• Third Party Libraries AGENDA 13

Demos Dijkstra’sAlgorithm on EV3 JREvs Compact Profiles Dijkstra’s A*and Algorithm at a glance Java vs EV3 Programmer App Demo Programming Live Robotvideo

• •

• Agenda Live Programming Demo AGENDA 15

Demos JREvs Compact Profiles glance Dijkstra’sAlgorithm on EV3 Dijkstra’s and A* Algorithm at a a at A* and Algorithm Dijkstra’s Java vs EV3 Programmer App LiveProgramming Demo Robotvideo

• •

• Agenda Dijkstra’s and A* Algorithm at a glance DIJKSTRA’S ALGORITHM 17

W. Dijkstra

Edsger

Conceived by Leastcost path can be a longer path nodes Each node hascost for traversal Findleast the costpathsource fromto all

• •

• Dijkstra’s Algorithm DIJKSTRA’S ALGORITHM 18

Wikipedia(Dijkstra’s Algorithm) Wikipedia(Dijkstra’s Source:

Dijkstra’s Algorithm A* ALGORITHM 19

towards the goal Heuristic can be anything Add a heuristicto guide the program (distance, time, etc.) Extension to Dijkstra’s Algorithm

• •

• A* Algorithm ALGORITHM FUNCTIONS

20 on

h: heuristic functi

f(n) = (n) + h(n) + c(n) = f(n) f(n) = c(n) = f(n)

c: cost function A* Dijkstra – –

• •

Algorithm Functions AGENDA 21

Demos Dijkstra’s Algorithm on EV3 on Algorithm Dijkstra’s JREvs Compact Profiles Dijkstra’s A*and Algorithm at a glance Java vs EV3 Programmer App LiveProgramming Demo Robotvideo

• •

• Agenda Dijkstra’s Algorithm on EV3 PROBLEM STATEMENT 23

absolutedistance absolutedistance Motion in ydirection costs2xthe Motion in xdirection costs1xthe Solve themaze

• •

• Problem Statement

PROBLEM STATEMENT 24 Problem Statement GRAPH 25

-ordinates

nodes Useadjacency matrix, color datato get Forms an adjacency matrix of Red:Traversable Blue: Obstacle y co x, UseRGB data of maze

• •

• Graph GRAPH

= = 26 );

1

), ),

GRAPH 0

> > <>(); Map Point < HashMap 0, Point( Map

Int Int Object (newput new

. GRAPH // Red = 256, Blue = 1 = Blue = 256, Red // MutableObject MutableObjectInt Storenode, color data in a

• Graph SUCCESSORS

27 4);

{

1)

) > {

> successors = ) > 1) .withInitialCapacity( negativeX (point .get( .get successors.add(negativeX ); GRAPH

Sets.mutable

GRAPH ... return successors; } MutableSet

}

if(

Successors COST FUNCTION 28

()); .getY .getX()); (

abs point2 point2 .abs( getCost( yCost;

* Math. () – () – + , ) { Math 2 = = .getY .getX xCost point1 point2 yCost xCost

point1 point1

return int Point Point int

public static int

Cost FunctionCost } PRIORITIZATION 29

minBy( )); .get(each . getNodeToVisit(

Point> verticesToSearch ) { > vertexCostMap verticesToSearch point,

each -

return Point SetIterable<

}

public static Point

Prioritization PRIORITIZATION 30

MAX_VALUE . Each timenode isvisited; update withleast cost visit to Map ofnode tocost tovisit Initialized with allnode costs tobe Integer

– – –

vertexCostMap: Prioritization PATH

31

{

; (path.peek()));

.get

; = true > path = .empty();

(

isPathComplete) { isPathComplete = false nodeBackpointerMap start (!

isPathComplete path.push else

} } if ( Stacks

Path

while

return path; }

boolean

MutableStack

PATH: DIJKSTRA’S

32

Path: Dijkstra’s PATH: A* | 2 point y

33 endpoint |y

+ | 2 point x

endpoint |x

=

Heuristic

Path: A* PATH: A* | 2 point x

34 endpoint |y

+ | 2 point x

endpoint |x

=

Heuristic

Path: A* MOTION UNINTERRUPTED 35

times Howto makerobot move smoothly? Robotmoves to node node, pausing225 Path comprisedof226 nodes

• •

• Motion Uninterrupted MOTION UNINTERRUPTED 36 node hasthe

next

Different heading: Compute the angle the robot needs to turn Same heading: Mark it to be flattenedSamebe heading: to Markit

– – Hence,achieving motion uninterrupted peekingin thefuture Checkif the next Flattenthe pathmotion during by sameheading

• •

• Motion Uninterrupted AGENDA 37

Demos Dijkstra’sAlgorithm on EV3 Profiles Compact JRE vs Dijkstra’s A*and Algorithm at a glance Java vs EV3 Programmer App LiveProgramming Demo Robotvideo

• •

• Agenda Performance of JRE vs Compact Profiles JRE VS COMPACT PROFILES 39

Compact Profiles Overview Source:

Stripped downversion of JRE into subsets

• JRE vs Compact Profiles PERFORMANCE COMPARISON

54 80 15 22

115 40 Full JRE (Times) in

49 80 13 22 110

Compact2 (Times) in Compact Profiles Overview up - Source:

Task

up -

A* algorithm EV3 start start Program initialization Graph algorithm Dijkstra’s Performance Comparison Performance EMPIRICAL OBSERVATIONS 41

What aboutthe memoryfootprint? Is the performance consistent? Whatthe jar about sizes? Doesit stopmid -execution?

• •

• Empirical Observations AGENDA 42

Demos Dijkstra’sAlgorithm on EV3 JREvs Compact Profiles Dijkstra’s A*and Algorithm at a glance Java vs EV3 Programmer App LiveProgramming Demo Robotvideo

• •

• Agenda Demos Learn more at GS.com/Engineering

© 2017 Goldman Sachs. This presentation should not be relied upon or considered investment advice. Goldman Sachs does not warrant or guarantee to anyone the accuracy, completeness or efficacy of this presentation, and recipients should not rely on it except at their own risk. This presentation may not be forwarded or disclosed except with this disclaimer intact. www.modsummit.com

www.developersummit.com