feathersdk.robot.actuators.actuator Module

class feathersdk.robot.actuators.actuator.ActuatorConfig(*, name, id, endpoint='', shares_endpoint_with=None, requires_calibration, calibration_timeout=10.0, feedback_delay_threshold=0.1, feedback_delay_warning_interval=10.0, urdf_joint_name='', urdf_link_name='')

Bases: PyDFrozenBaseModel

Frozen base class for all actuator configs.

Parameters:
  • name (str)

  • id (int)

  • endpoint (str | int)

  • shares_endpoint_with (str | List[str] | None)

  • requires_calibration (bool)

  • calibration_timeout (float)

  • feedback_delay_threshold (float)

  • feedback_delay_warning_interval (float)

  • urdf_joint_name (str)

  • urdf_link_name (str)

name: str

The name of the actuator. Should be unique (ignoring case) within the robot.

id: int

The ID of the actuator. Should be unique within the robot.

endpoint: str | int

The endpoint to use for the communication. Will be set automatically by the manager.

shares_endpoint_with: str | List[str] | None

Name of an actuator or multiple actuators that share the same endpoint with this actuator. If set, we will probe for this actuator’s endpoint after all other actuators have been found. We check only endpoints of existing actuator names in this list. If no actuators in this list exist, we probe as normal. Otherwise, the endpoint for this actuator must be the same as the first shared actuator found in the list. This is useful for speeding up actuator endpoint detection, especially for slow-detecting actuators like the EZMotion motors.

requires_calibration: bool

Whether the actuator requires calibration.

calibration_timeout: float

The timeout for the calibration process in seconds.

feedback_delay_threshold: float

The threshold in seconds for feedback delay. If we do not receive an updated value for a parameter within this threshold, we will consider the actuator to have feedback delay.

feedback_delay_warning_interval: float

The interval in seconds between feedback delay warnings. Will only warn once every this interval at most.

urdf_joint_name: str

The name of the joint in the URDF that this actuator corresponds to. Ignored if motor is not in a system that requires URDF joint names.

The name of an important link this actuator is attached to. Mainly used for wheel geometry extraction.

has_endpoint()

Check if the motor has a communication endpoint.

Return type:

bool

set_endpoint(endpoint)

Set the communication endpoint for the motor.

Parameters:

endpoint (str)

Return type:

None

clear_endpoint()

Clear the communication endpoint for the motor.

Return type:

None

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

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

class feathersdk.robot.actuators.actuator.TActuatorConfig

Typevar bound to ActuatorConfig

alias of TypeVar(‘TActuatorConfig’, bound=ActuatorConfig)

class feathersdk.robot.actuators.actuator.TTelemetryParamCode

Unique Enum of telemetry parameter codes for the actuator. Names should be string key to use, values should be the pcodes needed to be sent to the ethernet -> CAN adapter.

alias of TypeVar(‘TTelemetryParamCode’, bound=Enum)

feathersdk.robot.actuators.actuator.TIMESTAMP_SUFFIX = '_TS'

The suffix to add to telemetry keys to store the timestamp, to keep with convention.

class feathersdk.robot.actuators.actuator.ActuatorTelemetry(actuator)

Bases: Generic[TTelemetryParamCode]

Base class for all actuator telemetry.

Parameters:

actuator (Actuator[TActuatorConfig, TActuatorTelemetry])

PARAMS: TTelemetryParamCode

The telemetry parameters for this actuator.

telemetry_inds()

Get the indices of the telemetry entries for this actuator in the global telemetry manager.

Indices are returned in the order of the PARAMS class variable.

Return type:

List[int]

get_latest_value(key, default=<SENTINEL>)

Get the latest value of a telemetry parameter by name. Can pass either a normal param or timestamp param.

Parameters:
Return type:

float | int | U

get_latest_timestamp(key, default=<SENTINEL>)

Get the latest timestamp of a telemetry parameter by name.

Parameters:
Return type:

float | U

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

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

Parameters:
Return type:

float | int | U

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

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

Parameters:
Return type:

float | U

class feathersdk.robot.actuators.actuator.TActuatorTelemetry

Typevar bound to ActuatorTelemetry

alias of TypeVar(‘TActuatorTelemetry’, bound=ActuatorTelemetry)

class feathersdk.robot.actuators.actuator.Actuator(config, *args, **kwargs)

Bases: Configurable[TActuatorConfig], ABC, Generic[TActuatorConfig, TActuatorTelemetry, TTelemetryParamCode]

Base class for all actuators.

Hashable by name as all names are required to be unique. Will also be equal to the string name for use as dict key.

Parameters:
name

The unique name of the actuator.

id

The unique identifier for the actuator.

system

The actuator system that this actuator belongs to.

robot

The robot that this actuator’s system belongs to.

comms

The comms manager for the actuator. Handles all low-level communication with the actuator.

telemetry

The telemetry manager for the actuator. Handles all telemetry collection and storage.

PARAMS: TTelemetryParamCode

The telemetry parameters for the actuator.

abstractmethod enable(**kwargs)

Enable the actuator.

Parameters:

kwargs (Any)

Return type:

None

abstractmethod disable(**kwargs)

Disable the actuator.

Parameters:

kwargs (Any)

Return type:

None

get_param(key, default=<SENTINEL>)

Get the value of a parameter by name.

Parameters:
Return type:

float | int | U

has_feedback_delay(key, threshold=None)

Check if the actuator has feedback delay for a given parameter.

Will return True if the param has no value in the telemetry manager.

Parameters:
  • key (str) – The name of the telemetry channel to check feedback delay for.

  • threshold (float | None) – The threshold for feedback delay. If None, will use the default threshold from the configs.

Return type:

bool

check_warn_on_feedback_delay(key, threshold=None)

Check if the actuator has feedback delay for a given parameter and warn if so.

Will only warn once every self.config.feedback_delay_warning_interval seconds at most.

Parameters:
  • key (str) – The name of the telemetry channel to check feedback delay for.

  • threshold (float | None) – The threshold for feedback delay. If None, will use the default threshold from the configs.

Return type:

None

class feathersdk.robot.actuators.actuator.TActuator

Typevar bound to Actuator

alias of TypeVar(‘TActuator’, bound=Actuator[TActuatorConfig, TActuatorTelemetry, TTelemetryParamCode])

exception feathersdk.robot.actuators.actuator.ActuatorCalibrationError

Bases: Exception

Raised when an error occurs during actuator calibration.

feathersdk.robot.actuators.actuator.calibrate_actuator_group(actuators, allow_load=False, only_load=False, home=True, multithreaded=True)

Recalibrate a group of actuators.

Parameters:
  • actuators (List[Actuator[TActuatorConfig, TActuatorTelemetry, TTelemetryParamCode]]) – The list of actuators to calibrate.

  • allow_load (bool) – If True, allow the actuators to load calibration state from file instead of recalibrating.

  • only_load (bool) – If True, only load calibration state from file, do not recalibrate. allow_load must be True.

  • home (bool) – If True, home the actuators after calibration.

  • multithreaded (bool) – If True, calibrate the actuators all at once in multiple threads. Otherwise, one at a time.

Return type:

None