pub struct PowertrainParams {
pub base: MotorQuadParams,
pub motor_tau: f64,
pub discharge_rate: f64,
pub sag_coeff: f64,
pub min_voltage_scale: f64,
pub relax_build: f64,
pub relax_recover: f64,
pub relax_coeff: f64,
}Expand description
Powertrain parameters layered on top of the base motor model.
Fields§
§base: MotorQuadParamsBase rigid-body and rotor-mixing parameters.
motor_tau: f64First-order motor spin-up time constant [s]; 0 means instant.
discharge_rate: f64Battery discharge rate per unit load per second [1/s].
sag_coeff: f64Instantaneous voltage droop fraction at full electrical load, in [0, 1).
min_voltage_scale: f64Open-circuit voltage scale at an empty pack, in (0, 1].
relax_build: f64Rate [1/s] at which the relaxation overpotential builds toward the load.
relax_recover: f64Rate [1/s] at which the relaxation overpotential decays (recovers).
relax_coeff: f64Voltage-scale depression per unit relaxation overpotential, in [0, 1).
Implementations§
Source§impl PowertrainParams
impl PowertrainParams
Sourcepub fn new(
base: MotorQuadParams,
motor_tau: f64,
discharge_rate: f64,
sag_coeff: f64,
min_voltage_scale: f64,
) -> RoboticsResult<Self>
pub fn new( base: MotorQuadParams, motor_tau: f64, discharge_rate: f64, sag_coeff: f64, min_voltage_scale: f64, ) -> RoboticsResult<Self>
Build a powertrain with explicit lag/battery coefficients.
Sourcepub fn with_recovery(self, build: f64, recover: f64, coeff: f64) -> Self
pub fn with_recovery(self, build: f64, recover: f64, coeff: f64) -> Self
Add a battery-recovery (relaxation-overpotential) model: the relaxation
state builds toward the load at build [1/s] and decays at recover
[1/s], depressing the terminal voltage by coeff per unit. Easing off
therefore lets the terminal voltage — and thus the thrust ceiling —
recover even though the state of charge keeps falling. All arguments are
sanitized (build/recover >= 0 and finite, coeff in [0, 1)); the
defaults of zero leave the pack with no recovery dynamics.
Sourcepub fn ideal(base: MotorQuadParams) -> Self
pub fn ideal(base: MotorQuadParams) -> Self
Idealized powertrain: no lag, no discharge, no sag. Reduces exactly to
the base MotorQuadParams dynamics — the benchmark baseline.
Sourcepub fn load(self, rotor_thrust: [f64; 4]) -> f64
pub fn load(self, rotor_thrust: [f64; 4]) -> f64
Electrical load in [0, 1]: total rotor thrust over the absolute max.
Sourcepub fn voltage_scale(self, soc: f64, load: f64) -> f64
pub fn voltage_scale(self, soc: f64, load: f64) -> f64
Terminal-voltage scale in [0, 1] from state of charge and load.
Open-circuit voltage falls linearly with state of charge from 1 (full)
to min_voltage_scale (empty); instantaneous sag subtracts
sag_coeff * load on top of that.
Sourcepub fn terminal_voltage_scale(self, soc: f64, load: f64, relaxation: f64) -> f64
pub fn terminal_voltage_scale(self, soc: f64, load: f64, relaxation: f64) -> f64
Terminal-voltage scale including the relaxation overpotential: the
open-circuit-minus-sag Self::voltage_scale less relax_coeff * relaxation. This is the voltage actually available at the rotors.
Sourcepub fn effective_max_rotor(self, state: PowertrainState) -> f64
pub fn effective_max_rotor(self, state: PowertrainState) -> f64
Battery-limited per-rotor thrust ceiling for the current state, including the relaxation overpotential.
Sourcepub fn step(
self,
state: PowertrainState,
command: MotorCommand,
dt: f64,
) -> PowertrainState
pub fn step( self, state: PowertrainState, command: MotorCommand, dt: f64, ) -> PowertrainState
Advance the powertrain one step under the commanded rotor thrusts.
Trait Implementations§
Source§impl Clone for PowertrainParams
impl Clone for PowertrainParams
Source§fn clone(&self) -> PowertrainParams
fn clone(&self) -> PowertrainParams
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PowertrainParams
impl Debug for PowertrainParams
Source§impl PartialEq for PowertrainParams
impl PartialEq for PowertrainParams
Source§fn eq(&self, other: &PowertrainParams) -> bool
fn eq(&self, other: &PowertrainParams) -> bool
self and other values to be equal, and is used by ==.impl Copy for PowertrainParams
impl StructuralPartialEq for PowertrainParams
Auto Trait Implementations§
impl Freeze for PowertrainParams
impl RefUnwindSafe for PowertrainParams
impl Send for PowertrainParams
impl Sync for PowertrainParams
impl Unpin for PowertrainParams
impl UnsafeUnpin for PowertrainParams
impl UnwindSafe for PowertrainParams
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.