Reference/API

Target configs

Each config builds one robot or viewer target. See the Targets pages for hardware setup.

retargetingkit.targets.arms.xarm6.XArm6Config(
ip: str,
mode: XArmMode = XArmMode.VELOCITY,
dt: float = 1.0 / 250,
ee_link: str = XARM6_EE_LINK,
kp: np.ndarray = (lambda: np.array([10.0, 10.0, 5.0, 5.0, 5.0, 5.0]))(),
kd: np.ndarray = (lambda: np.array([0.5, 0.5, 0.25, 0.25, 0.25, 0.25]))(),
max_velocity: np.ndarray = (lambda: np.array([0.8, 0.8, 0.8, 1.0, 1.0, 3.0]))()
)
Bases: TargetConfig

xArm6 controller configuration.

Parameters
ipstrrequired
modeXArmMode= XArmMode.VELOCITY
dtfloat= 1.0 / 250
ee_linkstr= XARM6_EE_LINK
kpnp.ndarray= (lambda: np.array([10.0, 10.0, 5.0, 5.0, 5.0, 5.0]))()
kdnp.ndarray= (lambda: np.array([0.5, 0.5, 0.25, 0.25, 0.25, 0.25]))()
max_velocitynp.ndarray= (lambda: np.array([0.8, 0.8, 0.8, 1.0, 1.0, 3.0]))()
Members
attribute[source]
XArm6Config.ip: str

IP address of the xArm controller.

attribute[source]
XArm6Config.mode: XArmMode = XArmMode.VELOCITY

Control mode.

attribute[source]
XArm6Config.dt: float = 1.0 / 250

Servo loop timestep in seconds.

attribute[source]
XArm6Config.kp: np.ndarray = field(default_factory=lambda: np.array([10.0, 10.0, 5.0, 5.0, 5.0, 5.0]))

Proportional gains for velocity mode.

attribute[source]
XArm6Config.kd: np.ndarray = field(default_factory=lambda: np.array([0.5, 0.5, 0.25, 0.25, 0.25, 0.25]))

Derivative gains for velocity mode.

attribute[source]
XArm6Config.max_velocity: np.ndarray = field(default_factory=lambda: np.array([0.8, 0.8, 0.8, 1.0, 1.0, 3.0]))

Maximum joint velocities (rad/s), used by both SERVO and VELOCITY modes.

method[source]
XArm6Config.build() -> XArm6
Returns
XArm6
retargetingkit.targets.arms.xarm7.XArm7Config(
ip: str,
mode: XArmMode = XArmMode.VELOCITY,
dt: float = 1.0 / 250,
ee_link: str = XARM7_EE_LINK,
kp: np.ndarray = (lambda: np.array([10.0, 10.0, 5.0, 5.0, 5.0, 5.0, 5.0]))(),
kd: np.ndarray = (lambda: np.array([0.5, 0.5, 0.25, 0.25, 0.25, 0.25, 0.25]))(),
max_velocity: np.ndarray = (lambda: np.array([0.8, 0.8, 0.8, 0.8, 1.0, 1.0, 3.0]))()
)
Bases: TargetConfig

xArm7 controller configuration.

Parameters
ipstrrequired
modeXArmMode= XArmMode.VELOCITY
dtfloat= 1.0 / 250
ee_linkstr= XARM7_EE_LINK
kpnp.ndarray= (lambda: np.array([10.0, 10.0, 5.0, 5.0, 5.0, 5.0, 5.0]))()
kdnp.ndarray= (lambda: np.array([0.5, 0.5, 0.25, 0.25, 0.25, 0.25, 0.25]))()
max_velocitynp.ndarray= (lambda: np.array([0.8, 0.8, 0.8, 0.8, 1.0, 1.0, 3.0]))()
Members
attribute[source]
XArm7Config.ip: str

IP address of the xArm controller.

attribute[source]
XArm7Config.mode: XArmMode = XArmMode.VELOCITY

Control mode.

attribute[source]
XArm7Config.dt: float = 1.0 / 250

Servo loop timestep in seconds.

attribute[source]
XArm7Config.kp: np.ndarray = field(default_factory=lambda: np.array([10.0, 10.0, 5.0, 5.0, 5.0, 5.0, 5.0]))

Proportional gains for velocity mode.

attribute[source]
XArm7Config.kd: np.ndarray = field(default_factory=lambda: np.array([0.5, 0.5, 0.25, 0.25, 0.25, 0.25, 0.25]))

Derivative gains for velocity mode.

attribute[source]
XArm7Config.max_velocity: np.ndarray = field(default_factory=lambda: np.array([0.8, 0.8, 0.8, 0.8, 1.0, 1.0, 3.0]))

Maximum joint velocities (rad/s), used by both SERVO and VELOCITY modes.

method[source]
XArm7Config.build() -> XArm7
Returns
XArm7
retargetingkit.targets.hands.xhand.XHandConfig(
serial_port: str,
protocol: str = 'RS485',
baud_rate: int = 3000000,
dt: float = 1.0 / 83,
kp: float = 90.0,
ki: float = 0.0,
kd: float = 0.0,
tor_max: float = 80.0
)
Bases: TargetConfig

