franky.SimpleTorqueMotionยถ
- class franky.SimpleTorqueMotionยถ
Bases:
BaseTorqueMotionDirect joint torque control with a signal watchdog.
This motion applies the joint torques it is given, without any feedback law on top. Until the first torque signal arrives, it applies SimpleTorqueParams::initial_torque. New torques are published with setTorque from a user thread, analogous to how the references of the impedance motions are updated, and are picked up by the control loop in the next cycle.
As the robot is not commanded by any controller in between torque signals, the motion terminates with a TorqueSignalTimeoutException if no new torque arrives within SimpleTorqueParams::signal_timeout (50ms by default). Hence, the torque has to be updated regularly, even if it does not change.
Note that the commanded torques are still subject to the torque rate limit (TorqueSafetyParams::max_delta_tau), so large steps are ramped in over multiple cycles.
- __init__(self: franky._franky.SimpleTorqueMotion, initial_torque: Annotated[numpy.typing.ArrayLike, numpy.float64, '[7, 1]'] | None = None, signal_timeout: SupportsFloat | SupportsIndex | None = 0.05, compensate_coriolis: bool = False, max_delta_tau: SupportsFloat | SupportsIndex = 1.0, lower_joint_limits: Annotated[numpy.typing.ArrayLike, numpy.float64, '[7, 1]'] | None = None, upper_joint_limits: Annotated[numpy.typing.ArrayLike, numpy.float64, '[7, 1]'] | None = None, joint_limit_activation_distance: SupportsFloat | SupportsIndex = 0.1, joint_limit_stiffness: SupportsFloat | SupportsIndex = 4.0, joint_limit_damping: SupportsFloat | SupportsIndex = 1.0, joint_limit_max_torque: SupportsFloat | SupportsIndex = 5.0, friction: franky._franky.FrictionCompensationParams | None = None) Noneยถ
Construct a direct joint torque controller.
The motion applies the joint torques it is given, without any feedback law on top. Until the first call to set_torque, it applies initial_torque (zero by default). Afterwards, it applies the last torque published with set_torque, analogous to how the references of the impedance motions are updated.
As the robot is not commanded by any controller in between torque signals, the motion terminates with a TorqueSignalTimeoutException if no new torque arrives within signal_timeout seconds (0.05 by default, None to disable). Hence, set_torque has to be called regularly, even if the torque does not change.
Note that the commanded torques are still subject to the torque rate limit max_delta_tau, so large steps are ramped in over multiple cycles.
- add_reaction(self: franky._franky.BaseTorqueMotion, reaction: franky._franky.TorqueReaction) Noneยถ
Add a reaction to the motion.
Reactions are evaluated in every step of the motion and can replace the current motion with a new motion.
- Parameters:
reaction โ The reaction to add.
Warning
Do not call this function synchronously from a condition, motion function, or reaction callback while this motionโs reactions are being evaluated. Reaction evaluation holds the reaction-list mutex, so doing so would deadlock.
- get_torque(self: franky._franky.SimpleTorqueMotion) Annotated[numpy.typing.NDArray[numpy.float64], '[7, 1]']ยถ
Get a copy of the last published torque [Nm], or the initial torque if no torque has been published yet.
- register_callback(self: franky._franky.BaseTorqueMotion, callback: collections.abc.Callable[[franky._franky.RobotState, franky._franky.Duration, franky._franky.Duration, franky._franky.Duration, franky._franky.Torques], None]) Noneยถ
Register a callback that is called in every step of the motion.
- Parameters:
callback โ The callback to register. Callbacks are called with the robot state, the time step [s], the relative time [s], the absolute time [s] and the control signal computed in this step.
- set_torque(self: franky._franky.SimpleTorqueMotion, torque: Annotated[numpy.typing.ArrayLike, numpy.float64, '[7, 1]']) Noneยถ
Set the torque applied by the motion [Nm].
The torque is validated and picked up by the control loop in the next cycle. It also resets the watchdog, so this function has to be called at least every SimpleTorqueParams::signal_timeout seconds while the motion is running.
- Parameters:
torque โ The new joint torques [Nm].
- property paramsยถ
The parameters of the motion.
- property reactionsยถ
Currently registered reactions of the motion.