feathersdk.robot.actuators.sim.virtual_robstride Module¶
Virtual Robstride motor simulator.
- class feathersdk.robot.actuators.sim.virtual_robstride.VirtualRobstrideState(*, errors=<factory>, active_reporting=False, last_active_reporting_time=0.0, telemetry, max_torque=0.0, target_angle=0.0, max_velocity=0.0, op_kp=40.0, op_kd=20.0, ki=4.0, sent_first_broadcast_frame=False, sent_fault_feedback=False, last_host_id=170, external_torque=0.0, integrals_window=<factory>, integrals_window_size=20, last_error=None, d_filt=None, d_alpha=0.3, moment_of_inertia=0.2, hard_stop_range=NumericRange(min=-inf, max=inf))¶
Bases:
VirtualActuatorStateState of a virtual Robstride motor.
- Parameters:
errors (Set[RobstrideMotorError])
active_reporting (bool)
last_active_reporting_time (float)
telemetry (TelemetryManager[RobstrideParamSet, RobstrideParam, TRobParamVal])
max_torque (float)
target_angle (float)
max_velocity (float)
op_kp (float)
op_kd (float)
ki (float)
sent_first_broadcast_frame (bool)
sent_fault_feedback (bool)
last_host_id (int)
external_torque (float)
integrals_window_size (int)
last_error (float | None)
d_filt (float | None)
d_alpha (float)
moment_of_inertia (float)
hard_stop_range (NumericRange)
- errors: Set[RobstrideMotorError]¶
- telemetry: TelemetryManager[RobstrideParamSet, RobstrideParam, TRobParamVal]¶
- hard_stop_range: NumericRange¶
- update_operation_state(torque, angle, velocity, kp, kd)¶
Update the operation state with the given values.
- get_feedback_extra_byte()¶
Build the extra byte for the feedback message. First 2 bit for motor mode, then 6 bit for errors.
- Return type:
- get_fault_feedback_bytes()¶
Get the fault feedback bytes for the fault feedback message.
Note: I’m not exactly sure this is correct endianness since it’s hard to trigger a fault manually, but based on some previous fault feedback messages we got once, it seems to be little endian.
- Return type:
- static default(version, **kwargs)¶
Get the default state for a virtual Robstride motor.
- Parameters:
version (int | str | RobstrideVersion)
kwargs (Any)
- Return type:
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- feathersdk.robot.actuators.sim.virtual_robstride.default_firmware_version(version)¶
Get the default firmware version a virtual motor should have for the given version.
- Parameters:
version (int | str | RobstrideVersion)
- Return type:
- feathersdk.robot.actuators.sim.virtual_robstride.default_broadcast_id(version, motor_id)¶
Get the default broadcast ID for a virtual motor.
- Parameters:
version (int | str | RobstrideVersion)
motor_id (int)
- Return type:
- class feathersdk.robot.actuators.sim.virtual_robstride.VirtualRobstride(iface, motor_id, version, hard_stop_range=None)¶
Bases:
VirtualActuator[VirtualRobstrideState]Virtual Robstride motor simulator.
- Parameters:
motor_id (int) – The motor ID to simulate. Should be in range [0x00, 0xFF].
version (int | str | RobstrideVersion) – The version of the Robstride motor to simulate.
iface (str) – The interface to use for the communication.
hard_stop_range (NumericRange | None) – If provided, the motor will simulate hard stops at the range boundaries. When the simulated angle reaches a boundary, velocity is zeroed and max torque for the version is reported. Used to enable virtual calibration.
- send_motor_feedback(msg_op=RobstrideMotorMsg.MotorFeedback, send_ver=False)¶
Send a motor feedback message. If send_ver is True, will send the firmware version number instead
- Parameters:
msg_op (RobstrideMotorMsg | None)
send_ver (bool)
- Return type:
None
- send_broadcast_frame()¶
Send a broadcast frame. Done after things like GetDeviceId and SetID.
- Return type:
None
- handle_message(result)¶
Handle a message from the Robstride motor.
- Parameters:
result (CanSocketResult | TcpSocketResult | ErrorSocketResult)
- close()¶
Close the virtual Robstride motor.
- Return type:
None