rebot_control.model

Kinematic and dynamic model of the arm + tool (Pinocchio).

One RobotModel holds the Pinocchio model built from the arm URDF, with

  • a tcp frame attached to the flange at the tool’s TCP pose;

  • the tool payload added to the flange body’s inertia;

  • optionally, identified link masses / centres of mass (rebot_control.config.Calibration).

Pinocchio Data objects are not thread safe: every thread that evaluates the model (the servo thread, the caller’s thread) uses its own, from RobotModel.new_data().

Module Contents

Classes

Data

API

rebot_control.model.LWA = None
rebot_control.model.N_PARAMS = 10
class rebot_control.model.RobotModel(cfg: rebot_control.config.ArmConfig, tool: rebot_control.config.ToolConfig | None = None, calibration: rebot_control.config.Calibration | None = None)

Initialization

Name of the URDF link moved by joint joint_id (1-based Pinocchio joint id).

Replace the mass and COM of links ({link: {"mass": m, "com": [x, y, z]}}, COM in the link frame).

The rotational inertia about the COM is kept from the URDF. Links are matched by URDF link name.

set_tool(tool: rebot_control.config.ToolConfig) → None

Attach a tool: TCP frame on the flange + payload inertia. Safe to call again to swap tools.

payload_inertia() → pinocchio.Inertia

Tool payload as a Pinocchio inertia in the flange joint frame.

new_data() → pinocchio.Data
fk(q: numpy.ndarray, data: pinocchio.Data | None = None, frame: int | str | None = None) → tuple[numpy.ndarray, numpy.ndarray]

Pose (p, R) of the TCP (default) or of another frame, in the base frame.

flange_pose(q: numpy.ndarray, data: pinocchio.Data | None = None) → tuple[numpy.ndarray, numpy.ndarray]
jacobian(q: numpy.ndarray, data: pinocchio.Data | None = None, frame: int | None = None) → numpy.ndarray

6 x n Jacobian of the TCP (or frame): rows = [linear; angular] velocity in the base frame.

Origins of all joint frames + the TCP (k x 3), for simple workspace / table-clearance checks.

gravity(q: numpy.ndarray, data: pinocchio.Data | None = None) → numpy.ndarray

Joint torques (N*m) that hold the arm + payload against gravity at q.

mass_matrix(q: numpy.ndarray, data: pinocchio.Data | None = None, rotor: bool = True) → numpy.ndarray
regressor(q: numpy.ndarray, dq: numpy.ndarray | None = None, ddq: numpy.ndarray | None = None, data: pinocchio.Data | None = None) → numpy.ndarray

Joint torque regressor Y (n x 10 n): tau = Y @ params with dynamic_params() ordering.

dynamic_params() → numpy.ndarray

Stacked per-body dynamic parameters (10 per joint, Pinocchio Inertia.toDynamicParameters order).

static_torque(q: numpy.ndarray, data: pinocchio.Data | None = None) → numpy.ndarray

Same as gravity(), via the regressor (used to check consistency in tests).