XHand controller configuration.

Parameters
serial_portstrrequired
protocolstr= 'RS485'
baud_rateint= 3000000
dtfloat= 1.0 / 83
kpfloat= 90.0
kifloat= 0.0
kdfloat= 0.0
tor_maxfloat= 80.0
Members
attribute[source]
XHandConfig.serial_port: str

Serial port for RS485 communication.

attribute[source]
XHandConfig.protocol: str = 'RS485'

Communication protocol ('RS485' or 'EtherCAT').

attribute[source]
XHandConfig.baud_rate: int = 3000000

Baud rate for RS485 serial.

attribute[source]
XHandConfig.dt: float = 1.0 / 83

Servo loop timestep (matches 83 Hz firmware rate).

attribute[source]
XHandConfig.kp: float = 90.0

Default position-loop proportional gain.

attribute[source]
XHandConfig.ki: float = 0.0

Default position-loop integral gain.

attribute[source]
XHandConfig.kd: float = 0.0

Default position-loop derivative gain.

attribute[source]
XHandConfig.tor_max: float = 80.0

Default maximum torque.

method[source]
XHandConfig.build() -> XHand
Returns
XHand
retargetingkit.targets.hands.sharpa_hand.SharpaHandConfig(
speed_coeff: float = 0.3,
current_coeff: float = 0.3,
device_sn: str | None = None
)
Bases: TargetConfig

Sharpa Wave connection settings.

Parameters
speed_coefffloat= 0.3
current_coefffloat= 0.3
device_snstr | None= None
Members
attribute[source]
SharpaHandConfig.speed_coeff: float = 0.3

Joint speed coefficient (0-1).

attribute[source]
SharpaHandConfig.current_coeff: float = 0.3

Joint current coefficient (0-1).

attribute[source]
SharpaHandConfig.device_sn: str | None = None

Serial number; the first discovered hand is used when unset.

method[source]
SharpaHandConfig.build() -> SharpaHand
Returns
SharpaHand
retargetingkit.targets.hands.ability_hand.AbilityHandConfig(
port: str,
dt: float = 1.0 / 160,
mode: ControlMode = ControlMode.POS_RAMP,
ramp_deg_per_s: float = 60.0
)
Bases: TargetConfig

Ability Hand controller configuration.

Parameters
portstrrequired
dtfloat= 1.0 / 160
modeControlMode= ControlMode.POS_RAMP
ramp_deg_per_sfloat= 60.0
Members
attribute[source]
AbilityHandConfig.port: str

Serial port path (e.g. /dev/serial/by-id/...).

attribute[source]
AbilityHandConfig.dt: float = 1.0 / 160

Servo loop timestep in seconds.

attribute[source]
AbilityHandConfig.mode: ControlMode = ControlMode.POS_RAMP

Control mode.

attribute[source]
AbilityHandConfig.ramp_deg_per_s: float = 60.0

Position ramp rate to avoid firmware current-limiting stalls.

method[source]
AbilityHandConfig.build() -> AbilityHand
Returns
AbilityHand
retargetingkit.targets.hands.inspire.InspireHandConfig(
serial_port: str,
hand_id: int,
baudrate: int
)
Bases: TargetConfig

Inspire Hand serial settings.

python
>>> InspireHandConfig("/dev/ttyUSB0", 1, 115200).serial_port
'/dev/ttyUSB0'
Parameters
serial_portstrrequired
hand_idintrequired
baudrateintrequired
Members
attribute[source]
InspireHandConfig.serial_port: str
attribute[source]
InspireHandConfig.hand_id: int
attribute[source]
InspireHandConfig.baudrate: int
method[source]
InspireHandConfig.build() -> InspireHand

Connect and return an Inspire Hand target.

python
>>> InspireHandConfig("/dev/ttyUSB0", 1, 115200).build()  # doctest: +SKIP
Returns
InspireHand
retargetingkit.targets.humanoids.sonic.SonicTargetConfig(
host: str = '*',
port: int = 5556,
lookahead: int = 50
)
Bases: TargetConfig

SONIC v1 publisher settings.

python
>>> SonicTargetConfig().port
5556
Parameters
hoststr= '*'
portint= 5556
lookaheadint= 50
Members
attribute[source]
SonicTargetConfig.host: str = '*'
attribute[source]
SonicTargetConfig.port: int = 5556
attribute[source]
SonicTargetConfig.lookahead: int = 50
method[source]
SonicTargetConfig.build() -> SonicTarget

Bind and return a SONIC target.

