Distance between each floor: 5 meters (so floor 1 is at position 0 meters, floor 2 is at position 5 meters, floor 3 is at position 10 meters, etc)
Relevant velocity and acceleration values:
x(t) = x0 + v0 * t + 1/2 * a * t^2
v(t) = v0 + a * t
x0 = initial position
v0 = initial velocity
a = constant acceleration/deceleration = +/- 1 m/s^2
So you can calculate the commit point based on the current DriveSpeed and the current elevator position CarLevelPosition (Where do you have to start slowing down to be able to stop in time at the next floor?). Keep in mind that you only get CarLevelPosition updates at 10 cm intervals in the hoistway, so you want your commit point to be a range slightly ahead of the actual physical commit point to allow for latency for the DriveControl to receive and process the messages and send the Drive command.
So for example, to calculate the commit point for the next floor,
you can assume you're going to be traveling at the Fast velocity of
1.0 m/s. Now you need to know how far away from the floor you
have to be to be able to issue a slow command with enough time to issue
a stop command to stop at the floor. The time it takes to
decelerate from 1.0 m/s to 0 m/s at the constant deceleration is 1
second. This is enough information to figure out where the commit
point should be, plus a bit of slack to account for network latency,
based on the period you have selected for CarLevelPosition.
In general, you should not use the AtFloor message as a substitute
for the CarLevelPosition message. You are not guaranteed to
receive an AtFloor[f,b] true for every floor the car passes if the car
is moving faster than the SLOW speed. AtFloor should be used for
leveling (at SLOW speed) and determining the current floor while the
car is stopped.
In later projects, we will change the Fast speed to a larger
value. We will not specify what this larger value is ahead of
time, but you should think about what changes in fast speed would be
"interesting" from a the standpoint of the design.