Dob

DOB #

Brief #

dob is a disturbance (load torque) observer on the torque command. It estimates the torque the rigid body model cannot explain (load, friction, cutting force, cogging) and subtracts it from the torque command, so the drive cancels the disturbance before the velocity integrator has to. conf/template/filters.txt loads it (opt-in, link filters after link pmsm) between biquad0 and the torque controller, passing through (k 0) until set; conf/fanuc_a3-3000.txt links it with k 1 and the friction feedforward off. The wiring, by hand or as in the template:

  • dob0.in = pid0.torque_cmd (the template: biquad0.out)
  • pmsm_ttc0.torque = dob0.out
  • dob0.vel = vel1.vel, the velocity observer pid0 uses
  • vel1.torque = dob0.out (and vel2.torque), so the velocity observers see the compensated torque
  • dob0.j set to the total inertia conf0.j + conf0.j_sys, as pid0 uses it (j_mot + j_sys)
  • dob0.en has to be linked or set: unlinked it is 0 and dob only passes in through

Component Explanation #

All work is done in rt.

  1. Model:
  • Rigid body: j * dw/dt = u + d, so d = j * dw/dt - u.
  • w is the observer velocity vel (vel1, which already filters the encoder at its loop bandwidth); (w - last w) / period is the acceleration caused by the torque u of the step before, where u is the previous out (the compensated command). An earlier version differenced the raw position twice: with an 8000 count encoder that left about 0.4 Nm rms on d_est at bw 50 (upstream review), the observer velocity about a fifth of it.
  • d is low passed at bw into d_est (bw 0 = no filter). Default 20 Hz (upstream review): on the Y plant 50 Hz cuts the load step error by about a third (4.5 against 6.7 mrad for a 2 Nm step) at 2.5 times the estimate noise; set it per axis.
  1. Compensation:
  • out = in - k * d_est, with k * d_est clamped to +-max when max > 0. The template links max to the torque limit conf0.max_force, so the compensation can never exceed what the drive may apply; a smaller value bounds the load share dob takes.
  • k 0 only estimates (d_est is still valid, out = in), k 1 is full compensation.
  1. Enable and start:
  • While en <= 0 or j <= 0 (the default): out = in, d_est = 0, and the last position, velocity and torque keep following, so enabling (or setting j) starts clean.
  • After power up or enabling it waits one rt step for a previous velocity sample before estimating.
  1. Standstill hold (hold, linked to pid0.hold with pid0.hold_en 2):
  • With stiction the estimate freezes at whatever the last move left (on a vertical axis gravity plus or minus the friction, so the standing current depends on the direction of the last move).
  • While hold is 1 (pid0 at rest, position error inside its hold window) the estimate stops and the compensation slews at hold_rate so that out moves to hold_o (the moving offset conf0.o, about 0 on a horizontal axis). d_est follows the compensation, so the estimate goes on from there when the hold ends. If the axis creeps out of the window the hold ends at once.
  • max must leave room for the slew: on Z (o 4.59, f 2.7) max 4 stopped it short, 8 did not.
  1. Results (commit message): in the simulation on the Y axis the load step error was 2.5 to 3 times lower at bw 50 to 100 Hz, 200 Hz oscillated. On the Y axis bench, with the friction feedforward off, bw 50 halved the error.

j must be set, or dob stays off. With no inertia the model would read the drive’s own torque command as disturbance (d = -u) and k would cancel it.

Pins #

NameDescription
ininput, Torque command (Nm), pid0.torque_cmd
outoutput, Compensated torque command (Nm)
velinput, Observer velocity (rad/s), vel1.vel
jparameter, Total inertia (kgm^2, default 0 = dob off)
bwparameter, Low pass of the estimate (Hz, default 20, 0 = none)
kparameter, Compensation gain, 0 = estimate only, 1 = full (default 0)
maxparameter, Clamp on the compensation (Nm, default 0 = none), conf0.max_force
d_estoutput, Estimated disturbance torque (Nm), 0 while disabled
eninput, Enable, 0 = pass-through
holdinput, Standstill hold, pid0.hold (with pid0.hold_en 2)
hold_oparameter, Torque the hold moves out to (Nm), conf0.o
hold_rateparameter, Slew rate of out to hold_o (Nm/s), default 20

References #

Source: .c File