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

Download Report

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

ROBOT LAB
SPRING 2009
Lecture #1
William Regli
(Guest Lecture: Mr. Evan Sultanik)
Department of Computer Science
Drexel University
http://gicl.cs.drexel.edu
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
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
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
Grading Policies
•
This course is 100% robot simulation programming
–
•
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
–
•
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.
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.
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
Brief Introduction to Robotics
“LIFE! DO YOU HEAR ME?
GIVE MY CREATION... LIFE!
-- Dr. Frederick Frankenstein
from Young Frankenstein
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)
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.
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 environment
1: Japanese Industrial Robot Association
America and Europe?
• “a programmable, multifunction
manipulator…”
-RIA2
• “an independently acting and self
controlling machine…”
-ECM3
2: Robotics Institute of America
3: European Common Market
http://robotics.megagiant.com/history.html
http://en.wikipedia.org/wiki/Robotics
Fiction:
Highlights from the
History of Robotics
– 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
Robot Ethics
Asimov’s
Three^H^H^H^H^H
Four Laws:
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.
(Image from http://www.bmc.riken.jp/%7ERI-MAN/index_jp.html)
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
Sprawl robot: Sprawlita
Multi-University Research Initiative
PI: Mark R. Cutkosky (Stanford University)
JPL Serpentine Robot
Tuna robot: VCUUV
Draper Laboratory, Cambridge, MA
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)
Robot Components
•
•
•
•
•
•
Body
Effectors
Actuators
Sensors
Controller
Software
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.
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…
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
6-DOFs Robot Arm
How many
DOFs can
you identify in
your arm?
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/)
Roomba Effectors
• What are the effectors of a Roomba?
Roomba Effectors
• What are the effectors of the Roomba?
Vacuum, brushes, wheels
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.
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)
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.
y
x
VL (t)
VR(t)
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.
y
x
VL (t)
VR(t)
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.
y
x
VL (t)
VR(t)
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.
y
x
VL (t)
VR(t)
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 .
Sensor Classes
• Range finders: these sensors are used to
determine distances from other objects,
e.g. bumpers, sonar, lasers, whiskers, and
GPS.
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
Sensor Classes
• Proprioceptive sensors: these provide
information on the robot’s internal state,
e.g. the position of its joints.
Shaft decoders
count revolutions,
allowing for configuration
data ond odometry.
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”
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
nonsystematic
errors.
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.
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
Odometry, Position Updates
• With calibration, model behavior becomes
more similar to observed behavior.
However, estimation uncertainty still grows
without bound.
• Position updates
reduce
uncertainty.
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.
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
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
Kinematics of Differential
Steering
Derivation:
X component of speed
Speed is average of vr & vl
Y component of speed
Arc change over radius
Integrate all:
This is the turn radius for a circular trajectory:
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.”
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:
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 with
sensors. They can thus
compensate for errors.
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.
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.
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.
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.
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.
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:
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.
Potential Field Control
• Potential field control is similar to the hillclimbing 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.
Potential Field Soccer
• 1 moves
toward the
blue goal.
• 1 avoids
7, 6, and 8.
• Teammates
generate
attractive
fields.
(image from http://www.itee.uq.edu.au/~dball/roboroos/about_robots.html)
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.
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.
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.
END
The Roomba Module
William Regli
Department of Computer Science
(and Departments of ECE and MEM)
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
You
Your
Roomba
• 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
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
Tour of the Roomba
Tour of the Roomba
Tour of the Roomba: The Vitals
• Roomba Serial Port
• MiniDIN male-male
cable
• USB adapter
Tour of the Roomba: The Vitals
• IR Wall Sensors
– You may want to use
these to implement
wall following behavior
The Roomba Challenges
1.
2.
3.
4.
The Chutes
The Maze
The Great Escape
Name that Tune
NIST Rescue Robot League
Maze (2004)
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
Roomba Challenge #1:
The Chutes Example
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
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
FINISH
START
Roomba Challenge #2:
The Maze Example
How to
find the
shortcut?
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 hardcoding and dead reckoning
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
Roomba Challenge #3:
Escape Example
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
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
OK, Great, so we get to program
robots to exit mazes… where is
the Science and Engineering?
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
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
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
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
An example
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
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)
Depth First Search
Depth First Search
Depth First Search
Depth First Search
Depth First Search
Depth First Search
Depth First Search
Depth First Search
Depth First Search
Depth First Search
Depth First Search
Recurse back up the tree…
Depth First Search
Depth First Search
Depth First Search
Depth First Search
Depth First Search
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?
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?
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?
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
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!
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
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
Implementation Tools
Implementation Tools
• Player
• Stage
• Gazebo
Questions?
Unsuccessful
Successful