firmware.robstride_motors package

Submodules

firmware.robstride_motors.client module

RobStride Robot Client.

Adapted from the Robstride Python SDK here: https://github.com/sirwart/robstride.

class firmware.robstride_motors.client.Client(bus, retry_count=2, recv_timeout=2, host_can_id=170)[source]

Bases: object

disable(motor_id, motor_model=1)[source]
Return type:

FeedbackResp

enable(motor_id, motor_model=1)[source]
Return type:

FeedbackResp

error_rate()[source]
Return type:

float

get_motor_info(motor_id)[source]
Return type:

bytearray

read_param(motor_id, param_id)[source]
Return type:

float | RunMode

update_id(motor_id, new_motor_id)[source]
Return type:

None

use_control_mode(motor_id, torque, velocity, position, kp, kd)[source]
Return type:

None

write_param(motor_id, param_id, param_value, motor_model=1)[source]
Return type:

FeedbackResp

zero_pos(motor_id, motor_model=1)[source]
Return type:

FeedbackResp

class firmware.robstride_motors.client.FeedbackResp(servo_id, errors, mode, angle, velocity, torque, temp)[source]

Bases: object

angle: float
errors: List[MotorError]
mode: MotorMode
servo_id: int
temp: float
torque: float
velocity: float
class firmware.robstride_motors.client.MotorError(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

HallEncodingFault = 16
MagneticEncodingFault = 8
Overcurrent = 2
Overtemp = 4
Uncalibrated = 32
Undervoltage = 1
class firmware.robstride_motors.client.MotorMode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Calibration = 1
Reset = 0
Run = 2
class firmware.robstride_motors.client.MotorMsg(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Control = 1
Disable = 4
Enable = 3
Feedback = 2
Info = 0
ReadParam = 17
SetID = 7
WriteParam = 18
ZeroPos = 6
class firmware.robstride_motors.client.RunMode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Current = 3
Operation = 0
Position = 1
Speed = 2

firmware.robstride_motors.model module

Defines the motor model but with Robstride motors instead.

TODO: Merge models into one generic model.

class firmware.robstride_motors.model.Arm(rotator_cuff, shoulder, bicep, elbow, wrist, gripper)[source]

Bases: object

bicep: RobstrideMotor
elbow: RobstrideMotor
gripper: RobstrideMotor
property motor_ids: list[int]
property motors: list[RobstrideMotor]
rotator_cuff: RobstrideMotor
shoulder: RobstrideMotor
wrist: RobstrideMotor
class firmware.robstride_motors.model.Body(left_arm=None, right_arm=None, left_leg=None, right_leg=None)[source]

Bases: object

left_arm: Optional[Arm] = None
left_leg: Optional[Leg] = None
property motor_ids: list[int]
right_arm: Optional[Arm] = None
right_leg: Optional[Leg] = None
class firmware.robstride_motors.model.Leg(pelvis, hip, thigh, knee, ankle, foot)[source]

Bases: object

ankle: RobstrideMotor
foot: RobstrideMotor
hip: RobstrideMotor
knee: RobstrideMotor
property motor_ids: list[int]
property motors: list[RobstrideMotor]
pelvis: RobstrideMotor
thigh: RobstrideMotor

firmware.robstride_motors.motors module

Defines a class that dictates how to communicate with the motors.

Modified to work with Robstride motors. TODO: create a generic motor class that can work with any motor type.

class firmware.robstride_motors.motors.RobstrideMotor(motor_id, control_params, client)[source]

Bases: MotorInterface

A class to interface with a motor over a CAN bus.

CALIBRATION_SPEED = 0.5
calibrate(current_limit=10)[source]

Calibrates the motor assuming the existence of hard stops.

Args: current_limit: The current limit to use during calibration.

Return type:

None

disable()[source]
Return type:

None

enable()[source]
Return type:

None

get_current()[source]

Updates the value of the motor’s current attribute.

Parameters:
  • wait_time – how long to wait for a response from the motor

  • read_only – whether to read the current value or not

Return type:

float

Returns:

“Valid” if the message is valid, “Invalid” otherwise

get_position()[source]

Updates the value of the motor’s position attribute.

Parameters:
  • wait_time – how long to wait for a response from the motor

  • read_only – whether to read the position value or not

Return type:

float

Returns:

“Valid” if the message is valid, “Invalid” otherwise

get_speed()[source]

Updates the value of the motor’s speed attribute.

Parameters:
  • wait_time – how long to wait for a response from the motor

  • read_only – whether to read the speed value or not

Return type:

float

Returns:

“Valid” if the message is valid, “Invalid” otherwise

set_control_params()[source]
Return type:

None

set_current(current)[source]

Sets the current of the motor.

Args: current: The current to set the motor to.

Return type:

None

set_operation_mode(mode)[source]

Sets the operation mode of the motor to position, speed, or current control!

Parameters:

mode (RunMode) – The mode to set the motor to.

Return type:

None

set_position(position, **kwargs)[source]

Sets the position of the motor using force position hybrid control.

Parameters:
  • position (float) – The position to set the motor to.

  • kwargs (Any) – Additional arguments to pass to the motor.

Return type:

None

set_speed(speed)[source]

Sets the speed of the motor.

Args: speed: The speed to set the motor to in rad/s.

Return type:

None

set_zero_position()[source]

Sets the zero position of the motor.

Return type:

None

class firmware.robstride_motors.motors.RobstrideParams(limit_torque, cur_kp, cur_ki, cur_fit_gain, limit_spd, limit_cur, loc_kp, spd_kp, spd_ki, spd_filt_gain)[source]

Bases: MotorParams

cur_fit_gain: float
cur_ki: float
cur_kp: float
limit_cur: float
limit_spd: float
limit_torque: float
loc_kp: float
spd_filt_gain: float
spd_ki: float
spd_kp: float

Module contents