robot lab spring 2009 lecture #1 william regli (guest lecture: mr. evan sultanik) department of...

116
ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University http://gicl.cs.drexel.edu

Upload: douglas-townsend

Post on 01-Jan-2016

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

ROBOT LABSPRING 2009

Lecture #1

William Regli(Guest Lecture: Mr. Evan Sultanik)

Department of Computer Science

Drexel Universityhttp://gicl.cs.drexel.edu

Page 2: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Course History

• Previous versions of this course– Used Lego Robots

• Lots of time spent building/debugging robots

– Used Roombas• Lots of time trying to deal with a sensor-deprived

robot platform

– Designed and Modeled Bio-Inspired Robots• Interesting mechanisms, but little in the way of

intelligent robot behavior

Page 3: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

2009 Course Overview

• Our focus this time: Design, analysis and implementation of multi-robot systems in simulation – Robotic systems will be “virtual” and interact

in a synthetic environment

• Weekly programming assignments in Player / Stage / Gazebo environment

Page 4: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Topics to be Covered

• Introduction to Robotics• Basic Kinematics, Dynamics• Robot control• Robot modeling & simulation• Path planning• Simultaneous Location & Mapping (SLAM)• Robot Teaming and Planning

– Flocks, swarms, leader-follower, predator-prey, etc

• Human-Robot Teaming

This is not final, order and content will change

Page 5: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Grading Policies• This course is 100% robot simulation programming

– You will need to expend effort to learn new tools and integrate them to do the assignments. Tools will be introduced in class, but it is assumed students can teach themselves these computing tools and make use of them. It is assumed students have advanced programming and systems skills.

• Assignments are due starting in Week #3– Must turn in (a) code; (b) video/movie/bitmap of results; (c) 1-to-n page “lab report” analyzing the results– IT IS ASSUMED ALL WORK TURNED IN IS DONE INDIVIDUALLY. Code will be checked for plagiarism.

Course ethics will be taken very seriously.• Assignments will be rated relative to each other and with respect to the portion of the assignment

completed– A == all of the work done and nearly all correct, well written report, correct grammar, excellent formatting,

LaTeX, insightful content, among the best in the class– B == most of the work done and nearly all correct, a report that documents the work, perhaps with some

insight– C == work not complete or not correct, report that reads like a grade school book report, etc– D,F == lets not go here, shall we?

• Final grades will be computed as a weighted average of the report grades, larger reports and those toward the end of the class will get more weight

• Graduate students are expected to perform minimally at the “B” level and show exceptional creativity and insight, going beyond the letter of the assignment and demonstrating mastery

• Please see “ways to fail this class” section of the website. Applies to all.

Page 6: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Course Mechanics

• Teaching Assistants– Mr. Marc Winners– Mr. Chris Cannon

• Course Wiki

• Play/Stage/Gazebo server will be set up for “teaming”

• Students interested in “extra credit” assignments should talk with the instructor

Page 7: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Brief Introduction to Robotics

Page 8: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

“LIFE! DO YOU HEAR ME? GIVE MY CREATION... LIFE!

-- Dr. Frederick Frankensteinfrom Young Frankenstein

Page 9: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

What is a robot?"I can't define a robot, but I know one when I see one."

-Joseph Engelberger

A robot is a machine built for real-world functions that is computer-controlled…

…maybe.

Right: Roomba microprocessor(from HowStuffWorks)

Page 10: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Who’s to say?

• Many devices with varying degrees of autonomy are called robots.

• Many different definitions for robots exist.

• Some consider machines wholly controlled by an operator to be robots.

• Others require a machine be easily reprogrammable.

Page 11: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Japan?1

• Manual-Handling Device: controlled by operator• Fixed-Sequence Robot: mechanical action

sequence• Variable-Sequence Robot: as 2 but modifiable• Playback Robot: imitates human actions• Numerical Control Robot: run by movement

program• Intelligent Robot: reactive to environment1: Japanese Industrial Robot Association

Page 12: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

America and Europe?

• “a programmable, multifunction manipulator…”

-RIA2

• “an independently acting and self controlling machine…”

-ECM3

2: Robotics Institute of America3: European Common Market

Page 13: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Highlights from the History of Robotics Fiction:

– Jewish folklore, a golem ( גולם ) is an animated being created from inanimate matter.

– “Robot”, from the Czech/Slovak word robota, labor or work.

– The word robot first appeared in Karel Čapek's science fiction play R.U.R. (Rossum's Universal Robots) in 1921.

