3D Simulators — Overview

synapsys.viz.simview provides plug-and-play 3D simulation windows that combine
real-time PyVista rendering and matplotlib telemetry in a single PySide6 interface —
ready to accept any controller you design.
What you get in one line
from synapsys.viz import CartPoleView
CartPoleView().run()
A complete window with:
- 3D panel — real-time physics animation (PyVista + VTK)
- Telemetry panel — 4 synchronized matplotlib charts (position, angle, control, phase portrait)
- Control bar — hold-to-apply perturbation buttons, magnitude slider, pause/reset
- Automatic LQR — if no controller is provided, the lib linearizes the simulator and designs an LQR internally
- Global keyboard capture — A/D (perturbation), R (reset), Space (pause), Q (close)
Architecture
SimulatorBase ← synapsys.simulators
│ dynamics(), step(), linearize()
│
SimViewBase ← synapsys.viz.simview._base (QMainWindow)
│ • creates Qt window (3D + matplotlib splitter)
│ • QTimer loop → _on_tick()
│ • auto-LQR via linearize() + lqr()
│ • keyboard, perturbations, pause, reset
│ • _build_all() called in run()
│
├── CartPoleView ← state: [x, ẋ, θ, θ̇]
├── PendulumView ← state: [θ, θ̇]
└── MassSpringDamperView ← state: [q, q̇] + setpoint tracking
Each subclass implements only what is specific to its physical system (3D scene, charts, HUD, LQR parameters). All Qt boilerplate is inherited from the base.
Available simulators
| Class | Physical system | State | Input | Perturbation |
|---|---|---|---|---|
CartPoleView | Cart + inverted pendulum | [x, ẋ, θ, θ̇] | Horizontal force on cart (N) | ◀/▶ horizontal force |
PendulumView | Single-link inverted pendulum | [θ, θ̇] | Joint torque (N·m) | ↺/↻ angular torque |
MassSpringDamperView | Mass-spring-damper | [q, q̇] | External force (N) | ◀/▶ force + setpoints 1/2/3 |
Standalone vs. library module
| Approach | Lines of code | Requires Qt knowledge? |
|---|---|---|
Standalone file viz3d_cartpole_qt.py | ~470 lines | Yes — layout, QTimer, splitter, canvas |
CartPoleView().run() | 1 line | No |
CartPoleView(controller=my_net).run() | 1 line + your function | No |
The standalone files in examples/simulators/ remain available as a reference for
anyone who wants to understand the internal implementation or build highly customized
UIs beyond what the library provides.
Dependencies
pip install synapsys[viz]
# or individually:
pip install pyside6 pyvistaqt matplotlib numpy
Note:
pyvistaqtrequires a VTK installation compatible with Qt. In headless environments (servers without a display), usepyvistawith the offscreen backend.