feathersdk.robot.actuators.robstride.params Module

Data classes and enums for the Robstride motor parameters/types

class feathersdk.robot.actuators.robstride.params.RobstrideVersion(value)

Bases: UniqueEnum

RS00 = 0
RS01 = 1
RS02 = 2
RS03 = 3
RS04 = 4
RS05 = 5
RS06 = 6
feathersdk.robot.actuators.robstride.params.get_robstride_version(ver)

Get the RobstrideVersion enum from the input. Can pass int, str, or RobstrideVersion.

EG: 2, ‘4’, RobstrideVersion.RS02, ‘RS04’

Parameters:

ver (int | str | RobstrideVersion)

Return type:

RobstrideVersion

class feathersdk.robot.actuators.robstride.params.RobstrideRunMode(value)

Bases: UniqueIntEnum

Operation = 0

Operation Mode

Position = 1

Position Mode (PP)

Velocity = 2

Velocity Mode

Current = 3

Current Mode

CSP = 5

Position Mode (CSP)

class feathersdk.robot.actuators.robstride.params.RobstrideMotorError(value)

Bases: UniqueEnum

Errors that can be returned in the CAN ID of a feedback message.

Positive values are for motor feedback errors, negative values are for fault feedback errors. All errors are powers of 2. So abs(value) is the error bit position.

UnderVoltage = 0
OverCurrent = 1
OverTemperature = 2
MagneticEncoding = 3
GridlockOverload = 4
DriverChipFault = 5
OverVoltage = 6
EncoderNotCalibrated = 7
APhaseOvercurrent = 8
BPhaseOvercurrent = 9
CPhaseOvercurrent = 10
HardwareIdentificationFault = 11
PositionInitializationFault = 12
static parse_motor_feedback_errors(extra_byte)

Parse the errors from the extra byte of the can_id of a feedback message into a bit-packed integer.

Can be unpacked with the RobstrideMotorError.packed_int_to_errors method.

Parameters:

extra_byte (int)

Return type:

int

static parse_fault_feedback_errors(fault_bytes)

Parse the fault feedback errors from the fault feedback message into a bit-packed integer.

Can be unpacked with the RobstrideMotorError.packed_int_to_errors method.

Parameters:

fault_bytes (int)

Return type:

int

static errors_to_packed_int(errors)

Convert an iterable of errors to an integer with the bits set for the errors.

Parameters:

errors (Iterable[RobstrideMotorError])

Return type:

int

static packed_int_to_errors(packed_int)

Convert a packed integer to an iterable of errors.

Parameters:

packed_int (int)

Return type:

Set[RobstrideMotorError]

static max_value()

Get the maximum value for a bit-packed integer of errors.

Return type:

int

class feathersdk.robot.actuators.robstride.params.RobstrideMotorMode(value)

Bases: UniqueIntEnum

Motor modes that can be returned in the CAN ID of a feedback message.

Reset = 0
Calibration = 1
Run = 2
Unknown = 3
static parse_mode(extra_byte)

Parse the mode from the extra byte of the can_id of a feedback message.

Parameters:

extra_byte (int)

Return type:

RobstrideMotorMode

class feathersdk.robot.actuators.robstride.params.RobstrideMotorMsg(value)

Bases: UniqueEnum

GetDeviceId = 0
OperationControl = 1
MotorFeedback = 2
Enable = 3
Disable = 4
ZeroPos = 6
SetID = 7
BeginFlash = 11
FlashFileInfo = 12
FlashData = 13
EndFlash = 14
ReadParam = 17
WriteParam = 18
FaultFeedback = 21
SaveMotorData = 22
SetMotorBaudRate = 23
SetMotorActiveReporting = 24
SetMotorProtocol = 25
class feathersdk.robot.actuators.robstride.params.RobstrideFeedbackMessageBounds

Bases: object

Bounds for the feedback message.

