Robot Lab - GICL Wiki

advertisement
Robot Lab
William Regli
Department of Computer Science
(and Departments of ECE and MEM)
Drexel University
Slide 1
Robot Lab
“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
You
Your
Roomba
• General objectives for this class…
– 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 class
Slide 2
Course Goals and Objectives
• Play with Roombas
• Introduction to basic problems in robotics
– Experience them 1st hand with Roombas
• Document experiences in GICL Wiki for
– Use by future generations of students
– Development of outreach materials (I.e. K-12)
– Development of demonstration materials
Slide 3
Topics to be covered in lectures
• Intro to Roomba
• Intro to Robotcs
– Basics of robotics systems, sensor, etc
– Basics of kinematics/dynamics
– Robot Motion Planning & Path Planning
• Intro to multi-agent (multi-robot) coordination
– Teamwork, distributed constraints, etc
Slide 4
Assignments
• This is a lab-intensive course, you’ll need
to budget time to work on the Roombas
• Roomba assignments
– Intro Roomba (what 600 freshman did)
– Map making
– Roomba coordination
– Hunt the Wumpus (tentative)
• (possibly) Non-Roomba assignments
– Path planning
Slide 5
Class Structure
• Supervisory Professor: WC Regli
• Recitation Lecturers:
– Mr. Michael Grauer
– Mr. David Wilkie
– Mr. Evan Sultanik
• Teaching Assistant and Hardware Tsar
– Ms. Megan Thurber
Slide 6
Grading
• If you finish all of the assignments,
you get an “A”
– If not, the proportion of finished
assignments will be determined by the
class instructor team
Slide 7
What is Cyber-Infrastructure?
• Cyber-Infrastructure:
– organized aggregate of technologies that enable us to
access and integrate today’s information technology
resources to facilitate science and engineering goals.
• data and storage, computation, communication, visualization,
modeling, simulation, networking, scientific instruments,
expertise and people
• Analogy to other kinds of “infrastructure”, typically
created for the general public good
– Interstate Highway System, Power Grid, Panama Canal, etc
• Drexel University is the national leader in CI
– Only institution w/ 4 active NSF Cyber-Infrastructure Grants
SCI-0537370, SCI-0537125, OCI-0636273, OCI-0636235
Slide 8
Drexel’s CI-TEAM
• Lead Institution: Drexel University
– PI William Regli, co-PI Michael Piasecki
• University of Maryland @ College Park
– SK Gupta
• University of North Carolina @ Chapel Hill
– Ming Lin and Dinesh Manocha
• University of Wisconsin @ Madison
– Nicola Ferrier, Vadim Shapiro, Krishnan Suresh
Slide 9
About the Team
• W. Regli
– CS, ECE and Mech E
– 1997 NSF CAREER
• M. Piasecki
– Civil
• SK Gupta
– Mech E
– PECASE, CAREER,
and ONR YIP
• M. Lin
– CS
– CAREER
• D. Manocha
– CS
– PYI, ONR YIP, Sloan
Fellow
• N. Ferrier
– Mech E
– NSF CAREER
• V. Shapiro
– Mech E, Math & CS
– NSF CAREER
• K. Suresh
– Mech E
Slide 10
Examples of Cyber-Infrastructure
• Networks
– Internet, DragonFly
• Data & Knowledge
– IMDB to MedLine
• Software Tools
– Firefox, MediaWiki,
Skype, Apache, etc.
• Communities/People
– SourceForge, Flickr,
discussion boards, email
lists, …
• Resources & Repositories
– SourceForge, GNU, etc
Slide 11
Role of Cyber-Infrastructure
(in this class)
• Class Wiki
–
http://gicl.cs.drexel.edu/wiki/Robot_Lab_%28Spring_2007%29
• Project materials and “How-To” Wiki
–
http://gicl.cs.drexel.edu/wiki/Category:Roomba_Design_Lab_%28Winter_2007%29
• “Roomba Questions” email list
– Subscribe at
http://face.cs.drexel.edu/mailman/listinfo/spring2007-roomba-lab
• Other web resources
– Accessible from the Roomba Wiki
Slide 12
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
Slide 13
http://robotics.megagiant.com/history.html
http://en.wikipedia.org/wiki/Robotics
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
Slide 14
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
Slide 15
Sprawl robot: Sprawlita
Multi-University Research Initiative
PI: Mark R. Cutkosky (Stanford University)
JPL Serpentine Robot
Tuna robot: VCUUV
Draper Laboratory, Cambridge, MA
Slide 16
Tour of the Roomba
Slide 17
Tour of the Roomba
Slide 18
Tour of the Roomba: The Vitals
• Roomba Serial Port
• MiniDIN male-male
cable
• USB adapter
Slide 19
Tour of the Roomba: The Vitals
• IR Wall Sensors
– You may want to use
these to implement
wall following
behavior
Slide 20
The Roomba Challenges
1.
2.
3.
4.
The Chutes
The Maze
The Great Escape
Name that Tune
NIST Rescue Robot League
Maze (2004)
Slide 21
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
Slide 22
Roomba Challenge #1:
The Chutes Example
Slide 23
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
Slide 24
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 deadends 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
Slide 25
FINISH
START
Roomba Challenge #2:
The Maze Example
How to
find the
shortcut?
Slide 26
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
Slide 27
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
Slide 28
Roomba Challenge #3:
Escape Example
Slide 29
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
Slide 30
Roomba Challenge #4:
Name That Tune
“I sing the Body electric;”
--Walt Whitman (1819–1892), Leaves of Grass.
• Problem: Program the Roomba to play one or more
of the following tunes
–
–
–
–
The Drexel Ode
Fanfare for the Common Man, A. Copeland
Thus Spake Zarathustra, R. Strauss
The Imperial March (Darth Vader's Theme), John Williams
• Objective: Play the tune
– Bonus!!: a chorus of many Roomba doing the Drexel Ode
together!! Get your lab-mates together…
Slide 31
Roomba Challenge #4:
Implementation Challenges
• Find the sequence of notes/keys
– The set of notes can be shared, posted to the
discussion board, etc.
– MIDI files, sheet music are available on the web
• Setting up the Roomba-Midi encoder
– http://todbot.com/blog/2006/05/03/roombamidiroomba-as-midi-instrument/
• This one shouldn’t be that hard and should be
a lot of fun
– Feel free to get carried away!
Slide 32
Implementation Tools
Slide 33
• Hacking Roomba:
ExtremeTech
– by Tod E. Kurt
• Published Dec 2006!
• Exercises are derivative of
those in this book
• A mere $17!
• All code, examples, etc are
available at
http://hackingroomba.com/
NOTE: you don’t really need the
book, all info is available via the
cyber-infrastructure…
Slide 34
Everything is on the Wiki!
http://gicl.cs.drexel.edu/wiki/Category:Roomba_Design_Lab_%28Winter_2007%29
Slide 35
Summary of Module Instructions
• Subscribe to mailing list
• Connect the Roomba to Your Computer
– Cable, bluetooth, etc
• Set up Processing
– An open source programming language and environment for
people who want to program images, animation, and sound.
Simple programming, no compiling; cut-and-paste examples.
• Install RoombaComm
– RoombaComm is a Java library created by Tod E. Kurt that
allows users to communicate with Roomba through a highlevel language (Java); Processing uses it.
• Roomba Program 1
– A “Hello Roomba” program
Slide 36
DO BEFORE YOU COME TO RECITATION
Summary of Module Instructions
• Subscribe to mailing list
• Connect the Roomba to Your Computer
– Cable, bluetooth, etc
• Set up Processing
– An open source programming language and environment for
people who want to program images, animation, and sound.
Simple programming, no compiling; cut-and-paste examples.
• Install RoombaComm
– RoombaComm is a Java library created by Tod E. Kurt that
allows users to communicate with Roomba through a highlevel language (Java); Processing uses it.
• Roomba Program 1
– A “Hello Roomba” program
Slide 37
Processing
• What it is
– A simple, interactive, programming language, with full access to
Java & Java classes and class libraries
– Simple IDE (Integrated Development Environment), with source
code editor, compiler, debugger
– It’s free and open source (if you don’t like it you can modify it)
• Why use it
–
–
–
–
Quick implementation and testing, perfect for trying out ideas
Lightweight programming environment, just edit source and run
Look ma, No Compiling!
Cross Platform Capability
• Assures same version Java VM
– Produces applications for OSX, Windows, Linux
• Note: you are welcome not to use it in favor of
C/C++/Java/C#/Perl/Python... etc… but you are on your own.
– Tools do exist for roomba hacking in these other languages
Slide 38
Processing: Example Commands
•
•
•
•
•
•
•
•
•
•
spinRight(float "degrees")
spinLeft()
goForward()
goBackward()
updateSensors()
playNote()
bump()
bumpLeft()
bumpRight()
wall()
Slide 39
Processing: Example Program
// **WALL FINDING**
// - Simple loop that reiterates until it sees a wall
// - When it hits left bump sensor, it turn 45 degrees right, and
// - vice versa; When it finds a wall, it exits loop, and code can
// - be implemented afterwards for another behavior
while( ! roombacomm.wall()) // while its not seen a wall
{
roombacomm.goForward(); // keep going forward until…
if (roombacomm.bumpLeft())
{
roombacomm.spinRight(45);
}
else if (roombacomm.bumpRight())
{
roombacomm.spinLeft(45);
}
roombacomm.updateSensors();
}
Slide 40
Processing: Example Program
// **WAGGLE**
// - This is a behavior used by the roomba when it is search for
// - something. It is seen when roomba is wall-following in
// - cleaning mode. roombacomm.drive(velocity, radius) -->
// - measurements in millimeters
done = false;
while ( ! done )
{
roombacomm.drive(200,600);
roombacomm.pause(250);
roombacomm.drive(200,-600);
roombacomm.pause(250);
}
Slide 41
Suggested Approach
•
•
Read the Wiki before you come to recitation
Review the Hacking Roomba website
– Many useful things there
•
•
Have software set up on your laptops and ready to go
Familiarize yourself with editing the program elements
– Some basic ‘bump-then-turn’ code may be useful
•
Be prepared to debug issues such as
– Port conflicts, I/O issues, can’t talk to USB devices, etc.
– These will all be situation dependent, and specific to your individual laptop
– Suggestion: bring more than one laptop
•
•
You may want to build a test-rig for work outside of class
TAs and Co-ops will be available to help set up
and configure BUT … getting skills in download
and configuring hardware-software systems is
one of the goals of this module!
Slide 42
DO BEFORE YOU COME TO RECITATION
To Do Before Recitation
• Subscribe to mailing list
• Connect the Roomba to Your Computer
– Cable, bluetooth, etc
• Set up Processing
– An open source programming language and environment for
people who want to program images, animation, and sound.
Simple programming, no compiling; cut-and-paste examples.
• Install RoombaComm
– RoombaComm is a Java library created by Tod E. Kurt that
allows users to communicate with Roomba through a highlevel language (Java); Processing uses it.
• Roomba Program 1
– A “Hello Roomba” program
Slide 43
Expected Module Pitfalls
•
Computer-Roomba configuration
– Getting software installed, talking to the Roomba, getting “hello world” to work
– This is very environment centric, part of the assignment is for teams to work
this out for at least one machine in your group
•
Program construction
– Format or syntax problems, unexplained errors, understanding commands
– Give yourself time to learn, explore, test & debug. You will not succeed if
you try everything the night before!
•
Roomba anomalies
– Roomba doesn’t go exactly straight, commands not exact, etc
– Welcome to the real world! Dealing with these problems is part of the
assignment.
•
Software/Algorithm Design
– Don’t make matters too complex. Most of the credit can be gotten via brute
force hard coding. However, to fully solve the challenges will require some
more sophistication and use of the sensors on the robot.
Slide 44
Suggested Ways to Handle Pitfalls
• Use the mailing list and post questions
– At least one member per-team should subscribe
http://face.cs.drexel.edu/mailman/listinfo/roomba-07-questions
• Share insights and information with others
– You are scored based on the competition, not based on
configuration of your laptop
• Post hacks, tricks, suggestions and ideas
to the list and message board
– Major issues will be addressed by the faculty, most problems
are going to be configuration-related
• Use the web and the wiki
Slide 45
The First Assignments
• The Chutes
– Fixed maze, in the recitation room
• The Maze
– Fixed maze, availability TBD
• The Great Escape
– Not a fixed maze, but a family of reconfigurable
ones, set up on the day of the contest and
periodically changed during the day
• i.e. you’ll need to implement a maze solver (wall follower
or similar) to get out of this
Slide 46
Contest Scoring
• All about time to completion
• You must complete the event
– Partial completions will not count
(unlike for grading)
• Roomba’s will be timed
• No remote control allowed
• Objective:
– Complete all the events
– Have the lowest cumulative time
Slide 47
Questions?
Unsuccessful Project
Successful Project
Slide 48
OK, Great, so we get to program
robots to exit mazes… where is
the Science and Engineering?
Slide 49
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
Slide 50
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
Slide 51
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
Slide 52
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
Slide 53
An example
Slide 54
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 sets
G = <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
Slide 55
Slide 56
Slide 57
Slide 58
The Basic DFS Algorithm
dfs( v )
process( v ) /* do what needs to get done*/
mark v as visited
for 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)
Slide 59
Depth First Search
Slide 60
Depth First Search
Slide 61
Depth First Search
Slide 62
Depth First Search
Slide 63
Depth First Search
Slide 64
Depth First Search
Slide 65
Depth First Search
Slide 66
Depth First Search
Slide 67
Depth First Search
Slide 68
Depth First Search
Slide 69
Depth First Search
Recurse back up the tree…
Slide 70
Depth First Search
Slide 71
Depth First Search
Slide 72
Depth First Search
Slide 73
Depth First Search
Slide 74
Depth First Search
Slide 75
Slide 76
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?
Slide 77
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?
Slide 78
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?
Slide 79
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
Slide 80
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!
Slide 81
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
d
….
“width” of the tree is named b,
for “branching factor”
b
Slide 82
Other Applications/Assignments
• Mapping
• Navigation
• Hunt the Wumpus
Slide 83
Example: Mapping
The CMU Millibots
• Modular Design
Communication
• Plug & Play interface
Localization
Planning & Control
Interface Communication
Payload:
• sonar
• camera
Computation
Interface Localization
Interface Motor control
Interface IR
Interface
Motor controlIR obstacle detection
12x7x14 cm
...
Common Bus:
• communications
• power
Slide 84
Application: Collaborative
new sensor
Mapping
reading
•
Occupancy certainty grids
with Bayesian integration:
T


Prob .( ST )  F  Prob .( S1 ),  Prob .( S ) 
 2


•
•
Integration of multiple sensor
readings
Integration of multiple local
maps
0% (Free)
Occupancy
Probability
50% (Unknown)
100% (Occupied)
Integration of multiple
readings
Slide 85
Accumulating Knowledge
• ‘bots communicate
to commander
agents to create
view of the world
• View is propagated
back to ‘bots
• ‘bots coordinate
their activities to
refine world view
Slide 86
Collaborative Exploration
Current
goal
•
Robot Agents store global map
and determines exploration
frontiers
•
Robots Agents explore nearest
frontier that is not yet being
explored by other robots
•
Exploration finishes when no
more unexplored frontiers exist
Exploration
frontier
Slide 87
Questions?
Unsuccessful Project
Successful Project
Slide 88
Download