rebot_control.calib.gravity

Gravity and payload identification from static poses.

Data (collect_static()): at each pose the arm holds still (HOLD mode) and the torque reported by the motors is averaged. Each pose is approached once from above and once from below (approach): static friction makes the holding torque depend on the approach direction, and averaging both sides cancels it to first order.

Model: at rest tau = Y(q) theta + b, with Y the static part of the joint torque regressor (Pinocchio) and theta the mass and first moment m, m*c (4 parameters) of every body. Only some combinations of theta are identifiable from static data; the fit is a MAP / ridge estimate around the prior (URDF or previous calibration), so unidentifiable directions stay at the prior instead of drifting. b is a per-joint torque offset (motor torque estimate bias, cable forces), fitted but not used for control.

  • fit_gravity(): all link masses / centres of mass (tool attached or not; the tool payload from the tool config is subtracted from the flange body).

  • fit_payload(): only the tool payload (mass + centre of mass) with the arm links fixed.

Module Contents

Classes

Functions

collect_static

Visit poses and record the averaged joint angles and torques at rest, from both approach sides.

static_columns

static_regressor

Stacked static regressors, shape (N * n, 4 n).

fit_gravity

MAP fit of every body’s mass and first moment around the current model (see the module docstring).

fit_payload

Least-squares payload (m, m*c) with the arm link parameters fixed (calibrate gravity first).

gravity_residual

Per-joint RMS of measured - predicted static torque (N*m) for the current model.

Data

API

rebot_control.calib.gravity.log = 'getLogger(...)'
rebot_control.calib.gravity.STATIC = 4
rebot_control.calib.gravity.collect_static(arm, poses: numpy.ndarray, approach: float = np.radians(3.0), settle_s: float = 1.0, average_s: float = 0.5, speed: float | None = None, progress: collections.abc.Callable[[str], None] = print) → dict[str, numpy.ndarray]

Visit poses and record the averaged joint angles and torques at rest, from both approach sides.

Returns {"q": (2N, n), "tau": (2N, n), "tau_std": (2N, n), "side": (2N,)}.

rebot_control.calib.gravity.static_columns(n: int) → numpy.ndarray
rebot_control.calib.gravity.static_regressor(model: rebot_control.model.RobotModel, qs: numpy.ndarray, data=None) → numpy.ndarray

Stacked static regressors, shape (N * n, 4 n).

class rebot_control.calib.gravity.GravityFit
bias: numpy.ndarray = None
rms_before: numpy.ndarray = None
rms_after: numpy.ndarray = None
theta: numpy.ndarray = None
info: dict = 'field(...)'
summary(joints: list[str]) → str
rebot_control.calib.gravity.fit_gravity(model: rebot_control.model.RobotModel, data: dict[str, numpy.ndarray], prior_rel: float = 0.3, prior_abs_kg: float = 0.02, lever_m: float = 0.05, bias_std: float = 0.5, noise_std: float = 0.05, fit_bias: bool = True) → rebot_control.calib.gravity.GravityFit

MAP fit of every body’s mass and first moment around the current model (see the module docstring).

Prior standard deviations: mass prior_rel * m0 + prior_abs_kg, first moment that times lever_m; torque noise noise_std. Lower prior_rel to trust the URDF more.

class rebot_control.calib.gravity.PayloadFit
mass: float = None
com: numpy.ndarray = None
bias: numpy.ndarray = None
rms_before: numpy.ndarray = None
rms_after: numpy.ndarray = None
summary() → str
rebot_control.calib.gravity.fit_payload(model: rebot_control.model.RobotModel, data: dict[str, numpy.ndarray], fit_bias: bool = False, ridge: float = 1e-06) → rebot_control.calib.gravity.PayloadFit

Least-squares payload (m, m*c) with the arm link parameters fixed (calibrate gravity first).

rebot_control.calib.gravity.gravity_residual(model: rebot_control.model.RobotModel, data: dict[str, numpy.ndarray]) → numpy.ndarray

Per-joint RMS of measured - predicted static torque (N*m) for the current model.

rebot_control.calib.gravity.__all__ = ['GravityFit', 'PayloadFit', 'collect_static', 'fit_gravity', 'fit_payload', 'gravity_residual', 'st...