ANGLE_MAP = {RobstrideVersion.RS00: NumericRange(min=-12.566370614359172, max=12.566370614359172), RobstrideVersion.RS01: NumericRange(min=-12.566370614359172, max=12.566370614359172), RobstrideVersion.RS02: NumericRange(min=-12.566370614359172, max=12.566370614359172), RobstrideVersion.RS03: NumericRange(min=-12.566370614359172, max=12.566370614359172), RobstrideVersion.RS04: NumericRange(min=-12.566370614359172, max=12.566370614359172), RobstrideVersion.RS05: NumericRange(min=-12.566370614359172, max=12.566370614359172), RobstrideVersion.RS06: NumericRange(min=-12.566370614359172, max=12.566370614359172)}
VELOCITY_MAP = {RobstrideVersion.RS00: NumericRange(min=-33.0, max=33.0), RobstrideVersion.RS01: NumericRange(min=-44.0, max=44.0), RobstrideVersion.RS02: NumericRange(min=-44.0, max=44.0), RobstrideVersion.RS03: NumericRange(min=-20.0, max=20.0), RobstrideVersion.RS04: NumericRange(min=-15.0, max=15.0), RobstrideVersion.RS05: NumericRange(min=-50.0, max=50.0), RobstrideVersion.RS06: NumericRange(min=-50.0, max=50.0)}
TORQUE_MAP = {RobstrideVersion.RS00: NumericRange(min=-14.0, max=14.0), RobstrideVersion.RS01: NumericRange(min=-17.0, max=17.0), RobstrideVersion.RS02: NumericRange(min=-17.0, max=17.0), RobstrideVersion.RS03: NumericRange(min=-60.0, max=60.0), RobstrideVersion.RS04: NumericRange(min=-120.0, max=120.0), RobstrideVersion.RS05: NumericRange(min=-5.5, max=5.5), RobstrideVersion.RS06: NumericRange(min=-36.0, max=36.0)}
TEMP_DIVISOR = 10
class feathersdk.robot.actuators.robstride.params.RobstrideOperationCommand(motor, target_torque, target_angle, target_velocity, kp, kd)

Bases: object

Command builder for Robstride motor operation control messages.

Parameters:
  • motor (RobstrideMotor) – The RobstrideMotor instance to send the command to.

  • target_torque (float) – Target torque in Nm. Must be within version-specific torque bounds.

  • target_angle (float) – Target angle in radians. Must be within [-4π, 4π].

  • target_velocity (float) – Target velocity in rad/s. Must be within version-specific velocity bounds.

  • kp (float) – Proportional gain. Must be within version-specific KP bounds.

  • kd (float) – Derivative gain. Must be within version-specific KD bounds.

KP_BOUNDS_MAP = {RobstrideVersion.RS00: NumericRange(min=0.0, max=500.0), RobstrideVersion.RS01: NumericRange(min=0.0, max=500.0), RobstrideVersion.RS02: NumericRange(min=0.0, max=500.0), RobstrideVersion.RS03: NumericRange(min=0.0, max=5000.0), RobstrideVersion.RS04: NumericRange(min=0.0, max=5000.0), RobstrideVersion.RS05: NumericRange(min=0.0, max=500.0), RobstrideVersion.RS06: NumericRange(min=0.0, max=5000.0)}
KD_BOUNDS_MAP = {RobstrideVersion.RS00: NumericRange(min=0.0, max=5.0), RobstrideVersion.RS01: NumericRange(min=0.0, max=5.0), RobstrideVersion.RS02: NumericRange(min=0.0, max=5.0), RobstrideVersion.RS03: NumericRange(min=0.0, max=100.0), RobstrideVersion.RS04: NumericRange(min=0.0, max=100.0), RobstrideVersion.RS05: NumericRange(min=0.0, max=5.0), RobstrideVersion.RS06: NumericRange(min=0.0, max=100.0)}
class feathersdk.robot.actuators.robstride.params.RobstrideParam(*, mode, dtype, telem_capacity=10, name='', itemsize=0, id, default, range, build=<function RobstrideParam.<lambda>>, extract=<function RobstrideParam.<lambda>>, id_bytes=b'')

Bases: TelemetryParameter[~TRobParamVal], Generic[TRobParamVal]

Parameters:
id: int

Parameter ID. Allows negative IDs for params that aren’t used in param commands

default: FrozenEnumKeyedDict[RobstrideVersion, TRobParamVal]

The default value for the parameter.

range: FrozenEnumKeyedDict[RobstrideVersion, NumericRange]

The range of values for the parameter.

build: Callable[[TRobParamVal], bytes]

Builds the data bytes to send to the motor for the parameter

extract: Callable[[bytes], TRobParamVal]

Extracts parameter value from data bytes received from the motor. Assumes the needed bytes start at index 4

id_bytes: bytes

Id param encoded into 4 bytes

is_within_range(value, version)

Checks if value is within the acceptible range for the parameter for the given robstride motor version

Parameters:
Return type:

bool

unpack_and_clamp(data, version)

Unpack the data and clamp it to the range for the parameter.

Parameters:
Return type:

TRobParamVal

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'frozen': False}

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

class feathersdk.robot.actuators.robstride.params.RobstrideParamSet

Bases: TelemetryParameterSet[RobstrideParam, TRobParamVal]

Collection of all Robstride parameters

run_mode: RobstrideParam[RobstrideRunMode] = RobstrideParam.run_mode

position PP, 2: velocity, 3: current)

Type:

