Skip to main content

fit_joints

Function fit_joints 

Source
pub fn fit_joints(
    entry: &MachineEntry,
    cfg: &Config,
    trace: &Trace,
) -> Result<Option<JointFit>, TraceError>
Expand description

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. None where a motor does not turn both ways in the trace.

Each motor’s added inertia stands for what its rotor and its link add about the joint alone; a link’s mass factor and first moments are reported where they act otherwise (on other joints, against gravity, with the pose), else folded into the motors’ values (JointValue::combines). What else it cannot tell apart depends on the moves and is folded or listed in alike; a trace that swings every axis over much of its range at several frequencies (docs/measurement-procedure.md) leaves none of the motors’. Elastic gears (effects.joint_elasticity): their ringing is smoothed out of the torque and of the rigid model alike (regressor, SMOOTHING_S); the slow twist under the load is left out (on the six-axis arm 1.5 mrad of a joint’s angle under 100 N m), a shortcut that holds while the swings stay well below the gears’ resonance.

Payloads picked or dropped during the trace (no gripper column in a trace, so from its torques: payload_steps) are fitted per stretch between the steps: payload_factor_before up to the first step, payload_factor_after from each step on (of payload for one step, payload 1, payload 2, … for several). The config’s replay keeps its payload and is fitted with the same split; a step counts where the trace’s change of the factor across it differs from the replay’s by more than PAYLOAD_STEP_SIGMAS standard errors, so that what the rigid model misses of the machine over the trace, the same in both, is not taken for one.

A factor on the rest of the rigid model (arms, platform, rotors) is not fitted: on the delta it correlated by more than 0.95 with the motors’ added inertias and constant torques together (gravity is nearly constant over a trace, and each arm’s inertia sits on its own motor), so it made all of them unknown.