CS452 - Real-Time Programming - Winter 2013

Lecture 17 - Calibration II

Pubilc Service Annoucements

  1. Due date for kernel four.
  2. Serial I/O questions.
  3. Measurement is an activity that is not speeded up by being smart.
  4. Exam: 16.00, 11 April to 18.30 12 April.

Calibration

Where is it?

A question with two different answers

  1. A location known by the the person who asked the question, a landmark.
  2. A route to the item about which the question was asked, taking the asker into unknown territory. The route contains

Where am I?

The usual answer is a combination of a landmark plus a measurement.

To get the second part of the answer you can

The second of these is called dead reckoning. To know where a train is we use a combination of landmarks, sensors, and dead reckoning, knowing the train's velocity and how long it has been travelling since the landmark.

Philosophy

You can't do anything until you know where the train is. You accomplish this by

Measurement is costly, and you should squeeze every bit of information you can out of every measurement you make.

Display the difference between your prediction and your measurement on the terminal,

This gives you an ongoing feeling for how your application is working, which is very important for setting effective tolerances.

1. Stopping Distance

The simplest objective:

Notice that if you just do the obvious thing you get it right.

2. Calibrating Constant Velocity

At this point there are a few places on the track where you can stop with a precision of a train length or better. However, suppose you want to reverse direction at a switch.

Knowing the Current Velocity

An implicit assumption you are making is that the future will closely resemble the past.

  1. You measure the time interval between two adjacent sensor reports.
  2. Knowing the distance between the sensors you calculate the velocity of the train

    Note that on average the lag mentioned above -- waiting for sensor read, time in train controller, time in your system before time stamp -- is unimportant.

  3. After many measurements you build a table

Using Resources Effectively

The most scarce resources

The most plentiful resource

Any time you can use a plentiful resource to eliminate use of a scarce one you have a win. For example

Practical Problems You Have to Solve

  1. xmlns="http://www.w3.org/1998/Math/MathML"The table is too big.
  2. The values you measure vary randomly.

The values you measure vary systematically

How Long does it Take to Stop?

Try the following exercise.

  1. Choose a sensor.
  2. Put the train on a course that will cross the sensor.
  3. Run the train up to a constant speed.
  4. Give the speed zero command at a location that stops the train with its contact on the sensor
  5. Calculate the time between when you gave the command and when the sensor triggered.
  6. Look for regularities.

How Long does it Take the Train to Get up to Speed?

What would a lazy programmer do?