CS452 - Real-Time Programming - Spring 2012

Lecture 21 - Anthropomorphic Programming

Public Service Annoucements

  1. Exam: 9.00, August 8
  2. I now have back my document creation tools. Assignments will start to be more uptodate.


Constant Jerk

Third order curve for position, second order for velocity, linear acceleration. We usually go one better, and try to minimize jerk over the whole journey.

Minimize Jerk

Acceleration/Deceleration is continuous

The result is a fourth order curve in position, third order in velocity, which is what you try to achieve when you drive.

Is it Worth Having an Explicit Function?


  1. You can calculate position explicitly without having to do numerical integration.
  2. You can calculate the parameters of a function with less measurement. How?

    The idea is that the person who programmed acceleration/deceleration into the train was lazy, so there's probably one basic function used over and over again


  1. You need to check that the functional form you have is the right one, or a right-enough one.
  2. For practical purposes small look-up tables may be perfectly adequate.

Finding Parameters for an Explicit Function

We are trying x(t) as a fourth order polynomial in t.

It is easiest to express the polynomial in terms of y = ( t-t1 )/(t2 - t1). Why?

Then write

and use the equations above to solve for the five parameters in terms of t1. Then, you need only measure t1 to know the relevant kinematic functions.

We discussed how to measure t1 in the second step.

Testing the Measured Values

You test the measured values by

When you have the disagreement which is, by definition non-zero, but which may be measured as zero, you have to decide the cause:

Have fun.

Anthropomorphic Programming

We all, even most programmers (!), have effective intuitions about human relations

Tasks are independent entities

Servers and Attendant Tasks

Why do servers need attendant tasks?

1. Proprietor with a Notifier

Proprietor `owns' a service, which usually means a resource.

Kernel is handling hardware in this example

Notifier Code for a UART

Proprietor/Notifier Code for a UART


  1. Notifier is usually of higher priority than server
  2. When, and how, do interrupts get turned on and/or cleared?
  3. Who coordinates hardware ownership?
  4. We have made the code

2. Using a Courier

Simplest is best

Transmit Notifier Code

Transmit Courier Code

Transmit Proprietor Code


This gets you through a bottleneck where no more than two events come too fast.

Remember that all the calls provide error returns. You can/should use them for error recovery

Another possible arrangement for task creation

Another possible arrangement for initialization

Distributed gating

I am showing you collections of tasks implemented together because sets of related tasks is a level of organization above the individual task.

E.g., the decision to add a courier requires revision of code within the group, but not outside it.

Return to: