Skip to main content

Crate sim_app

Crate sim_app 

Source
Expand description

The app’s logic without its window: the simulation session and the interface model. main.rs and ui.rs draw it with Bevy and egui.

Modules§

frequency
The loop-response tab’s measurement: per motor the open-loop response of its velocity loop as sim-cli margins measures it (analysis::velocity_loop_responses, refined where it changes fast), its margins, the machine’s resonances and the input shaper’s and the notch filter’s frequencies, and what the plots draw of it (closed loop, phases, the phase crossover). It runs in a thread of its own, with progress and a cancel switch, as the app’s other long runs do. No text for the user is written here.
insight
The app’s side of the views of what the machine is (sim_components::shapes): what the workspace map and the path in the 3D view are coloured by, the path’s values, and the cycle run with its bounded values at their bounds, kept as traces. Nothing here draws.
model
Everything the interface shows and edits, without any drawing: the chosen machine and language, the config being edited, the scope history, tuning and analysis results. The window code only draws this and calls its methods.
runs
Runs kept side by side for comparing them: the live session’s scopes, the ghost run beside it, an analysed cycle, a path that was run, a replayed trace, and the cycle of another config or machine. Each holds every signal it has, sampled once per millisecond, with the time counted from its start. Runs of different machines are compared by quantity (Channel): a motor’s torque, speed and following error by the motor’s place in the machine’s list, and the tool’s position error. The views draw what this module gives them; it draws nothing itself.
search_views
The search workflow in the app beside the ranked table of the search tab: every option sim-cli search takes (SearchInputs), the figures of each candidate as a heat map of its checks (heatmap), cost against margin with the front (scatter), the top candidates’ operating points on their torque-speed curves (Found::curves) and why each failed (failures); the sweep of a gear ratio or pulley radius (sim-cli transmission) and the comparison of kinematics on one task (sim-cli compare-kinematics); and for the path tab maps of peak torque and following error over a plane of the workspace, from a grid of short moves (move_map). The window draws them in ui/search_views.rs.
session
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.
settings
What the window remembers between starts: the language, the theme, the unit switches, the speed, and the config or machine file last opened with the machine picked. A small TOML file in the user’s config folder, or where SIM_APP_SETTINGS points. Nothing here reads the environment or the disk of its own accord, so that the tests and the developer hooks can keep clear of the user’s file (path).
video
Recording the 3D view: numbered PNG frames in recordings/<date-time>/ under the working directory, made into recordings/<date-time>.mp4 by Blender where it is installed. Blender is a big, optional program, so it is looked for, not depended on; without it the frames stay for any other encoder.

Statics§

FONT
The panels’ typeface: Atkinson Hyperlegible Next, the Braille Institute’s, under the SIL Open Font License (assets/fonts/OFL.txt). Its default weight, Regular, is the one drawn.
I18N
(language code, translation file contents) for the app’s own labels.