Interpolated Movement
The clockwork of a journey: plan a step, wait for it, advance, plan the next.
Below every substrate, because every substrate needs it. A guide path discretises a journey at zone boundaries, which its geometry fixes; a continuous projection and a free path discretise it at interpolation steps, which the modeller chooses. The second and third are the same clockwork over different geometry, and this is that clockwork, in the package both of them are already above.
It is driven by events the vehicle owns, not by the traveller's process. That is what VehicleMovementIfc requires and why it could not be built on a suspending integration loop: a fleet's control loop has to be able to command a vehicle from somewhere other than that vehicle's process, and the two ends of a wait must not disagree about where the wake will come from. So beginTravelTo commands and returns a queue, and whoever is waiting is resumed from it.
A step is planned before it is waited for. The direction and the distance are fixed when the event is scheduled and applied when it fires, so the vehicle covers the ground the elapsed time paid for. A redirection arriving mid-step therefore costs the step it interrupts rather than being free, and is observed at most stepSize/velocity later -- the same latency a guide path has at its next boundary, and for the same reason: something between two places cannot stop and turn.
Parameters
the vehicle this belongs to. A model element of its own so that it can schedule its own steps and be reset between replications without the vehicle remembering to
the geometry to move through
how far apart the decision points are, in the geometry's own distance units. Ignored where the geometry cannot interpolate, since there the whole leg is one step
how fast the vehicle is going, asked once per step so that a vehicle whose speed depends on what it is carrying answers for itself
told whenever a journey stops, by arrival or by halt, and told before whoever was waiting is woken. For a vehicle that keeps its own flags about whether it is moving
Constructors
Properties
A veto asked at every step boundary: may the vehicle go on past this one?
Where the journey in progress is going, or null when there is none.
How far the vehicle has travelled this replication. Never decreases.
True while a journey is under way, whether or not it is halted.
How long it has spent travelling this replication. Never decreases.
Functions
Sends the vehicle to to and hands back the queue to wait in.
Forgets any journey and zeroes the odometers, at the start of every replication.
Records a journey this machinery did not make.
Starts a halted vehicle again from where it stopped. Harmless on one that is not halted.