feathersdk.robot.actuators.robstride.robstride_motor Module

feathersdk.robot.actuators.robstride.robstride_motor.CHECKED_PARAM_TOLERANCE = 0.01

Tolerance for checked parameter values. Some Robstride params are truncated to 16 bits, so they’re not perfect

feathersdk.robot.actuators.robstride.robstride_motor.ROB_FEEDBACK_PARAMS = {RobParamCode.FB_POSITION, RobParamCode.FB_VELOCITY, RobParamCode.FB_TORQUE, RobParamCode.FB_TEMP, RobParamCode.FB_ERRORS, RobParamCode.FB_MODE}

The feedback robstride parameter codes, which all share the same timestamp.

feathersdk.robot.actuators.robstride.robstride_motor.ROB_READABLE_PARAMS = {RobParamCode.RUN_MODE, RobParamCode.IQ_REF, RobParamCode.SPD_REF, RobParamCode.LIMIT_TORQUE, RobParamCode.CUR_KP, RobParamCode.CUR_KI, RobParamCode.CUR_FILT_GAIN, RobParamCode.LOC_REF, RobParamCode.LIMIT_SPD, RobParamCode.LIMIT_CUR, RobParamCode.IQF, RobParamCode.VBUS, RobParamCode.LOC_KP, RobParamCode.SPD_KP, RobParamCode.SPD_KI, RobParamCode.SPD_FILT_GAIN, RobParamCode.ACC_RAD, RobParamCode.VEL_MAX, RobParamCode.ACC_SET, RobParamCode.EPSCAN_TIME, RobParamCode.CAN_TIMEOUT, RobParamCode.ZERO_STA, RobParamCode.DAMPER, RobParamCode.ADD_OFFSET}

The readable robstride parameter codes.

feathersdk.robot.actuators.robstride.robstride_motor.ROB_WRITABLE_PARAMS = {RobParamCode.RUN_MODE, RobParamCode.IQ_REF, RobParamCode.SPD_REF, RobParamCode.LIMIT_TORQUE, RobParamCode.CUR_KP, RobParamCode.CUR_KI, RobParamCode.CUR_FILT_GAIN, RobParamCode.LOC_REF, RobParamCode.LIMIT_SPD, RobParamCode.LIMIT_CUR, RobParamCode.LOC_KP, RobParamCode.SPD_KP, RobParamCode.SPD_KI, RobParamCode.SPD_FILT_GAIN, RobParamCode.ACC_RAD, RobParamCode.VEL_MAX, RobParamCode.ACC_SET, RobParamCode.EPSCAN_TIME, RobParamCode.CAN_TIMEOUT, RobParamCode.ZERO_STA, RobParamCode.DAMPER, RobParamCode.ADD_OFFSET}

The writable robstride parameter codes.

exception feathersdk.robot.actuators.robstride.robstride_motor.IncompatibleRobstrideMotorModeError(*args, **kwargs)

Bases: Exception

Raised when attempting to command a motor with an incompatible run mode.

Parameters:
Return type:

None

class feathersdk.robot.actuators.robstride.robstride_motor.RobstrideMotorConfig(*, name, id, endpoint='', shares_endpoint_with=None, requires_calibration, calibration_timeout=20.0, feedback_delay_threshold=0.1, feedback_delay_warning_interval=10.0, urdf_joint_name='', urdf_link_name='', version, direction, telemetry_size=16384, teensy_telemetry_max_size=300, max_angle_dx, max_torque, max_velocity, max_acceleration=50.0, max_jerk=100.0, angle_range, calibration_config, message_block_timeout=0.3, message_send_attempts=2, loc_kp=4.0, spd_kp=2.0, default_op_kp=8.0, default_op_kd=2.0, gravity_multiplier=1.0, impedance_kp=30.0, impedance_kd=5.0, impedance_position_filt_torque_alpha=0.5, impedance_position_delta_update=0.06981317007977318, impedance_position_min_torque=1.0, impedance_position_d_filter=1.0, impedance_position_max_offset=0.13962634015954636)

Bases: MotorConfig

Configuration for a Robstride motor.

Parameters:
version: RobVersion

The version of the Robstride motor. See RobVersion

direction: Literal[1, -1]

The direction of the motor. 1 for clockwise, -1 for counterclockwise, as seen with the motor’s shaft pointing towards you.

telemetry_size: int

The size of the telemetry buffer for the motor.

teensy_telemetry_max_size: int

Cap sent to the Teensy for each parameter ring. Actual size might be smaller.

max_angle_dx: float

The maximum allowed angle change in motor position before triggering compliance mode.

max_torque: float

The maximum allowed torque the motor can apply in Newtons-meters.

max_velocity: float

The maximum allowed velocity the motor can apply in radians per second.

