RoboCup Real-Time Scheduling

advertisement
RoboCup Real-Time
Scheduling
Aleksandra Tešanović (alete@ida.liu.se)
Calin Curescu (calcu@ida.liu.se)
Real-Time Systems Laboratory
Department of Computer and Information Science
Linköping University
October 2005
Lesson Content
Goal of the lab
RoboCup physical and simulated scenario
Lab environment: platform and software
Lab assignments
Task scheduling
Road-map to successful labs
Requirements for passing
Resources
Practical issues
1
Goal of the Lab
to apply scheduling
theory to a pseudorealistic setting
to learn how to do
efficient resource
allocation in realtime systems
while having fun!
Real-time and embedded systems:
1. read sensor values
2. compute control values
3. output result of computation
image processing (1)
planner (2)
actuator (3)
What is RoboCup?
RoboCup: Robot world Cup
framework to foster intelligent robotics research
integrates wide range of technologies
a soccer game played by robots
RoboCup league consists of
our lab setup!
small-size soccer game
played by small robots on a small field ☺
big-size soccer game
played by big robots on a big field ☺
more info on RoboCup
http://www.robocup.org/
2
RoboCup Physical Scenario
Information flow
Camera
Team 1
Computer 1
Computer 2
Team 2
RoboCup Physical Scenario
3
Simulated Scenario
Information flow
Camera
Team 1
Computer 1
Computer 2
Team 2
Lab Assignments
Implement three schedulers
cyclic
earliest deadline first (EDF)
rate monotonic scheduler (RMS)
Implement one performance metric
deadline miss ratio
Develop and test schedulers using the
simulated environment
4
Lab Environment: Platform
Not many device drivers for real-time Linux
Windows and PC provide a nice interface to
camera and radio transmitters
Programming language Java
constraints
avoid low-level programming
minimize effort to learn a new language
ADA has lost popularity in the industry
C is too low-level
possibility to conform to Real-Time Java
specification
Lab Environment: Software
Image Processing
Low-Level Controller
High-Level Controller
Planner
Reactor
Actuator
5
High-Level Control
Planner
produces abstract actions based on the image
processing information
any-time planner
executes the plan in six plan steps
should restart periodically to make a new plan
typically every 1 second
High-Level Control
Reactor
produces low-level actions based on the
abstract actions of the planner
reevaluates actions in every cycle
fairly independent of the planner
sends commands to the actuator
runs
after image processing
before actuator
6
Task Scheduling
Tasks in the system...
...are
image processing (1x)
planner (3x)
reactor (3x)
actuator (1x)
...have precedence constraints (not independent!)
...have temporal attributes
(estimated) worst-case execution time
period
relative deadline
Task Temporal Attributes
Task name
Estimated WCET (µs)
Period (µs)
Relative
deadline (µs)
(computation time)
Image
processing
100000
50000
50000
Planner
(all 6 steps)
12000
(2000 per step)
1000000
1000000
Reactor
1000
50000
50000
Actuator
3500
50000
50000
7
Cyclic Scheduling
Schedule is a predefined sequence of calls to
tasks
Consists of
major cycle
minor cycle
Major cycle
a whole non-repetitive sequence
consists of a number of minor cycles
Minor cycle
dictated by the clock interrupts
major cycle
minor cycle
interrupts
Cyclic Scheduling: your task
Make cyclic scheduling for the RoboCup task set
Determine the length of the major and minor
cycles
Determine the number of minor cycles
In the minor cycle
image processing, reactor, and actuator run to
completion
planner executes one or more plan steps
Restart the planner in an appropriate place in
the schedule
remember: planner should be restarted every second!
keep this in mind when determining the length of the
major cycle!
8
Priority Driven Scheduling
Scheduler
dispatch
Tasks in three states
ready
running
suspended
Ready
preempted
Running
released
Suspended
Two type of priority lists maintained by scheduler
ready lists
sorted according to scheduling policy, e.g., EDF and RMS.
suspended lists
sorted according to their release times
initially all tasks are in the suspended list
Priority Driven Scheduling: Your task
Write the part of the scheduler code that maintains the
priority lists as follows
Task is ready to be released
should be moved to ready list
Tasks in the ready state
the task with the highest priority should be executed (by
“firing” it)
Make sure that the planner is appropriately restarted
9
Priority Driven Scheduling: Your task
Running task(s)
return on specific yield points
can be preempted
can miss the deadline
scheduler should detect missed deadlines and invoke deadline miss
handler
getDeadlineMissHandler().handleAsynchEvent()
once finished (isfinished=true) task should be suspended
new release time and deadline should be set
NOTE: you should not have busy loops in the scheduler
if there are no task ready to run then scheduler should wait until
there are tasks
use the sleep() function of the Scheduler
Road-map to Success
Understand the RoboCup scheduling problem by reading the
compendium before the first lab occasion
you need this to be able to set-up and run your lab
Download studentFiles.exe file
download procedure and location of the files is in the compendium
extract exe file to your home directory
you get code skeletons for two first schedulers (cyclic and EDF)
RMS you should implement from scratch
Configure the test environment for running the schedulers
instructions in the compendium
Implement and test you algorithms
against another student team
against the reference schedulers
Join a final demo of some actions taking place in the physical
environment (date to be announced) and have some fun!
10
Requirements for Passing
Examination consists of two parts
practical part
theoretical part
Practical part
demonstration of working solutions of
schedulers to the lab assistant
Theoretical part
extensive discussion with the assistant on the
questions from the compendium
Simple mathematics:
pass in practical part + pass in theoretical part = 1 p
,but
pass in practical part + fail in theoretical part = 0 p
fail in practical part + pass in theoretical part = 0 p
Words of Wisdom
Be prepared to elaborate on all questions from the
compendium during the theoretical part of the
examination!
Answers to preparatory questions should be prepared
before the lab!
All members of the lab group should be present and
actively involved in every segment of the examination!
Passiveness in examination could result in extra assignments for
passing
Do the lab assignments before the deadline: January
10th!
11
Resources
TDDB47 web pages
address: http://www.ida.liu.se/~TDDB47
all important information and news will be posted there
check web regularly for news and important info
pay special attention to the first page and the ”Labs” page
Compendium
contains all the details on the lab exercises
contains instructions for setting up and running the lab
contains most relevant RoboCup APIs
Complete APIs for the RoboCup
http://www.ida.liu.se/~m_reap/RoboCup/API
or the TDDB47 web pages
Practical Isssues
Labs are done in PC rooms at IDA
Java version used in RoboCup is 1.4.2_05
Available tools for programming
Emacs
Sun ONE studio
Working with Emacs (recommended)
Start->Programs->GNU Emacs->Emacs
Compile in the command prompt with ”javac”
See handouts of lesson 1 for more details
Working with Sun ONE studio (requires advanced skills)
Start->Programs->Sun ONE Studio 4CE->Sun ONE Studio
Make sure that all packages are visible
File->Mountfilesystem->choose ”c:\programs\Robolab”
OBS! This tool uses older version of Java for compiling
Could cause robots to behave strangely
12
Download