bam.erob.actuator#

Classes#

ErobActuator

Abstract base class for all BAM actuator models.

Module Contents#

class bam.erob.actuator.ErobActuator(testbench_class: bam.testbench.Testbench, damping=2.0)#

Bases: bam.actuator.Actuator

Abstract base class for all BAM actuator models.

Subclasses implement the firmware control law and the motor torque equation for a specific actuator family. An actuator is always attached to a Model via set_actuator(), which calls initialize() to create the motor parameters (kt, R, …) on the model.

Parameters:

testbench_class – Class used to instantiate the testbench when a log is loaded (typically Pendulum).

max_amps = 12.0#
max_volts = 48.0#
damping = 2.0#
initialize()#

Create motor parameters on the attached model.

Called automatically by set_model(). Must create at minimum self.model.kt and self.model.R as Parameter instances.

load_log(log: dict)#

Called when a log is loaded.

Instantiates the testbench from the log metadata (mass, length, …) and updates actuator settings (kp, vin) from the log.

Parameters:

log – Log dict as loaded from a processed JSON file.

control_unit() str#

Return the physical unit of the control signal (e.g. "volts", "amps").

compute_control(q_target: float, q: float, dq: float, dt: float) float | None#

Compute the control signal from the current state and target.

Parameters:
  • q_target – Target joint angle [rad].

  • q – Current joint angle [rad].

  • dq – Current joint velocity [rad/s].

  • dt – Timestep [s].

Returns:

Control signal in the unit given by control_unit().

compute_torque(control: float | None, torque_enable: bool, q: float, dq: float) float#

Compute the motor torque from the control signal and current state.

Parameters:
  • control – Control signal (volts, amps, or Nm depending on the actuator).

  • torque_enable – Whether the actuator is powered.

  • q – Current joint angle [rad].

  • dq – Current joint velocity [rad/s].

Returns:

Motor torque [Nm].

get_extra_inertia() float#

Return the actuator’s apparent inertia added to the load [kg·m²].