Skip to main content

Module session

Module session 

Source
Expand description

The simulation in its own thread, on its own clock. The interface sends requests and reads samples from a channel; it never blocks the physics, and the physics never waits for a frame.

Structs§

Outbox
What the simulation has produced and the interface has not read yet. It is bounded, so that a window that stalls costs samples and not memory: of the samples the newest BACKLOG are kept, of the scenes the newest, of the travelled path the newest TRAIL points. Answers to requests are few and are all kept.
Runner
The simulation and the handling of requests, without any thread or clock. The session thread drives it; tests drive it directly, which makes them exact.
Session
TrailPoint
A point of the travelled path with what the 3D view may colour it by: the nearest point of the path the plan drew, in the scene, and how fast the tool went; and the simulated time it was passed, for cutting the path at the timeline’s time.
ViewNews
What only the window reads, apart from Events (which the model drains): the travelled path’s points with their speed and plan, and whether the machine tells a mode to show.

Enums§

Event
Request

Constants§

BACKLOG
Samples the interface may be behind by: ten seconds at real time. Beyond that the oldest are dropped.
MODE_SHOWN_HZ
Swings per second of the mode in the 3D view: slowed down to about one, so that the eye can follow it.
MODE_TRAVEL
How far the mode’s amplitude swings, in m, per time the view draws the deflections larger, and at most: the shape moves by it whichever of carriage and tool moves most (Machine::mode_shape). A few millimetres read on a machine of metres, and up to a tenth of a metre the parts still hang together.
MODE_TRAVEL_MOST
TRAIL
Points of the travelled path that are kept: 10 m of travel. Beyond that the oldest are dropped.

Functions§

extend_trail
Adds points to a travelled path and keeps the newest TRAIL of it.
mode_scene
The machine at rest at its planned pose plus its mode (Machine::mode_shape) swinging at MODE_SHOWN_HZ, seconds after it started, with the mode’s true frequency as a label by the tool. exaggeration scales the whole shape through its amplitude, and the scene draws it at true scale (Scene::exaggeration 1): the scene draws the carriage’s part of the shape at true scale and only the lean larger, which would distort the shape. None where the machine tells no mode. With picked (a mode of the mode list) that mode at its own pose, its shape complex: the state swings as rest + a (re sin + im cos), every part with its own phase.
travel_lines
Each axis’s travel as a line in the scene: where the tool goes (Machine::scene_point) as that axis alone runs from its min to its max with the others at pose. Axes that do not move the tool in the scene (no mapping, or less than a millimetre) and limits that are not numbers have none; the lines come with the index of their axis.