max_acceleration: float

The maximum allowed acceleration the motor can apply in radians per second squared.

max_jerk: float

The maximum allowed jerk the motor can apply in radians per second cubed.

angle_range: NumericRange

The expected total angle range of the actuator in radians.

calibration_config: RobstrideCalibrationConfig

The config for calibrating the motor.

calibration_timeout: float

The timeout in seconds to wait for the motor to fully calibrate.

message_block_timeout: float

The timeout in seconds to wait for a message to be sent to the motor when blocking.

message_send_attempts: int

The number of attempts to send a message to the motor when awaiting a response.

loc_kp: float

The position mode kp value.

spd_kp: float

The velocity mode kp value, and position-mode speed kp value.

default_op_kp: float

The default operation mode kp value.

default_op_kd: float

The default operation mode kd value.

gravity_multiplier: float

Multiplier to apply to gravity force calculations. Only used on motors having gravity calculated for them, such as arm motors.

impedance_kp: float

The operation mode kp value to use in impedance control.

impedance_kd: float

The operation mode kd value to use in impedance control.

impedance_position_filt_torque_alpha: float

EMA coefficient for residual torque in impedance position mode. 0 = pass-through, 1 = freeze the filter.

impedance_position_delta_update: float

If the impedance setpoint is farther than this from the actual joint (rad), snap it to the joint.

impedance_position_min_torque: float

Deadband on residual torque (Nm) before the impedance setpoint is integrated.

impedance_position_d_filter: float

Divides residual torque to get the impedance setpoint velocity (Nm / (rad/s)).

impedance_position_max_offset: float

Maximum absolute difference between impedance setpoint and actual position (rad).