Run mode selector (0

Type:

operation, 1

iq_ref: RobstrideParam[float] = RobstrideParam.iq_ref

Current mode Iq command (A)

spd_ref: RobstrideParam[float] = RobstrideParam.spd_ref

Velocity mode rotational speed command (rad/s)

limit_torque: RobstrideParam[float] = RobstrideParam.limit_torque

Torque limit (Nm)

cur_kp: RobstrideParam[float] = RobstrideParam.cur_kp

Current loop Kp

cur_ki: RobstrideParam[float] = RobstrideParam.cur_ki

Current loop Ki

cur_filt_gain: RobstrideParam[float] = RobstrideParam.cur_filt_gain

Current loop filter gain

loc_ref: RobstrideParam[float] = RobstrideParam.loc_ref

Position mode angle command (rad)

limit_spd: RobstrideParam[float] = RobstrideParam.limit_spd

CSP mode speed limit (rad/s)

limit_cur: RobstrideParam[float] = RobstrideParam.limit_cur

Velocity/position mode current limit (A)

mech_pos: RobstrideParam[float] = RobstrideParam.mech_pos

Mechanical angle of the loading coil (rad)

iqf: RobstrideParam[float] = RobstrideParam.iqf

Iq filter value (A)

mech_vel: RobstrideParam[float] = RobstrideParam.mech_vel

Load speed (rad/s)

vbus: RobstrideParam[float] = RobstrideParam.vbus

Bus voltage (V)

loc_kp: RobstrideParam[float] = RobstrideParam.loc_kp

Position loop Kp

spd_kp: RobstrideParam[float] = RobstrideParam.spd_kp

Velocity loop Kp

spd_ki: RobstrideParam[float] = RobstrideParam.spd_ki

Velocity loop Ki

spd_filt_gain: RobstrideParam[float] = RobstrideParam.spd_filt_gain

Speed filter gain

acc_rad: RobstrideParam[float] = RobstrideParam.acc_rad

Velocity mode acceleration (rad/s^2)

vel_max: RobstrideParam[float] = RobstrideParam.vel_max

PP mode speed (rad/s)

acc_set: RobstrideParam[float] = RobstrideParam.acc_set

PP mode acceleration (rad/s^2)

epscan_time: RobstrideParam[int] = RobstrideParam.epscan_time

Active report interval (1 -> 10ms, +1 adds 5ms)

can_timeout: RobstrideParam[int] = RobstrideParam.can_timeout

CAN timeout threshold (20000 = 1s)

zero_sta: RobstrideParam[int] = RobstrideParam.zero_sta

[-pi, pi])

Type:

Zero flag (0

Type:

[0, 2π], 1

damper: RobstrideParam[int] = RobstrideParam.damper

Damping switch

add_offset: RobstrideParam[float] = RobstrideParam.add_offset

Zero offset

mode: RobstrideParam[RobstrideMotorMode] = RobstrideParam.mode

Reset=0, Calibration=1, Run=2, Unknown=3

Type:

Last received motor mode - EG

torque: RobstrideParam[float] = RobstrideParam.torque

Last received torque (Nm)

temp: RobstrideParam[float] = RobstrideParam.temp

Last received temperature (C)

errors: RobstrideParam[int] = RobstrideParam.errors

Last received bit-packed error flags

device_id: RobstrideParam[int] = RobstrideParam.device_id

64-bit device ID

get_param_from_id(id)

Get the parameter from the given ID.

Parameters:

id (int)

Return type:

RobstrideParam

feathersdk.robot.actuators.robstride.params.RPS = <feathersdk.robot.actuators.robstride.params.RobstrideParamSet object>

Robstride parameter set.

feathersdk.robot.actuators.robstride.params.ROBSTRIDE_DIRECTION_PARAMS = {RobstrideParam.loc_ref, RobstrideParam.mech_pos, RobstrideParam.mech_vel, RobstrideParam.spd_ref, RobstrideParam.torque}

Parameters that are affected by the motor’s direction.

feathersdk.robot.actuators.robstride.params.ROBSTRIDE_LOCATION_PARAMS = {RobstrideParam.loc_ref, RobstrideParam.mech_pos}

Parameters that are affected by the motor’s location.

feathersdk.robot.actuators.robstride.params.parse_robstride_can_id(can_id, motor_to_host=True)

Parses the CAN ID into named tuple of (msg_op, motor_id, host_id, extra_byte)

CAN_ID format: [CAN_FLAGS (3 bits)] [MSG_OP (4 bits)] [EXTRA_BYTE (8 bits)] [ID_1 (8 bits)] [ID_2 (8 bits)]

31-29 28-24 23-16 15-8 7-0

The extra_byte value is only used in some robstride messages, such as OperationControl or MotorFeedback frames.

Parameters:
  • can_id (int) – The CAN ID to parse.

  • motor_to_host (bool) – If True, then it is assumed the message is sent from the motor to the host, in which case ID_1 is the motor ID and ID_2 is the host ID. If False, then the reverse is true and ID_1 is the host ID and ID_2 is the motor ID.

Returns:

(msg_op, motor_id, host_id, extra_byte)

Return type:

Tuple[RobstrideMotorMsg, int, int, int]