Skip to main content
MotorCommands builds actions from joint names. Joint names are resolved from any RobotConfig’s joint list, so there are no hardcoded indices in policy code.

Construct

cmd = rfx.MotorCommands(
    {"gripper": 0.8, "elbow": -0.3},
    config=rfx.SO101_CONFIG,
)

Convert

action = cmd.to_tensor()               # shape: (1, action_dim)
positions = cmd.to_list()              # flat list, length = action_dim

# Batched
action = cmd.to_tensor(batch_size=4)   # shape: (4, action_dim)

Factory

cmd = rfx.MotorCommands.from_positions(
    {"elbow": 1.0},
    config=rfx.SO101_CONFIG,
    kp=30.0,
)

Why it exists

Hardcoded tensor indices are a bug source every time a robot config changes. MotorCommands pins joint names as the contract, so:
  • Swapping a SO-101 for a different 6-DOF arm only requires a new config, not a policy rewrite.
  • Adding a joint does not shift the meaning of existing indices.
  • Policy code reads like intent, not like array plumbing.