– Fritz Lang’s Metropolis (1926)– Word was brought into use by Isaac

Asimov.– Patron Saint: the HAL 9000

Non-Fiction– Tesla’s remote

controlled boat– SRI’s Shakey– NASA

• Voyager• Pathfinder• Spirit/Opportunity

– Sony Aibo– Honda ASIMO– DARPA Grand Challenge

http://robotics.megagiant.com/history.htmlhttp://en.wikipedia.org/wiki/Robotics

Page 14: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Robot Ethics

0th) A robot may not harm humanity, or, by inaction, allow humanity to come to harm.

1st) A robot may not injure a human being or, through inaction, allow a human being to come to harm.

2nd) A robot must obey orders given it by human beings except where such orders would conflict with the First Law.

3rd) A robot must protect its own existence as long as such protection does not conflict with the First or Second Law.

Asimov’s Three^H^H^H^H^H Four Laws:

(Image from http://www.bmc.riken.jp/%7ERI-MAN/index_jp.html)

Page 15: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

The Future for Robotics

• Existing Applications– Exploration

• Space, undersea

– Haz-Mat Duties• Disaster recovery,

inspection• Nuclear waste

management

– Manufacturing• Mining, assembly, welding

– Military• Unmanned Ground, Aerial,

Sea, Undersea Vehicles

• Emerging Applications– Aging Societies

• Over the last century, the age distribution of the U.S. population changed from relatively young to relatively old.

– Medical• Surgical robotics• Tele-medicine• Prosthetics

– Consumer• Electronics, automotive,

entertainment, toys, games

Page 16: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Sprawl robot: SprawlitaMulti-University Research InitiativePI: Mark R. Cutkosky (Stanford University)

JPL Serpentine Robot

Tuna robot: VCUUVDraper Laboratory, Cambridge, MA

Page 17: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Robot Classes

• Manipulators: robotic arms. These are most commonly found in industrial settings.

• Mobile Robots: unmanned vehicles capable of locomotion.

• Hybrid Robots: mobile robots

with manipulators.

(Images from AAAI and HowStuffWorks, respectively)

Page 18: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Robot Components

• Body

• Effectors

• Actuators

• Sensors

• Controller

• Software

Page 19: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Robot::Body

• Typically defined as a graph of links and joints:

A link is a part, a shape with physical properties.

A joint is a constraint on the spatial relations of two or more links.

Page 20: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Types of Joints

Respectively, a ball joint, which allows rotation around x, y, and z, a hinge joint, which allows rotation around z, and a slider joint, which allows translation along x.

These are just a few examples…

Page 21: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Degrees of Freedom

• Joints constraint free movement, measured in “Degrees of Freedom” (DOFs).

• Links start with 6 DOFs, translations and rotations around three axes.

• Joints reduce the number of DOFs by constraining some translations or rotations.

• Robots classified by total number of DOFs

Page 22: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

6-DOFs Robot Arm

How many DOFs can you identify in your arm?

Page 23: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Robot::Effectors

• Component to accomplish some desired physical function

• Examples: – Hands– Torch– Wheels– Legs– Trumpet?

(Image from http://www.toyota.co.jp/en/special/robot/)

Page 24: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Roomba Effectors

• What are the effectors of a Roomba?

Page 25: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Roomba Effectors

• What are the effectors of the Roomba?

Vacuum, brushes, wheels

Page 26: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Robot::Actuators

• Actuators are the “muscles” of the robot.

• These can be electric motors, hydraulic systems, pneumatic systems, or any other system that can apply forces to the system.

Page 27: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Roomba Actuators

• The Roomba has five actuators, all electric motors:– Two drive wheels – One drives the vacuum – One drives the spinning side brush – One drives the agitator (spinning brush

underneath)

Page 28: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Example Effector:Differential Steering

• The Roomba uses a differential steering system to turn and move forward. Each wheel is controlled by a distinct motor. Here, the Roomba rotates and moves forward.

VR(t)

VL (t) x

y

Page 29: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Differential Steering

• The Roomba uses a differential steering system to turn and move forward. Each wheel is controlled by a distinct motor. Here, the Roomba rotates and moves forward.

VR(t)

x

y

VL (t)

Page 30: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Differential Steering

• The Roomba uses a differential steering system to turn and move forward. Each wheel is controlled by a distinct motor. Here, the Roomba rotates and moves forward.

VR(t)

VL (t) x

y

VR(t)

x

y

Page 31: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Differential Steering!

• The Roomba uses a differential steering system to turn and move forward. Each wheel is controlled by a distinct motor. Here, the Roomba rotates and moves forward.

VR(t)

VL (t) x

y

Page 32: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Robot::Sensors

• Allow for perception.

• Sensors can be active or passive:

• Active – derive information from environment’s reaction to robot’s actions, e.g. bumpers and sonar.

• Passive – observers only, e.g. cameras and microphones .

Page 33: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Sensor Classes

• Range finders: these sensors are used to determine distances from other objects, e.g. bumpers, sonar, lasers, whiskers, and GPS.

Page 34: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Sensor Classes

• Imaging sensors: these create a visual representation of the world

• Here, a stereo vision system creates a depth map for a Grand Challenge competitor.

From NOVA, www.pbs.org

Page 35: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Sensor Classes

• Proprioceptive sensors: these provide information on the robot’s internal state, e.g. the position of its joints.

Shaft decoderscount revolutions,allowing for

configurationdata ond odometry.

Page 36: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Odometry

• Odometry is the estimation of distance and direction from a previously visited location using the number of revolutions made by the wheels of a vehicle.

• Odometry can be considered a form of “Dead Reckoning*,” a more general position estimation based on time, speed, and heading from a known position.

*The Oxford English Dictionary does not recognize “deductive reasoning” as the basis of “dead reckoning”

Page 37: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Odometry

• Odometry is good for short term, relative position estimation.

• However, uncertainty grows, shown by error ellipses, without bound.

• This is due to systematic and non-systematic errors.

Page 38: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Odometry, Non-systematic Errors

• These errors can rarely be measured and incorporated into the model.

• Error causes include uneven friction, wheel slippage, bumps, and uneven floors.

Page 39: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Odometry, Systematic Errors

• Errors arising from general differences in model and robot behavior that can be measured and accounted for in the model, a process known as calibration.

• Two primary sources:– Unequal wheel diameters – lead to curved

trajectory– Uncertainty about wheel base – lead to errors

in turn angle

Page 40: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Odometry, Position Updates

• With calibration, model behavior becomes more similar to observed behavior. However, estimation uncertainty still grows without bound.

• Position updates reduce uncertainty.

Page 41: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Basic Engineering for CS Students

• Statics: The branch of physics concerned with the analysis of loads (force, moment, torque) on a physical systems in static equilibrium, that is, in a state where the relative positions of subsystems do not vary over time, or where components and structures are at rest under the action of external forces of equilibrium.

• Kinematics: The branch of mechanics (physics) concerned with the motions of objects without being concerned with the forces that cause the motion. – Inverse Kinematics: The process of determining the parameters of a

jointed flexible object in order to achieve a desired pose.

• Dynamics: The branch of classical mechanics (physics) concerned with the effects of forces on the motion of objects.

Page 42: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Kinematics

• The calculation of position via odometry is an example of kinematics

• Kinematics is the study of motion without regard for the forces that cause it

• It refers to all time-based and geometrical properties of motion

• It ignores concepts such as torque, force, mass, energy, and inertia

Page 43: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Forward Kinematics

• Given the starting configuration of the mechanism and joint angles, compute the new configuration

• For a mechanism robot,this would mean calculating the position and orientation of the end effector given all

the joint variables

Page 44: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Kinematics of Differential Steering

Derivation:

This is the turn radius for a circular trajectory:

X component of speed

Y component of speed

Speed is average of vr & vl

Arc change over radius

Integrate all:

Page 45: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Kinematics of Differential Steering

• The above model has an asymptote when

• When this occurs, special handling is required.

• Or a simpler model can be used:

Here, SR and SL are measured right and left velocities. This approximates movement as a “point-and-shoot.”

Page 46: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Kinematics of Differential Steering

• Simpler approximations are often used when onboard computing power is lacking (or programmers are lazy!).

• However, the error grows quicker.

• A slightly better approximation:

Page 47: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Robot::Controller

• Controllers direct a robot how to move.

• There are two controller paradigms– Open-loop controllers

execute robot movement without feedback.

– Closed-loop controllers execute robot movement and judge progress withsensors. They can thus compensate for errors.

Page 48: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Controller, Open-loop

• Goal: Drive parallel to the wall.

• Feedback: None.• Result: Noisy

movement, due to slippage, model inaccuracy, bumps, etcetera, is likely to cause the robot to veer off the path.

Page 49: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Controller, Closed-loop

• Goal: walk parallel to the wall.

• Feedback: a proximity sensor

• Result: the robot will still veer away or toward the wall, but now it can compensate.

Page 50: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Trajectory Error Compensation(proportional-integral-derivative controllers)

• If a robot is attempting to follow a path, it will typically veer off eventually. Controllers design to correct this error typically come in three types:– P controllers provide force in negative proportion to

measured error.– PD controllers are P controllers that also add force

proportional to the first derivative of measured error.– PID controllers are PD controllers that also add force

proportional to the integral of measured error.

Page 51: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Roomba Control

• The movement of the Roomba can be hard-coded ahead of time as an example of open-loop control.

• A path can be converted to Roomba wheel movement commands via inverse kinematics.

Page 52: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Inverse Kinematics

• Inverse Kinematics is the reverse of Forward Kinematics. (!)

• It is the calculation of joint values given the positions, orientations, and geometries of mechanism’s parts.

• It is useful for planning how to move a robot in a certain way.

Page 53: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Kinematics-1 of Differential Steering

• Vehicles using differential steering will go in a straight line if both wheels receive the same power.

• If both wheels turn at constant, but different, speeds, the vehicle follows a circular path

• Distances traveled:

Page 54: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Kinematics-1 of Differential Steering

• This calculation ignores acceleration, but it can be used to calculate how to move a device using a differential steering system, such as a Roomba, along a path that consists of lines and arcs.

Page 55: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Potential Field Control

• Potential field control is similar to the hill-climbing algorithm.

• Given a goal position in a space, create an impulse to go from any position in the space toward the goal position.

• Add Repulsive forces wherever there are obstacles to be avoided.

• This does not require path planning.

Page 56: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Potential Field Soccer

• 1 moves toward the blue goal.

• 1 avoids 7, 6, and 8.

• Teammatesgenerate attractivefields.

(image from http://www.itee.uq.edu.au/~dball/roboroos/about_robots.html)

Page 57: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Reactive Control

• Given some sensor reading, take some action.

• This is the robotics version of a reflex agent design.

• It requires no model of the robot or the environment.

• Maze exiting:– Keep Moving forward.

• If bump, turn right.

Page 58: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Robot::Software Architecture

• Previous control methods include deliberative methods and reactive methods.– Deliberative methods are model-driven and involve

planning before acting.– Reactive methods is sensor-driven and behavior must

emerge from interaction.

• Hybrid architectures are software architectures combining deliberative and reactive controllers.– An example is path-planning and PD control.

Page 59: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Three-Layer Architecture

• The most popular hybrid software architecture is the three-layer architecture:– Reactive layer – low-level control, tight sensor-action

loop, decisions cycles (DCs) order of milliseconds.– Executive layer – directives from deliberative layer

sequenced for reactive layer, representing sensor information, localization, mapping, DCs order of seconds.

– Deliberative layer – generates global solutions to complex tasks, path planning, model-based planning, analyze sensor data represented by executive layer, DCs order of minutes.

Page 60: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

END

Page 61: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

The Roomba Module

William RegliDepartment of Computer Science

(and Departments of ECE and MEM)Drexel University

Page 62: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

The Roomba Module “Curiosity, earnest research to learn the hidden laws of nature, gladness akin to rapture,

as they were unfolded to me, are among the earliest sensations I can remember.”– Frankenstein, Mary Shelly

• The Two Main Objectives for the Module are…– To explore the interaction between software & information and the physical world

by animating, via software, a robotic “creature”…– To use cyber-infrastructure to obtain and share the information needed to execute

the module

You

YourRoomba

Page 63: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Introducing the Roomba

• Introduced in 2002 by iRobot– Company founded by MIT AI legend

Rodney Brooks

• Roombas manufactured after October 2005 contain an electronic and software interface that allows you to control or modify Roomba's behavior and remotely monitor its sensors– The iRobot Roomba Open Interface is

intended for software programmers and roboticists to create their own enhancements to Roomba.

– “Roombatics”: the general science of modifying or programming your Roomba

Page 64: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Tour of the Roomba

Page 65: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Tour of the Roomba

Page 66: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Tour of the Roomba: The Vitals

• Roomba Serial Port• MiniDIN male-male

cable• USB adapter

Page 67: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Tour of the Roomba: The Vitals

• IR Wall Sensors

– You may want to use these to implement wall following behavior

Page 68: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

The Roomba Challenges

1. The Chutes

2. The Maze

3. The Great Escape

4. Name that Tune

NIST Rescue Robot LeagueMaze (2004)

Page 69: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Roomba Challenge #1:The Chutes

“The legal and philosophic aspects of obedience are of enormous importance.”

--- "The Perils of Obedience”, Stanley Milgram

• Problem: Given a detailed and exact layout of the world, with single exit path and no possible wrong turns or shortcuts, implement a set of instructions (i.e. a path) for the Roomba so it can navigate the start to the finish

• Objective: minimize time, minimize distance to finish line

Page 70: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Roomba Challenge #1:The Chutes Example

ST

AR

T

FIN

ISH

10m.

3m.

1m

.

3m

6.0508m1m

.

3m

3m

.

3m.

1m.

1.5

m

Page 71: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Roomba Challenge #1:Implementation Challenges

• Getting Roomba/computer set up working• The path/world is explicit; you are doing manual path

planning with complete information---how will you get the robot to follow the path you select?

• Could solve this without the use of sensors by– Dead reckoning– Hard coding (bump-turn-bump-turn etc)

• Error will be introduced by the movement of the vehicle, friction, uncertainty in orientation and initial set up

Page 72: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Roomba Challenge #2:The Maze

"You are in a maze of twisty little passages, all alike“--Colossal Cave Adventure Game, 1976

• Problem: – The night before the competition, we will release the

dimensions/configuration for a different maze of chutes– The Roomba is placed in a maze in a pre-determined starting

location; there will be only one path out, but there may be dead-ends and detours

– Your job: implement an algorithm to find a path out of the maze• Modify existing code for pre-set maze that night OR• Write code for general maze solving

• Objective: minimize time and minimize distance within the maze to the finish line

Page 73: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Roomba Challenge #2:The Maze Example

ST

AR

T

FIN

ISH

How to find the

shortcut?

Page 74: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Roomba Challenge #2:Implementation Challenges

• You need to use the Roomba sensors– Develop a different strategy because robots may

encounter dead-ends, non-right-angled walls, etc– There may be short cuts that are hard to ‘sense’

• Might not be able to get out without some additional info from sensors or a combination of sensing and hard-coding

• Should be able to get most of the way with hard-coding and dead reckoning

Page 75: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Roomba Challenge #3:The Great Escape

"I'm making this up as I go.“--Indiana Jones, 1936.

• Problem: – The Roomba is placed in an arbitrary maze in an arbitrary

starting location; there will be only one path out, but there may be dead-ends and detours; the maze may be reconfigured between trials

– Your job: implement an algorithm to find a path out of the arbitrary maze

• You will not have time to modify existing code, you’ll need to write code for general maze solving and test it

• Objective: simply exit the maze

Page 76: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Roomba Challenge #3:Escape Example

ST

AR

T

FIN

ISH

x

Page 77: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Roomba Challenge #3:Implementation Challenges

• This is a tricky assignment– We will not give you the maze; maze config may

change between trials; starting point may change

• You need to implement some kind of maze exit strategy– This will take some work…

• You will not be able to hard-code• Mazes will change

– Hence, cannot change code during the day

Page 78: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Roomba Challenge #4:Map the Maze

"You are in a maze of twisty little passages, all alike“--Colossal Cave Adventure Game, 1976

• Your robot will be placed in a synthetic environment and you will need to build a map of the walls and obstacles

Page 79: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

OK, Great, so we get to program robots to exit mazes… where is the Science and Engineering?

Page 80: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Roomba Challenges #3 & #4:General Maze Solving Algorithms

http://en.wikipedia.org/wiki/Maze#Solving_mazes• Wall Follower• Pledge algorithm• Random mouse• Tremaux's algorithm

Page 81: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Roomba Challenges #3 & #4:General Maze Solving Algorithms

http://en.wikipedia.org/wiki/Maze#Solving_mazes• Wall Follower (a.k.a. Depth First Search)• Pledge algorithm• Random mouse• Tremaux's algorithm

Page 82: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Graph Theory

• History– Leonhard Euler and the

Seven Bridges of Königsberg (1736)

• Problem areas– Subgraphs– Graph Coloring– Network Routing– Network Flow– Visibility– Covering, Embedding The Bridges of Königsberg

Page 83: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Graph Theory Today

• Graphs are everywhere!• Examples:

– Google’s PageRank algorithm was developed by Page and Brin in an undergrad CS class

– Network communications is about least-cost paths

– Logistics plans for WalMart, FedEx, UPS rely on route planning and map data

– Recommender systems, social networks, etc … all graphs!

– Molecular modeling, computational pharmacology, protein folding all use graphs as their basic data structure

Page 84: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

An example

Page 85: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Graph Theory and Mazes: A Change of the Representation

• The physical topology of the maze can mapped into a Graph

• A Graph G can be represented as an ordered pair of setsG = <V, E> where V is the set of vertices and E is the set of edges

• Note that each edge is really a pair as well– i.e. ei = <vk, vj > means that there is an edge between

vertices vk and vj

Page 86: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University
Page 87: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University
Page 88: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University
Page 89: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

The Basic DFS Algorithm

dfs( v ) process( v ) /* do what needs to get done*/mark v as visitedfor all vertices i adjacent to v not visited

dfs( i )

• Typical application questions– How to traverse the successor vertices?– How to order/process vertices in your output

• Pre-order (Polish notation) … the above is pre-order.• Post-order (reverse Polish notation)

Page 90: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Depth First Search

Page 91: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Depth First Search

Page 92: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Depth First Search

Page 93: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Depth First Search

Page 94: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Depth First Search

Page 95: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Depth First Search

Page 96: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Depth First Search

Page 97: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Depth First Search

Page 98: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Depth First Search

Page 99: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Depth First Search

Page 100: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Depth First Search

Recurse back up the tree…

Page 101: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Depth First Search

Page 102: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Depth First Search

Page 103: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Depth First Search

Page 104: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Depth First Search

Page 105: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Depth First Search

Page 106: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University
Page 107: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Properties of DFS: Time

• DO NOT measure time with a clock!

• Doing DFS on a graph G with vertices v1, v2, … vn and edges e1, e2, … em

– What is the Time Complexity? (i.e. # of discrete computational steps)

• Best Case?• Worst Case?• Average Case?

Page 108: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Properties of DFS: Time

• Doing DFS on a graph G with vertices v1, v2, … vn and edges e1, e2, … em

– What is the Time Complexity? (i.e. # of computational steps)

• Best Case: you go right to the solution, no backtracking, and the solution is close by

– d steps, where d is the length (i.e. depth) of the shortest path to the soln from the start state

• Worst Case?• Average Case?

Page 109: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Properties of DFS: Time

• Doing DFS on a graph G with vertices v1, v2, … vn and edges e1, e2, … em

– What is the Time Complexity? (i.e. # of computational steps)

• Best Case: d• Worst Case: check every node in the tree

– n steps

• Average Case?

Page 110: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Properties of DFS: Time

• Doing DFS on a graph G with vertices v1, v2, … vn and edges e1, e2, … em

– What is the Time Complexity? (i.e. # of computational steps)

• Best Case: d• Worst Case: n• Average Case: … depends on the structure of the “tree”….

Not answerable without more info.– Theoretically very difficult problem involving graph theory,

combinatorics and statistics

Page 111: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Properties of DFS: Space

• How much computer memory is needed?• Doing DFS on a graph G with vertices

v1, v2, … vn and edges e1, e2, … em

– What is the Space Complexity? (i.e. how many nodes in memory?)

• Need to store – All nodes on the longest path

– All nodes that “branch” from that path

• This is path-independent– Best Case Scenario and Worst Case Scenario are the same!

Page 112: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Properties of DFS: Space

• One needs Best Case Scenario and Worst Case Scenario are the same– Storage needs,

where d is the longest path and b is the “branching factor” (i.e. the maximum # of edges or degree for a vertex), are d·b

….

“width” of the tree is named b, for “branching factor” b

d

Page 113: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

From Mazes to SLAM and Path Planning

Where is all this going?• Mazes are a very rudimentary form of path

planning• Ultimately, our robots will need to perform

– “Simultaneous Location and Mapping” (SLAM)• Very complex fusion of different data sources from AI,

machine vision, statistics, control theory, etc

– Path Planning• Very algorithmically tricky, lots of ideas from computational

geometry, AI search, physics-based modeling, etc• Undecidable in the general case

Page 114: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Implementation Tools

Page 115: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Implementation Tools

• Player

• Stage

• Gazebo

Page 116: ROBOT LAB SPRING 2009 Lecture #1 William Regli (Guest Lecture: Mr. Evan Sultanik) Department of Computer Science Drexel University

Questions?

Unsuccessful Successful