Read the Documentation:
https://stefanbesler.github.io/struckig/
Struckig ports pantor/ruckig to Structured Text and brings open-source online trajectory generation to TwinCAT 3. It targets deterministic PLC task loops and multi-axis synchronization in machine control scenarios.
Only the Community Version of Ruckig is ported and pro features are not available. Struckig is dual licensed:
- GPLv3 for open-source usage
- commercial custom license for closed-source usage (contact stefan@besler.me)
- Full docs: stefanbesler.github.io/struckig
- Installation guide: User guide installation
- API reference: API Reference
- Download the latest release from Releases.
- Add the library to your TwinCAT project.
- Instantiate
Struckig.Otgand callotg()once per PLC cycle.
For screenshots and TwinCAT step-by-step instructions, use the installation docs.
PROGRAM Example
VAR
otg : Struckig.Otg(cycletime:=0.001, dofs:=1) := (
EnableAutoPropagate := TRUE,
Synchronization := SynchronizationType.TimeSync,
MinDuration := 10.0,
MaxVelocity := [2000.0],
MaxAcceleration := [20000.0],
MaxJerk := [800000.0],
CurrentPosition := [0.0],
CurrentVelocity := [0.0],
CurrentAcceleration := [0.0],
TargetPosition := [100.0],
TargetVelocity := [0.0],
TargetAcceleration := [0.0]
);
END_VAR
otg();Map otg.NewPosition, otg.NewVelocity, and optionally otg.NewAcceleration to your axis interface each cycle.
- While the port stays close to upstream, additional behavior can be enabled via feature flags on
Otgor globally in library parameters.
| Flag | Description |
|---|---|
SmoothBrake |
In ruckig, reducing MaxVelocity below the current velocity triggers a brake ramp to velocity = 0 before transitioning to the new limit. Enable this flag to bypass that behavior and switch to the new MaxVelocity immediately. |
PositionScale, TimeScale |
Internal length and time units of the calculation, like position_scale and time_scale of Ruckig Pro. They bring large magnitudes, high jerk limits or long trajectories into the numerical range of the absolute tolerances without changing the resulting trajectory. Both default to 1. |
- Values that lie on a limit by construction (velocity and acceleration plateaus) are pinned exactly to the limit.
- Step 1 profiles are reused during time synchronization based on their full duration, including brake phases.
- End-state precision and limit checks are relative to the magnitude of the profile and the limit.
- Position Step 2 refines its closed-form solutions with Newton iterations.
- Near-zero cubic discriminants and near-double roots are classified with relative tolerances.
- Phase synchronization uses a relative collinearity check.