Expand description
Fitting a config to a measured machine, in stages: first the rigid values of each axis from a drive
trace (or, where the motors do not turn in proportion to the axes, of each motor: fit_joints), then the
load’s resonance on the belt from a frequency sweep, or its stiffness from a move’s trace
(fit_move_stiffness). Nothing here edits a config; the results say what the config would have to be. sim-cli fit --write writes the one result that is a single key of the config (the factor on a stiffness) back, with its error
band as [bounds]; the others are lumped values of several keys.
Every stage runs the same estimate on the measurement and on the config’s own simulation of the same run, and reports the two side by side. What the simple estimate gets wrong (gearbox losses that grow with the torque, friction that depends on the load, a resonance that moves with the sweep’s amplitude) it gets wrong on both sides, so the difference between them is what the config is off by.
Structs§
- AxisFit
- The rigid values of one axis, in this order: moved mass (with rotors and pulleys counted as mass at the axis), viscous friction, Coulomb friction and constant force. In N, kg, s and the axis’s unit.
- Friction
Detail - What the friction of an axis does beyond the rigid values’ sliding level (
friction_details): its name as the CLI writes it, and as inAxisFitthe estimate on the config’s replay, on the trace, and its standard error. - Joint
Fit - Stage 1 in the motors’ coordinates (
fit_joints). - Joint
Value - One value of the fit in the motors’ coordinates (
fit_joints): its name as the CLI writes it, of what (a motor’s id, a link’s name, orpayload), and as inAxisFitthe config’s estimate, the measured one and its standard error. Per motor in N m, kg m², s and rad at the motor shaft. A base parameter: where the trace cannot tell other values from this one,combinesnames them (asquantity of) with the factor their change enters this one’s change by, so that fitted less config is the change of this value plus each factor times the change of that one. - Move
Stiffness - Stage 2 from an ordinary move’s trace (
fit_move_stiffness): the factor on the stiffness and its standard error, and the ringing the fit compares, RMS over the motors in N m: in the trace, and what the config’s replay with the factor leaves of it. - Resonance
- Sweep
Fit - Stage 2 done: the resonance of the config’s own sweep and that of the measured one.
Constants§
- ALIKE
- Above this correlation of two estimates the trace does not tell them apart.
- BELT_
STIFFNESS_ KEY - The config key
fit_move_stiffnessscales unless told another: the belts’ stiffness, of every belt machine. - FRICTION_
DETAILS - The quantities of
friction_details, in its order. - JOINT_
QUANTITIES - The quantities of
fit_jointsper motor, after the factor on the payload (payload_factor). - LINK_
QUANTITIES - The quantities of
fit_jointsper link of a chain (Machine::links), after the motors’: the factor on its mass, first moment and inertia together, and the change of its first moment along x, y and z of its frame, its mass and its inertia about its frame kept. - MAX_
PAYLOAD_ STEPS - At most this many payload steps are looked for in one trace.
- MOVE_
RINGING_ RATIO - Below this ratio of the trace’s ringing power to what the fitted replay leaves of it, a trace is taken not to ring
above its noise (
fit_move_stiffness): 1.25 is the replay explaining an RMS of at least half what it leaves, ringing² − residual² ≥ (residual / 2)². - MOVE_
STIFFNESS_ LIMIT - Above this standard error, over the factor, a trace is taken not to excite the mode enough (
fit_move_stiffness). - PAYLOAD_
STEP_ QUANTITIES - The payload’s factor before the first step and from each step on (
JointFit::payload_steps), in place ofpayload_factor. - PAYLOAD_
STEP_ SIGMAS - The payload’s factor has to differ before and after a step by this many of its standard errors for the step to
count (
JointFit::payload_steps), more than the trace’s after less before differs from the config’s replay’s. Well above 3, as the search tries some hundred splits and keeps the best; on the swings with the payload held (delta, SCARA, arm) none was found, on the delta’s pick the difference was some 70 standard errors. - RIGID_
SPAN_ S - The shortest span (
smoothing_span) on a machine without modes: the rigid fit’s own window of 11 rows at 1 ms (WINDOW), which averages the noise but has no ringing to take out. - SMOOTHING_
S - The span over which the regressor’s rows are smoothed, s: a triangle of this half-width (
smoothing). A gear’s ringing above 1 / 0.04 s = 25 Hz is all but gone from it (the triangle’s response is sinc², below 0.05 beyond its first zero), the slow swings of an exciting trajectory pass (0.995 at 1 Hz), and as the torque and every column are smoothed alike the fit holds whatever passes. Set by the six-axis arm’s gears (their ringing at some 30 Hz); shorter only where a trace leaves too few rows at it (smoothing_span). - WEAK
- No value’s variance may be inflated by more than this by the others’ (1 / (1 − R²) of its column on all the others):
less than a tenth of its column outside what the others explain (and no less than 1, which rounding gives where the
columns are exactly dependent). A column that would make one so is not fitted on
its own but folded into those before it (
solve): exactly where the rigid model only knows their sum (a link turning about a fixed axis adds to its motor’s inertia and nothing else), nearly where the trace does not move the joints that would tell them apart (an elbow held still, a link never tilted against gravity).
Functions§
- fit_
joints - Stage 1 in the motors’ own coordinates, for every machine, and the only one for a machine whose motors do not turn
in proportion to its axes (the delta’s arms, a SCARA, an arm): the motor torques regressed on the machine’s own
rigid model (
regressor), on the trace and on the config’s replay of it, on the trace’s base parameters (solve). For the config the payload’s factor and each link’s come out near 1 and the added inertias and first moments near 0, friction and constant torque as the config has them at the motor shaft, gearbox losses and all, so that the difference is what the config is off by.Nonewhere a motor does not turn both ways in the trace. - fit_
move_ stiffness - Stage 2 from an ordinary move’s trace, no sweep: an output-error fit of the stiffness. The config is replayed with
the value at
key(the belts’ stiffness,BELT_STIFFNESS_KEY, or another spring between motor and load) times a factor, and the factor is the one whose replay’s motor torques ring as the trace’s do (ringing: least squares over every motor and row). The replay has the config’s loops, filters, delays and friction, which damp the ringing of a move in the trace as they do in the machine, so that they need not be fitted as well; a free two-mass fit of the torque took the drive’s own lag, at 51 Hz on the belt axis, for the belt. The masses have to be right first (stage 1), as for a sweep. - fit_
rigid - Stage 1: the rigid values of every axis from a trace, next to the config’s.
Nonefor an axis the trace does not move in both directions. The machine has to passtrace::per_axis_fit(a linear transformation and an inertia that does not change with the pose); others are refused witherror-trace-not-linearand go tofit_joints. - fit_
sweep - Stage 2 on a measured sweep, taken on
motorwith a torqueamplitude: a dip of the measured sweep, and of the config’s own sweep the dip of the same mode. The config’s sweep has the measured frequencies and, at the step of each end, more beyond them up to a factor of √2: its dip of the same mode may lie near an end, where the range misses one of its flanks. Before, the config’s lowest dip with both flanks was taken: on the T-shaped belt gantry with its belt at 0.8 of the stiffness, swept from 50 to 130 Hz, its dip at 55 Hz missed its lower flank by 0.1 of 726, and the next one, at 94 Hz, was set against the measured 61.5 Hz (factor 0.42 for 1.25).Nonewhere the measured sweep shows no dip with both flanks, or the config’s none at all. - fit_
units - The units of an axis’s four rigid values (moved mass, viscous friction, Coulomb friction, constant force) by the
axis’s unit (
AxisInfo::unit): those of a rotary axis (“rad”) are kg m², N m s/rad, N m and N m, every other one’s kg, N s/m, N and N. - friction_
details - Friction beyond the sliding level, from one axis’s force, speed and travel along the trace’s rows and its rigid values
(
rigid_values: mass, viscous, Coulomb, constant; NaN viscous counts 0): eachNonewhere the trace does not show it. - parse_
sweep - A frequency response as
sim-cli sweepwrites it: the columnsfrequency_hzandgain_rad_s_per_nm. A phase is not read; the fit does not use it. A frequency that is not finite and above zero is refused, assweeprefuses it: before, a file with 0 Hz in it got past to the fit, and was refused only when it had a dip. - resonance
- Stage 2: the resonance of the load on the belt, from a frequency sweep of motor torque to motor speed
(
frequency_sweep, or a drive’s measurement of the mechanical system). Where the load resonates the motor hardly moves, which shows as a dip. Its frequency squared is stiffness over load mass, so with the masses right, measured over config frequency, squared, is the factor the stiffness is off by. - smoothing_
span - The span a machine’s trace is smoothed over, s:
SMOOTHING_Swhere every motor turns each way long enough at it (turns_both_ways); else the longest span at which they do, in whole rows of the trace’s step, but not shorter than one period of the machine’s lowest mode (Machine::modes, at the forward kinematics of the motor angles at ten rows spread over the trace), where the triangle’s first zero takes its ringing out.SMOOTHING_Swhere none does (or where the lowest mode is below 25 Hz): the trace is then not fitted. The four-arm delta’s lifts last some 60 ms and its arms 2 and 4 reverse in each traverse: at 40 ms its motor 2 kept its sign forward for 198 of the 810 rows a direction needs; its lowest mode, 44 Hz without the payload, allows down to 23 ms. - turns_
both_ ways - Whether
fit_jointscan fit the machine’s trace: every motor turns each way for at least ten windows’ worth of rows that it takes (steady, over the machine’ssmoothing_span), else its Coulomb friction cannot be told from a constant torque.