|
YAMS
Yet Another Mechanism System
|
#include <FollowerSimSupplier.hpp>


Public Member Functions | |
| FollowerSimSupplier (SmartMotorController &leader, SmartMotorController &follower, bool inverted) | |
| void | UpdateSim () override |
| bool | GetUpdatedSim () override |
| void | FeedUpdateSim () override |
| void | StarveUpdateSim () override |
| bool | IsInputFed () override |
| void | FeedInput () override |
| void | StarveInput () override |
| void | SetMechanismStatorDutyCycle (double) override |
| wpi::units::volt_t | GetMechanismSupplyVoltage () override |
| wpi::units::volt_t | GetMechanismStatorVoltage () override |
| void | SetMechanismStatorVoltage (wpi::units::volt_t) override |
| wpi::units::turn_t | GetMechanismPosition () override |
| void | SetMechanismPosition (wpi::units::turn_t) override |
| wpi::units::turn_t | GetRotorPosition () override |
| wpi::units::turns_per_second_t | GetMechanismVelocity () override |
| void | SetMechanismVelocity (wpi::units::turns_per_second_t) override |
| wpi::units::turns_per_second_t | GetRotorVelocity () override |
| wpi::units::turns_per_second_squared_t | GetMechanismAcceleration () override |
| wpi::units::turns_per_second_squared_t | GetRotorAcceleration () override |
| void | SetRotorPosition (wpi::units::turn_t) override |
| void | SetRotorVelocity (wpi::units::turns_per_second_t) override |
| wpi::units::ampere_t | GetStatorCurrent () override |
| wpi::units::ampere_t | GetSupplyCurrent () override |
| Public Member Functions inherited from yams::motorcontrollers::SimSupplier | |
| virtual | ~SimSupplier ()=default |
Simulation of a motor whose leader's simulation has its motor too, such as an A301 following another, or a loosely coupled follower of a mechanism's motor controller.
It reads the leader's simulation, with its rotor values from its own gearing and its share of the current, and does not step a simulation of its own. Its current is in the leader's, so BatterySim does not count it again.
| yams::motorcontrollers::simulation::FollowerSimSupplier::FollowerSimSupplier | ( | SmartMotorController & | leader, |
| SmartMotorController & | follower, | ||
| bool | inverted ) |
Read the simulation of a leader whose motor model has this follower's motor.
| leader | Motor controller whose simulation has the follower's motor. Must outlive this. |
| follower | Motor controller reading it. Must outlive this. |
| inverted | Whether the follower is inverted from its leader. |
|
inlineoverridevirtual |
Mark the input as supplied directly for this loop.
Implements yams::motorcontrollers::SimSupplier.
|
inlineoverridevirtual |
Mark the simulation as stepped for this loop.
Implements yams::motorcontrollers::SimSupplier.
|
overridevirtual |
Get the simulated mechanism angular acceleration.
Implements yams::motorcontrollers::SimSupplier.
|
overridevirtual |
Get the simulated mechanism position.
Implements yams::motorcontrollers::SimSupplier.
|
overridevirtual |
Get the voltage applied to the simulated motor.
Implements yams::motorcontrollers::SimSupplier.
|
overridevirtual |
Get the supply voltage available to the simulated motor controller (bus voltage).
Implements yams::motorcontrollers::SimSupplier.
|
overridevirtual |
Get the simulated mechanism velocity.
Implements yams::motorcontrollers::SimSupplier.
|
overridevirtual |
Get the simulated rotor angular acceleration.
Implements yams::motorcontrollers::SimSupplier.
|
overridevirtual |
Get the simulated rotor position.
Implements yams::motorcontrollers::SimSupplier.
|
overridevirtual |
Get the simulated rotor velocity.
Implements yams::motorcontrollers::SimSupplier.
|
overridevirtual |
Get the simulated stator (motor) current.
Implements yams::motorcontrollers::SimSupplier.
|
overridevirtual |
Get the simulated supply (battery) current: duty cycle times stator current, filtered by a 0.1 s single-pole IIR filter.
Implements yams::motorcontrollers::SimSupplier.
|
inlineoverridevirtual |
Whether the simulation has already been stepped this loop.
Implements yams::motorcontrollers::SimSupplier.
|
inlineoverridevirtual |
Whether an input voltage was supplied directly this loop (e.g. from a hardware sim state).
Implements yams::motorcontrollers::SimSupplier.
|
inlineoverridevirtual |
Set the simulated mechanism position.
| angle | Mechanism position to inject. |
Implements yams::motorcontrollers::SimSupplier.
|
inlineoverridevirtual |
Apply a duty cycle of the supply voltage as the motor input (feeds the input).
| dutyCycle | Duty cycle in [-1, 1]. |
Implements yams::motorcontrollers::SimSupplier.
|
inlineoverridevirtual |
Set the motor input voltage directly, e.g. from a hardware sim state (feeds the input).
| volts | Voltage to apply. |
Implements yams::motorcontrollers::SimSupplier.
|
inlineoverridevirtual |
Set the simulated mechanism velocity.
| velocity | Mechanism velocity to inject. |
Implements yams::motorcontrollers::SimSupplier.
|
inlineoverridevirtual |
Set the simulated rotor position.
| angle | Rotor position to inject. |
Implements yams::motorcontrollers::SimSupplier.
|
inlineoverridevirtual |
Set the simulated rotor velocity.
| velocity | Rotor velocity to inject. |
Implements yams::motorcontrollers::SimSupplier.
|
inlineoverridevirtual |
Clear the input-fed flag so UpdateSim() falls back to the duty-cycle supplier.
Implements yams::motorcontrollers::SimSupplier.
|
inlineoverridevirtual |
Clear the stepped flag so the next UpdateSim() steps the physics again.
Implements yams::motorcontrollers::SimSupplier.
|
inlineoverridevirtual |
Advance the simulation by one loop iteration.
When the input has not been fed this loop (see FeedInput()), the motor duty cycle times the supply voltage is applied as the input and the battery voltage is updated. The physics are only stepped if the simulation has not already been updated this loop (see GetUpdatedSim()); stepping marks it updated, so a mechanism and its motor controller calling UpdateSim() in the same loop step the physics once.
Implements yams::motorcontrollers::SimSupplier.