bam.erob.actuator ================= .. py:module:: bam.erob.actuator Classes ------- .. autoapisummary:: bam.erob.actuator.ErobActuator Module Contents --------------- .. py:class:: ErobActuator(testbench_class: bam.testbench.Testbench, damping=2.0) Bases: :py:obj:`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 :class:`~bam.model.Model` via :meth:`~bam.model.Model.set_actuator`, which calls :meth:`initialize` to create the motor parameters (``kt``, ``R``, …) on the model. :param testbench_class: Class used to instantiate the testbench when a log is loaded (typically :class:`~bam.testbench.Pendulum`). .. py:attribute:: max_amps :value: 12.0 .. py:attribute:: max_volts :value: 48.0 .. py:attribute:: damping :value: 2.0 .. py:method:: initialize() Create motor parameters on the attached model. Called automatically by :meth:`set_model`. Must create at minimum ``self.model.kt`` and ``self.model.R`` as :class:`~bam.parameter.Parameter` instances. .. py:method:: 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. :param log: Log dict as loaded from a processed JSON file. .. py:method:: control_unit() -> str Return the physical unit of the control signal (e.g. ``"volts"``, ``"amps"``). .. py:method:: compute_control(q_target: float, q: float, dq: float, dt: float) -> float | None Compute the control signal from the current state and target. :param q_target: Target joint angle [rad]. :param q: Current joint angle [rad]. :param dq: Current joint velocity [rad/s]. :param dt: Timestep [s]. :returns: Control signal in the unit given by :meth:`control_unit`. .. py:method:: compute_torque(control: float | None, torque_enable: bool, q: float, dq: float) -> float Compute the motor torque from the control signal and current state. :param control: Control signal (volts, amps, or Nm depending on the actuator). :param torque_enable: Whether the actuator is powered. :param q: Current joint angle [rad]. :param dq: Current joint velocity [rad/s]. :returns: Motor torque [Nm]. .. py:method:: get_extra_inertia() -> float Return the actuator's apparent inertia added to the load [kg·m²].