Skip to main content

Module trace

Module trace 

Source
Expand description

Drive traces: what a drive’s scope exports, read from CSV and replayed through the simulator.

Structs§

MotorTrace
One motor’s columns of a trace, all at the motor shaft: position setpoint, position, speed, torque.
Trace
TraceError
A trace that cannot be read or replayed; key is a translation key, detail its argument.

Constants§

PER_AXIS_SPREAD
How far the torques per unit of an axis’s acceleration may differ across the range for the fit per axis (per_axis_fit), of the largest: the fitted mass is then their mean over the trace, and how far the inertia strays from it over the trace’s poses is in the mass’s error (AxisFit::mass_spread), so this only chooses which of the two fits answers, and both answer honestly on either side of it (the disc cam per axis without its payload and in its motor’s coordinates with it, a_mass_that_varies_over_the_poses_carries_its_spread_in_its_error). The T-shaped belt gantry’s belt (its runs on the vertical posts and its share in the Z axis’s moves) changes its torques by up to 3.9 % over the range (4.5 % without the payload); the other machines fitted per axis by 0; the disc cam by 6.2 % (4.1 % without the payload, so its config without one is fitted per axis); the slider-crank, the SCARA, the indexers’ cams and the arm by 40 % and more.
RUN_UP_S
The shortest run-up of a replay (replay), s: long enough for the loops’ integrators and the friction to settle at the trace’s first speed before its first row.

Functions§

columns
The named columns of a CSV table with a header line. A unit in brackets after a column’s name is dropped; columns that are not asked for are ignored.
difference
RMS and peak of the difference between two columns.
differences
Per motor how far a replay is from its trace: RMS and peak of the difference of the torques, then of the following errors.
linear_transformation
Whether the motors turn by the same angle per travel of each axis everywhere: at 40 % and at 60 % of every range, 1 mm along each axis, to 1e-9. The fit per axis (identify::fit_rigid) takes the motor angles per axis travel as constant, so it refuses a machine whose transformation is not linear (the delta’s arms, a SCARA), which gave numbers without meaning; those are fitted in the motors’ own coordinates (identify::fit_joints). Replay works for both.
overlay_csv
Measured and simulated torque, speed and following error side by side, per motor named in ids, one line per row of the trace, as CSV with a header.
per_axis_fit
Whether the fit per axis (identify::fit_rigid) applies: a linear transformation, and a rigid model whose torques per unit of each axis’s acceleration are the same at 10 %, 20 % … 90 % of every range (a SCARA’s inertia, even in its elbow angle, agrees at poses symmetric about the middle; a cam’s dwells hold two probes alike), to PER_AXIS_SPREAD of the largest. A SCARA’s tool pose is its joints, linear, but the inertia an arm turns changes with the pose.
replay
Plays the position setpoints of a trace through the simulator and returns what the simulated drives did at the times of the trace’s rows. The replay starts from the trace’s own state, whatever the config’s start pose: at rest at a pose before it, it runs up to the first row’s position setpoint at the first row’s measured speed, so a recording cut out of a longer motion replays without the jolt of a start from rest. The run-up is a smootherstep of the speed (rest to that speed, zero acceleration at both ends, RUN_UP_S or more, so that its acceleration stays within a quarter of each axis’s limit), the way covered half the speed times its time; the pose it starts at has to be within the axes’ ranges; the run-up starts where the machine’s setpoint stands at rest there (its motors, a sag away from the tool) and takes that difference up on the way. A trace that starts at rest where the config’s own machine stands at rest (a trace written by a run of the config) is replayed from that state with no run-up, the first row the machine at rest, as before the run-up existed: it replays onto itself to rounding.
rising
Refuses times that do not rise, naming the first data row (1 = the row under the header) that does not.