Given what we know from 6.6 that the distance for
acceleration is
. It takes the same distance
to stop. In other words, the total distance to accelerate and
decelerate is
. What is
?
If this is the case, it means that we need to stop accelerating and
immediately begin deceleration before we reach
.
Instead of predetermining the speed profile, we can do the following
(in pseudocode). Assume
is the current velocity.
Sometimes it is necessary to change the target velocity. As a result,
we usually want to use another term,
, to represent the
desired velocity. But this means that the current velocity can
exceed
. Our logic needs to be modified as illustrated in
algorithm 1. Note that in this
algorithm,
,
can both be changed dynamically.
Note that this code also handles positive and negative
and
.
In a program,
should be replaced by
, and
should be
replaced by an appropriate frequency term. Furthermore, the
acceleration term should be replaced by
, and
replaced by an appropriate frequency term determined by experiment.
Note that algorithm 1 should be executed
independent of the stepping logic, but within the same tick. This logic
should also be invoked whenever
or
is changed.
Copyright © 2006-02-15 by Tak Auyeung