python
>>> SonicTargetConfig(port=15556).build()  # doctest: +SKIP
Returns
SonicTarget
retargetingkit.targets.humanoids.rby1.RBY1AConfig(
ip: str,
mode: RBY1AMode = RBY1AMode.VELOCITY,
dt: float = 1.0 / 100,
ee_link: str = 'link_right_arm_6',
cutoff_frequency: float = 5.0,
kp: np.ndarray = (lambda: np.array([10.0, 10.0, 5.0, 5.0, 5.0, 5.0, 5.0]))(),
kd: np.ndarray = (lambda: np.array([0.5, 0.5, 0.25, 0.25, 0.25, 0.25, 0.25]))(),
max_velocity: np.ndarray = (lambda: np.array([0.8, 0.8, 0.8, 0.8, 1.0, 1.0, 3.0]))(),
home_qpos: np.ndarray = (lambda: np.array([0, 0, 0, -np.pi / 2, -np.pi / 2, 0, 0]))(),
head_max_velocity: np.ndarray = (lambda: np.array([1.0, 1.0]))(),
head_home_qpos: np.ndarray = (lambda: np.zeros(NUM_HEAD_JOINTS))()
)
Bases: TargetConfig

RBY1-A right-arm controller configuration.

Parameters
ipstrrequired
modeRBY1AMode= RBY1AMode.VELOCITY
dtfloat= 1.0 / 100
ee_linkstr= 'link_right_arm_6'
cutoff_frequencyfloat= 5.0
kpnp.ndarray= (lambda: np.array([10.0, 10.0, 5.0, 5.0, 5.0, 5.0, 5.0]))()
kdnp.ndarray= (lambda: np.array([0.5, 0.5, 0.25, 0.25, 0.25, 0.25, 0.25]))()
max_velocitynp.ndarray= (lambda: np.array([0.8, 0.8, 0.8, 0.8, 1.0, 1.0, 3.0]))()
home_qposnp.ndarray= (lambda: np.array([0, 0, 0, -np.pi / 2, -np.pi / 2, 0, 0]))()
head_max_velocitynp.ndarray= (lambda: np.array([1.0, 1.0]))()
head_home_qposnp.ndarray= (lambda: np.zeros(NUM_HEAD_JOINTS))()
Members
attribute[source]
RBY1AConfig.ip: str

IP address with port (e.g. 192.168.30.1:50051).

attribute[source]
RBY1AConfig.mode: RBY1AMode = RBY1AMode.VELOCITY

Control mode.

attribute[source]
RBY1AConfig.dt: float = 1.0 / 100

Servo loop timestep in seconds.

attribute[source]
RBY1AConfig.cutoff_frequency: float = 5.0

SDK-side position command smoothing frequency (Hz).

attribute[source]
RBY1AConfig.kp: np.ndarray = field(default_factory=lambda: np.array([10.0, 10.0, 5.0, 5.0, 5.0, 5.0, 5.0]))

Proportional gains for velocity mode.

attribute[source]
RBY1AConfig.kd: np.ndarray = field(default_factory=lambda: np.array([0.5, 0.5, 0.25, 0.25, 0.25, 0.25, 0.25]))

Derivative gains for velocity mode.

attribute[source]
RBY1AConfig.max_velocity: np.ndarray = field(default_factory=lambda: np.array([0.8, 0.8, 0.8, 0.8, 1.0, 1.0, 3.0]))

Maximum joint velocities (rad/s), used by both SERVO and VELOCITY modes.

attribute[source]
RBY1AConfig.home_qpos: np.ndarray = field(default_factory=lambda: np.array([0, 0, 0, -np.pi / 2, -np.pi / 2, 0, 0]))

Target joint positions for the home configuration (rad).

attribute[source]
RBY1AConfig.head_max_velocity: np.ndarray = field(default_factory=lambda: np.array([1.0, 1.0]))

Maximum head joint velocities (rad/s).

attribute[source]
RBY1AConfig.head_home_qpos: np.ndarray = field(default_factory=lambda: np.zeros(NUM_HEAD_JOINTS))

Target head joint positions for the home configuration (rad).

method[source]
RBY1AConfig.build() -> RBY1A

Connect to the robot and start its servo loop.

python
>>> RBY1AConfig("192.168.30.1:50051").build()  # doctest: +SKIP
Returns
RBY1A
retargetingkit.targets.humanoids.dexmate.DexmateConfig(
auto_shutdown: bool = True
)
Bases: TargetConfig

Dexmate Vega-1 whole-body controller configuration.

Parameters
auto_shutdownbool= True
Members
attribute[source]
DexmateConfig.auto_shutdown: bool = True

Register the SDK's atexit shutdown hook. Disable when the caller owns shutdown via close.

method[source]
DexmateConfig.build() -> Dexmate

Connect to the robot.

python
>>> DexmateConfig().build()  # doctest: +SKIP
Returns
Dexmate
retargetingkit.targets.viser.ViserConfig(
urdfs: tuple[Path, ...],
keypoint_edges: tuple[tuple[int, int], ...] = ()
)
Bases: TargetConfig

URDFs to display, in the order callers index them.

python
>>> ViserConfig((Path("robot.urdf"),)).urdfs[0].name
'robot.urdf'
Parameters
urdfstuple[Path, ...]required
keypoint_edgestuple[tuple[int, int], ...]= ()
Members
attribute[source]
ViserConfig.urdfs: tuple[Path, ...]
attribute[source]
ViserConfig.keypoint_edges: tuple[tuple[int, int], ...] = ()
method[source]
ViserConfig.build() -> Viser

Start the Viser server.

python
>>> ViserConfig((Path("robot.urdf"),)).build()  # doctest: +SKIP
Returns
Viser