validate_motor_id()
validate_angle_range_and_homing_offset()
model_config: ClassVar[ConfigDict] = {'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class feathersdk.robot.actuators.robstride.robstride_motor.RobstrideMotorTelemetry(actuator)

Bases: ActuatorTelemetry[RobParamCode]

Telemetry for a Robstride motor.

Parameters:

actuator (RobstrideMotor)

PARAMS

The telemetry and write_param()/read_param() parameters for a Robstride motor.

alias of RobParamCode

get_latest_timestamp(key, default=<SENTINEL>)

Get the latest timestamp of a telemetry parameter by name.

Parameters:
  • key (RobParamCode)

  • default (U)

Return type:

float | U

get_timestamp_at(key, index, default=<SENTINEL>)

Get the timestamp of a telemetry parameter at a given index.

Parameters:
  • key (RobParamCode)

  • index (int)

  • default (U)

Return type:

float | U

class feathersdk.robot.actuators.robstride.robstride_motor.RobstrideMotor(config, *args, **kwargs)

Bases: Motor[RobstrideMotorConfig, RobstrideMotorTelemetry, RobParamCode]

Class to control a Robstride motor.

Parameters:
calibration_state: RobstrideCalibrationState = RobstrideCalibrationState(calibrated=False, calibrated_angle_range=NumericRange(min=-6.283185307179586, max=6.283185307179586), homing_offset=0, calibration_time=6781.006685811)

The current calibration state of the motor.

initialized: bool = False

Whether the motor has been fully initialized (set to True after motor endpoint found and params updated).

get_device_id()

Get the device id of the motor.

If we haven’t read the device id yet, read it from the motor. Otherwise, return the cached value.

Return type:

int

read_device_id(block=False)

Get the device id of the motor.

The id is the 8 CAN data bytes of the broadcast reply, interpreted as a big-endian integer.

Parameters:

block (bool) – If True, block until the id is stored and return it.

Return type:

int | None

get_firmware_version()
Returns the firmware version of the motor in the form “<major>.<version>.<minor>.<micro>”, where <version>

matches the robstride motor version number.

If we haven’t read the firmware version yet, read it from the motor. Otherwise, return the cached value.

Return type:

str

read_firmware_version(block=False)

Read the motor firmware version from the motor.

The Teensy stores the version bytes in FIRMWARE_VERSION telemetry.

It is stored as big-endian bytes in the form: <0x00><0x00><’V’><major><version><minor><micro><0x07>, where <version> matches the robstride motor version number.

If you use block=True, this will return a string in the form “<major>.<version>.<minor>.<micro>”.

Parameters:

block (bool) – If True, block until the version is stored and return it.

Return type:

str | None

enable(block=False)

Send ‘enable’ command to the motor.

Parameters:

block (bool) – If True, block until the response is received and we know the motor is enabled.

Return type:

None

disable(clear_faults=False, block=False)

Send the ‘disable’ command to the motor.

Parameters:
  • clear_faults (bool) – If True, clear the fault bits in the disable command.

  • block (bool) – If True, block until response is received and return it.

Return type:

None

set_skip_write_param_checks(skip, block=True)

Enable/disable Teensy-side write-param range/clamp checks for this motor.

When skip is True, CMD_ROB_WRITE_PARAM skips motor config limits and default param range checks (used during calibration / admin probing). This only affects the Teensy RobMotorConfig.skip_write_param_checks flag — it does not change motor firmware.

Parameters:
  • skip (bool) – If True, skip write-param checks on the Teensy.

  • block (bool) – If True, wait for the Teensy success/error response.

Return type:

None

set_active_reporting(active, scan_time_ms=10, block=False)

Turn on/off active reporting for the motor.

Parameters:
  • active (bool) – If True, turn on active reporting. False to disable.

  • scan_time_ms (int) – Time between feedback messages. Minimum is 10ms, max is 327680ms (about 5.5 mins). Note: The motor only supports multiples of 5ms, so actual scan time is rounded down to the nearest 5ms.

  • block (bool) – If True, block until the response is received and we’ve checked the value was successfully written.

Return type:

None

zero_position(block=False)

Set the zero position for the motor.

Parameters:

block (bool)

Return type:

None

read_param(param, block=False, _await_value=None)

Read a parameter from the motor.

Parameters:
  • param (RobParamCode) – The parameter to read.

  • block (bool) – If True, block until the response is received and return it.

  • _await_value (float | None) – Used internally to await a specific value. Should not be used directly. Will only send one read request and expect the response to be this value.

Return type:

float | None

write_param(param, value, block=False, clamp=False, check=False)

Write a parameter value to the specified motor.

Parameters:
  • param (RobParamCode) – The parameter to write the value to.

  • value (float) – The value to write to the parameter.

  • block (bool) – If True, block until the response is received.

  • clamp (bool) – If True, clamp the value to the range of the parameter.

  • check (bool) – If True, perform a readback to check that the value was successfully written.

Return type:

None

trigger_feedback_frame(update_hz=None, block=False)

Trigger a feedback frame for the motor.

Parameters:
  • update_hz (float | None) – Only trigger the feedback frame if the last feedback frame was more than 1/update_hz seconds ago.

  • block (bool) – If True, block until the response is received and we’ve checked the value was successfully written.

Return type:

None

set_run_mode(run_mode, block=False)

Set the run mode for the specified motor.

Parameters:
  • run_mode (RobRunMode)

  • block (bool)

Return type:

None

set_limit_torque(limit_torque, block=False)

Set the limit torque for the motor. If block, block until the response is received and we’ve checked that the value was successfully written.

Parameters:
Return type:

None

set_target_position(target_position, block=False, await_position=False, await_timeout=1.0)
Set the target position for this motor. If block, block until the response is received and we’ve

checked that the value was successfully written.

Parameters:
  • target_position (float) – The target position to set in radians.

  • block (bool) – If True, block until the response is received and we’ve checked the value was successfully written.

  • await_position (bool) – If True, wait for the motor to reach the target position.

  • await_timeout (float) – The timeout in seconds to wait for the motor to reach the target position.

Return type:

None

set_target_velocity(target_velocity, block=False)

Set the target velocity for this motor. If block, block until the response is received and we’ve checked that the value was successfully written.

Parameters:
Return type:

None

set_target_acceleration(target_acceleration, block=False)

Set the target acceleration for this motor. If block, block until the response is received and we’ve checked that the value was successfully written.

Parameters:
Return type:

None

set_target_current(target_current, block=False)

Set the target current for this motor. If block, block until the response is received and we’ve checked that the value was successfully written.

Parameters:
Return type:

None

operation_command(torque, angle, velocity, kp, kd, clamp=False)

Send an operation control command to the motor.

Parameters:
  • torque (float) – The target torque in Newtons-meters.

  • angle (float) – The target angle in radians.

  • velocity (float) – The target velocity in radians per second.

  • kp (float) – The proportional gain.

  • kd (float) – The derivative gain.

  • clamp (bool) – If True, clamp the values to the range. Will not clamp if force is True.

Return type:

None

await_param(param, value, abs_tol, check_errors=False, torque_limit=None, timeout=1.0)

Await a parameter to reach a value within a tolerance. Returns the final value once reached.

Parameters:
  • param (RobParamCode) – The parameter to await.

  • value (float) – The value to wait for param to reach.

  • abs_tol (float) – The absolute tolerance for the value to be considered reached.

  • check_errors (bool) – If True, check that no motor errors occur during the wait. If errors are found, an error will be raised.

  • torque_limit (float | None) – The torque limit to check. If None, don’t check. Otherwise if the torque limit is exceeded, an error will be raised.

  • timeout (float) – The timeout in seconds to wait for the parameter to reach the value.

Return type:

float