CS452 - Real-Time Programming - Winter 2013
Lecture 25 - Multi-Train Control II
Public Service Annoucements
- When you will give the second demo
Train Control Demo I
What we saw
Multi-Train Control
By the end of the week-end you should be able to drive one train on the
track, knowing exactly where it is.
- 'Exactly' means within a tolerance that you know.
By the following milestone you will be able to control two trains at the
same time. For each train
- the train finds itself
- you give it a destination: a destination is a location on the track
- the train starts travelling toward the destination
- it reaches the destination without colliding with the other train
- both trains move at the same time
- otherwise there is a trivial solution
- it might be worth implementing the trivial solution as a start
A good goal for the second train milestone is
- Two trains on the track going to random destinations.
- When a train stops at its destination it is given a new random
destination and starts up again.
- The trains avoid one another.
Sensor Attribution
Collision Avoidance
Route Finding
It doesn't seem to matter what shortest path algorithm you use, but
- you might want to introduce a penalty for reversing,
- representing each stretch of track twice in a directed graph is
commonly useful
- route finding might be integrated with collision avoidance
Reservations: a possible solution to collision avoidance
You have to be able to look ahead.
To do so treat the track as a divisible resource like pixels on a display.
Train driver requests some of the resource in order to move.
- He needs enough track that it can come to a stop.
- The server that "gives" we would call a reservation manager.
- The train driver should always be prepared to act safely if a request
for track fails.
A very simple way to do it not well enough
- Train driver gets a request to do something with the train, and figures
out whither he needs to move.
- Train driver asks for a route
- Train driver is blocked until no other train is moving.
- Route provided avoids stopped trains, which are guaranteed to stay
in the same place.
- Train driver requests track all the way to the end of the route.
Return to: