Skip to main content

API: Mode and State

Mode Enum

The Mode enum defines the available control modes for motors.

Import

Definition

Mode Descriptions

Mode Details

Mode.MIT

MIT mode provides full impedance control with independent control over:
  • Position target
  • Velocity target
  • Position stiffness (Kp)
  • Velocity damping (Kd)
  • Feedforward torque
Command: motor.send_mit(pos, vel, kp, kd, tau) Best for:
  • Legged robots requiring compliant control
  • Arms with variable stiffness
  • Haptic feedback applications
Example:

Mode.POS_VEL

Position control with velocity limit. Motor moves to target position at limited speed. Command: motor.send_pos_vel(pos, vlim) Best for:
  • Simple point-to-point motion
  • Applications needing speed limits
  • Beginner-friendly control
Example:
RobStride PP / CSP: RobStride also exposes robstride_send_pos_vel_pp (Profile Position) and robstride_send_pos_vel_csp (Cyclic Synchronous Position), which follow the vendor manual PP/CSP sequences. For high-rate loops, use a prepared profile and write loc_ref directly each cycle to avoid an enable ACK wait every control cycle.

Mode.VEL

Pure velocity control. Motor runs at commanded velocity indefinitely. Command: motor.send_vel(vel) Best for:
  • Conveyor belts
  • Wheels and drivetrains
  • Speed-controlled applications
Example:

Mode.FORCE_POS

Compliant position control with force ratio. Motor moves to position but limits applied force. Command: motor.send_force_pos(pos, vlim, ratio) Best for:
  • Grippers with force control
  • Contact tasks
  • Safety-critical applications
Example:

Vendor Mode Support

Attempting to use an unsupported mode will raise a CallError or ValueError.

MotorState Dataclass

MotorState is an immutable dataclass containing motor feedback data.

Import

Definition

Field Descriptions

Usage Example

Use request_feedback() + get_state() directly in the loop. No extra “status name” query call is required by the Python binding.
RobStride state semantics: the unified request_feedback() ABI call is a non-blocking no-op for RobStride; ping replies do not synthesize a MotorState, so request_feedback() -> get_state() will not appear to refresh state when it cannot. Use the correct query for your goal:
  • robstride_ping() for connectivity checks,
  • active report (robstride_set_active_report) for streaming state,
  • typed parameter reads (robstride_get_param_*) for fresh position/velocity.
Mode-aware controlled stop: handle_stop is hardened and performs a mode-aware controlled stop instead of a bare disable.

Status Code Interpretation

Status codes are vendor-specific. Common patterns:

Damiao Status Codes

Checking Status


Retry Pattern for State Reading

Since feedback is asynchronous, implement a retry pattern:

Complete Example

See Also