rebot_control.backends.sim

Simulated arm: MuJoCo physics of the same Pinocchio model (pip install rebot-control[sim]).

The MuJoCo model is generated from rebot_control.model.RobotModel (bodies, joint axes, inertias, payload), so kinematics and dynamics match the controller’s model exactly unless a different “truth” is given on purpose (truth_link_params / truth_tool), which is how the calibration tools are tested.

The motors are emulated at the physics rate: each step applies tau = kp (q* - q) + kd (dq* - dq) + tau_ff clipped to the URDF effort limit, like the MIT loop inside a RobStride driver. Joint damping and dry friction come from sim: in the arm config. The arm itself has no collision geometry (no table, no self-collision): on its own the simulator is for checking control logic, not contact.

A scene can be added around the arm with scene=: a function that receives the mujoco.MjSpec after the arm has been built and adds what it likes to it (floor, objects with free joints, collision geometry on the tool, cameras, lights). The arm’s joints stay the first n degrees of freedom, and the backend only ever touches those. The spec takes inertias from the bodies, not from their geoms (inertiafromgeom is off), so a moving body added by the scene needs mass, ipos, inertia and explicitinertial = True (without ipos MuJoCo puts the centre of mass at an offset equal to the body’s position).

Time is simulation time: nothing runs in a background thread; rebot_control.arm.Arm.sleep() advances the physics tick by tick.

Module Contents

Classes

Functions

build_mjspec

MuJoCo spec of the arm + tool from the Pinocchio model (no actuators: torques go through qfrc_applied).

API

rebot_control.backends.sim.build_mjspec(model: rebot_control.model.RobotModel, cfg: rebot_control.config.ArmConfig)

MuJoCo spec of the arm + tool from the Pinocchio model (no actuators: torques go through qfrc_applied).

class rebot_control.backends.sim.SimBackend(cfg: rebot_control.config.ArmConfig, tool: rebot_control.config.ToolConfig | None = None, calibration: rebot_control.config.Calibration | None = None, truth_link_params: dict | None = None, truth_tool: rebot_control.config.ToolConfig | None = None, truth_friction: dict | None = None, truth_ripple: dict | None = None, q0: numpy.ndarray | None = None, seed: int = 0, viewer: bool = False, realtime: bool | None = None, scene: collections.abc.Callable | None = None)

Bases: rebot_control.backends.base.Backend

is_sim = True
connect() → None
close(disable: bool = True) → None
read_positions() → numpy.ndarray
enable() → None
disable() → None
send_mit(q, dq, kp, kd, tau) → None
read() → rebot_control.backends.base.JointState
now() → float
advance(dt: float) → None
set_zero(joints: list[int]) → None
set_q(q: numpy.ndarray) → None

Teleport the simulated arm (tests).