pub struct Actuator {
pub name: String,
pub joint_name: String,
pub joint_idx: usize,
pub gear: f64,
pub ctrl_range: Option<[f64; 2]>,
pub gain: f64,
pub bias_q: f64,
pub bias_v: f64,
pub force_range: Option<[f64; 2]>,
}Expand description
An actuator attached to a joint.
Follows MuJoCo’s affine actuator model: the generalized force applied to the joint’s first DOF is
f = gear * (gain * ctrl + bias_q * q + bias_v * v)which expresses <motor>, <position>, <velocity> and the affine subset
of <general> with one parameter set, so downstream code never branches on
actuator type. A plain motor is gain = 1, bias_q = bias_v = 0, for which
this reduces to gear * clamp(ctrl).
Fields§
§name: StringActuator name, as declared in the source model.
joint_name: StringName of the joint this actuator drives.
joint_idx: usizeIndex into Model::joints of the driven joint.
gear: f64Gear ratio applied to the control signal to produce joint torque.
ctrl_range: Option<[f64; 2]>Optional [lo, hi] clamp on the control signal, before gear.
gain: f64Coefficient on ctrl. 1 for a motor, kp for a position servo.
bias_q: f64Coefficient on joint position. -kp for a position servo, else 0.
bias_v: f64Coefficient on joint velocity. -kv for a servo, else 0.
force_range: Option<[f64; 2]>Force limits applied after the affine law, or None if unlimited.
Implementations§
Source§impl Actuator
impl Actuator
Sourcepub fn clamp_ctrl(&self, ctrl: f64) -> f64
pub fn clamp_ctrl(&self, ctrl: f64) -> f64
Clamp a raw control value to this actuator’s control range.
Sourcepub fn force(&self, ctrl: f64) -> f64
pub fn force(&self, ctrl: f64) -> f64
Generalized force produced by this actuator for a raw control value, ignoring any state feedback.
Correct for motors. Position and velocity servos additionally depend on
q and v; use Self::force_at for those.
Sourcepub fn force_at(&self, ctrl: f64, q: f64, v: f64) -> f64
pub fn force_at(&self, ctrl: f64, q: f64, v: f64) -> f64
Evaluate the full affine actuator law at the joint’s current state.
Sourcepub fn motor(name: &str, joint_name: &str, joint_idx: usize, gear: f64) -> Self
pub fn motor(name: &str, joint_name: &str, joint_idx: usize, gear: f64) -> Self
A direct-torque motor: f = gear * ctrl.