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


Public Member Functions | |
| SparkWrapper (rev::spark::SparkMax *spark, wpi::math::DCMotor motor, SmartMotorControllerConfig *config) | |
| SparkWrapper (rev::spark::SparkFlex *spark, wpi::math::DCMotor motor, SmartMotorControllerConfig *config) | |
| ~SparkWrapper () | |
| telemetry::UnsupportedTelemetryFields | GetUnsupportedTelemetryFields () override |
| bool | ApplyConfig (const SmartMotorControllerConfig &config) override |
| void | SetupSimulation () override |
| void | SimIterate () override |
| void | SeedRelativeEncoder () override |
| void | SynchronizeRelativeEncoder () override |
| void | SetDutyCycle (double dutyCycle) override |
| double | GetDutyCycle () override |
| void | SetVoltage (wpi::units::volt_t voltage) override |
| wpi::units::volt_t | GetVoltage () override |
| std::optional< wpi::units::second_t > | GetVelocityMeasurementDelay () const override |
| void | SetPosition (wpi::units::turn_t angle) override |
| void | SetPosition (wpi::units::meter_t distance) override |
| void | SetVelocity (wpi::units::turns_per_second_t velocity) override |
| void | SetVelocity (wpi::units::turns_per_second_t velocity, wpi::units::newton_t feedforwardForce) override |
| void | SetVelocity (wpi::units::meters_per_second_t velocity) override |
| void | SetEncoderPosition (wpi::units::turn_t angle) override |
| void | SetEncoderPosition (wpi::units::meter_t distance) override |
| void | SetEncoderVelocity (wpi::units::turns_per_second_t velocity) override |
| void | SetEncoderVelocity (wpi::units::meters_per_second_t velocity) override |
| wpi::units::turn_t | GetMechanismPosition () override |
| wpi::units::turns_per_second_t | GetMechanismVelocity () override |
| wpi::units::turn_t | GetRelativeMechanismPosition () override |
| wpi::units::turns_per_second_t | GetRelativeMechanismVelocity () override |
| wpi::units::turns_per_second_squared_t | GetMechanismAcceleration () override |
| wpi::units::turn_t | GetRotorPosition () override |
| wpi::units::turns_per_second_t | GetRotorVelocity () override |
| wpi::units::meter_t | GetMeasurementPosition () override |
| wpi::units::meters_per_second_t | GetMeasurementVelocity () override |
| wpi::units::meters_per_second_squared_t | GetMeasurementAcceleration () override |
| std::optional< wpi::units::turn_t > | GetExternalEncoderMechanismPosition () override |
| std::optional< wpi::units::turns_per_second_t > | GetExternalEncoderMechanismVelocity () override |
| std::optional< wpi::units::ampere_t > | GetSupplyCurrent () override |
| wpi::units::ampere_t | GetStatorCurrent () override |
| wpi::units::celsius_t | GetTemperature () override |
| wpi::math::DCMotor | GetDCMotor () override |
| void | SetZeroPower (MotorMode mode) override |
| void | SetMotorInverted (bool inverted) override |
| void | SetEncoderInverted (bool inverted) override |
| void | SetKp (double kP) override |
| void | SetKi (double kI) override |
| void | SetKd (double kD) override |
| void | SetFeedback (double kP, double kI, double kD) override |
| void | SetKs (double kS) override |
| void | SetKv (double kV) override |
| void | SetKa (double kA) override |
| void | SetKg (double kG) override |
| void | SetFeedforward (double kS, double kV, double kA, double kG) override |
| void | SetStatorCurrentLimit (wpi::units::ampere_t currentLimit) override |
| void | SetSupplyCurrentLimit (wpi::units::ampere_t currentLimit) override |
| void | SetClosedLoopRampRate (wpi::units::second_t rampRate) override |
| void | SetOpenLoopRampRate (wpi::units::second_t rampRate) override |
| void | SetMechanismUpperLimit (wpi::units::turn_t upperLimit) override |
| void | SetMechanismLowerLimit (wpi::units::turn_t lowerLimit) override |
| void | SetMechanismLimits (wpi::units::turn_t lower, wpi::units::turn_t upper) override |
| void | SetMechanismLimitsEnabled (bool enabled) override |
| void | SetMeasurementUpperLimit (wpi::units::meter_t upperLimit) override |
| void | SetMeasurementLowerLimit (wpi::units::meter_t lowerLimit) override |
| void | SetMotionProfileMaxVelocity (wpi::units::turns_per_second_t maxVelocity) override |
| void | SetMotionProfileMaxVelocity (wpi::units::meters_per_second_t maxVelocity) override |
| void | SetMotionProfileMaxAcceleration (wpi::units::turns_per_second_squared_t maxAcc) override |
| void | SetMotionProfileMaxAcceleration (wpi::units::meters_per_second_squared_t maxAcc) override |
| void | SetMotionProfileMaxJerk (wpi::units::angular_jerk::turns_per_second_cubed_t maxJerk) override |
| void | SetExponentialProfile (std::optional< double > kV, std::optional< double > kA, std::optional< wpi::units::volt_t > maxInput) override |
| void | SetClosedLoopSlot (ClosedLoopControllerSlot slot) override |
| void | SetMechanismGearing (const gearing::MechanismGearing &gearing) override |
| void | SetMechanismCircumference (wpi::units::meter_t circumference) override |
| SmartMotorControllerConfig & | GetConfig () override |
| void * | GetMotorController () override |
| void * | GetMotorControllerConfig () override |
| virtual void | SetVelocity (wpi::units::turns_per_second_t velocity)=0 |
| virtual void | SetVelocity (wpi::units::meters_per_second_t velocity)=0 |
| virtual void | SetVelocity (wpi::units::turns_per_second_t velocity, wpi::units::newton_t feedforwardForce) |
| void | SetVelocity (wpi::units::meters_per_second_t velocity, wpi::units::newton_t feedforwardForce) |
Public Member Functions inherited from yams::motorcontrollers::SmartMotorController | |
| virtual | ~SmartMotorController () |
| void | SetSimSupplier (std::shared_ptr< SimSupplier > supplier) |
| SimSupplier * | GetSimSupplier () const |
| void | SetVelocity (wpi::units::meters_per_second_t velocity, wpi::units::newton_t feedforwardForce) |
| wpi::units::second_t | GetClosedLoopControllerPeriod () const |
| void | StartClosedLoopController () |
| void | StopClosedLoopController () |
| void | IterateClosedLoopController () |
| void | SetupTelemetry (std::shared_ptr< wpi::nt::NetworkTable > dataTable, std::shared_ptr< wpi::nt::NetworkTable > tuningTable) |
| void | SetupTelemetry () |
| void | SetupLiveTuning () |
| void | UpdateTelemetry () |
| bool | TuningEnabled () const |
| void | ApplyTuningValues () |
| void | StopLiveTuning () |
| const std::vector< SmartMotorController * > & | GetLooselyCoupledFollowers () const |
| void | AddCloseHook (std::function< void()> hook) |
| SmartMotorController & | WithTelemetry (telemetry::SmartMotorControllerTelemetryConfig config) |
| ClosedLoopControllerSlot | GetClosedLoopControllerSlot () const |
| std::optional< wpi::units::turn_t > | GetMechanismPositionSetpoint () const |
| std::optional< wpi::units::turns_per_second_t > | GetMechanismSetpointVelocity () const |
| std::optional< wpi::units::meter_t > | GetMeasurementPositionSetpoint () const |
| std::optional< wpi::units::meters_per_second_t > | GetMeasurementSetpointVelocity () const |
| std::optional< wpi::units::newton_t > | GetSetpointFeedforwardForce () const |
| std::string | GetName () const |
| bool | IsMotor (const wpi::math::DCMotor &a, const wpi::math::DCMotor &b) const |
| void | CheckConfigSafety () |
| void | Close () |
Additional Inherited Members | |
Public Types inherited from yams::motorcontrollers::SmartMotorController | |
| using | ClosedLoopControllerSlot = SmartMotorControllerConfig::ClosedLoopControllerSlot |
| using | MotorMode = SmartMotorControllerConfig::MotorMode |
| using | ControlMode = SmartMotorControllerConfig::ControlMode |
Protected Member Functions inherited from yams::motorcontrollers::SmartMotorController | |
| void | LoadLooselyCoupledFollowers () |
| void | ConfigureSoftwarePID (const SmartMotorControllerConfig &config) |
| void | ForwardPositionToFollowers (wpi::units::turn_t pos) |
| void | ForwardPositionToFollowers (wpi::units::meter_t dist) |
| void | ForwardVelocityToFollowers (wpi::units::turns_per_second_t vel) |
| void | ForwardVelocityToFollowers (wpi::units::meters_per_second_t vel) |
| const void * | BatterySimKey () const |
Protected Attributes inherited from yams::motorcontrollers::SmartMotorController | |
| SmartMotorControllerConfig * | m_config {nullptr} |
| ClosedLoopControllerSlot | m_slot {ClosedLoopControllerSlot::SLOT_0} |
| std::shared_ptr< SimSupplier > | m_simSupplier |
| std::vector< SmartMotorController * > | m_looseFollowers |
| std::optional< wpi::math::PIDController > | m_pid |
| std::optional< math::LQRController > | m_lqr |
| std::optional< wpi::math::TrapezoidProfile< wpi::units::turns >::State > | m_trapState |
| std::optional< wpi::math::ExponentialProfile< wpi::units::turns, wpi::units::volts >::State > | m_expoState |
| std::optional< wpi::math::TrapezoidProfile< wpi::units::meters >::State > | m_linearTrapState |
| std::optional< wpi::math::ExponentialProfile< wpi::units::meters, wpi::units::volts >::State > | m_linearExpoState |
| std::optional< wpi::units::turn_t > | m_lastClosedLoopMechanismPosition |
| std::optional< wpi::units::turn_t > | m_setpointPosition |
| std::optional< wpi::units::turns_per_second_t > | m_setpointVelocity |
| std::optional< wpi::units::newton_t > | m_setpointFeedforwardForce |
| std::vector< std::function< void()> > | m_closeHooks |
| std::unique_ptr< wpi::Notifier > | m_closedLoopControllerThread |
| bool | m_closedLoopControllerRunning {false} |
| std::shared_ptr< wpi::nt::NetworkTable > | m_parentTable |
| std::shared_ptr< wpi::nt::NetworkTable > | m_telemetryTable |
| std::shared_ptr< wpi::nt::NetworkTable > | m_tuningTable |
| telemetry::SmartMotorControllerTelemetry | m_telemetry |
| telemetry::SmartMotorControllerTelemetryConfig | m_telemetryConfig |
| bool | m_telemetryConfigExplicit {false} |
| std::shared_ptr< telemetry::SmartMotorControllerTelemetryConfig > | m_specifiedTelemetryConfig |
| bool | m_liveTuningRegistered {false} |
| bool | m_closed {false} |
SmartMotorController implementation for REV SPARK Max and SPARK Flex motor controllers.
Supports both SPARK Max and SPARK Flex hardware via a common internal interface. Wraps REV SparkBase, SparkClosedLoopController, and encoder objects to satisfy the SmartMotorController contract.
The SPARK runs in the raw units of its feedback sensor (rotations and RPM of the motor's encoder, or of the external encoder when it is used for feedback); no conversion factors are configured. Gains, setpoints, MAXMotion constraints, tolerances and soft limits are scaled from YAMS mechanism units by the mechanism-to-feedback-sensor ratio.
Supported external encoders (WithExternalEncoder): rev::spark::SparkAbsoluteEncoder*, rev::spark::SparkMaxAlternateEncoder* / rev::spark::SparkFlexExternalEncoder* (quadrature), and rev::detached::DetachedEncoder* / rev::detached::SplineEncoder* (read over CAN).
External encoder discontinuity point (absolute and detached encoders): 0.5 rotations reports [-0.5, 0.5), 1 rotation (the default) reports [0, 1).
| yams::motorcontrollers::local::SparkWrapper::SparkWrapper | ( | rev::spark::SparkMax * | spark, |
| wpi::math::DCMotor | motor, | ||
| SmartMotorControllerConfig * | config | ||
| ) |
Construct a SparkWrapper around a SPARK Max.
| spark | Pointer to the SPARK Max hardware object (must outlive this wrapper). |
| motor | DC motor model used for simulation. |
| config | Pointer to the SmartMotorControllerConfig (must outlive this wrapper). |
| yams::motorcontrollers::local::SparkWrapper::SparkWrapper | ( | rev::spark::SparkFlex * | spark, |
| wpi::math::DCMotor | motor, | ||
| SmartMotorControllerConfig * | config | ||
| ) |
Construct a SparkWrapper around a SPARK Flex.
| spark | Pointer to the SPARK Flex hardware object (must outlive this wrapper). |
| motor | DC motor model used for simulation. |
| config | Pointer to the SmartMotorControllerConfig (must outlive this wrapper). |
| yams::motorcontrollers::local::SparkWrapper::~SparkWrapper | ( | ) |
|
overridevirtual |
Apply a SmartMotorControllerConfig to the underlying hardware.
| config | Configuration to apply. |
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Get a mutable reference to the current configuration.
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Get the DC motor model associated with this controller.
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Get the current motor duty cycle.
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Get the mechanism position from the external (absolute) encoder (applies the external encoder gearing). Available whether or not the external encoder is used for feedback.
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Get the mechanism velocity from the external (absolute) encoder (applies the external encoder gearing). Available whether or not the external encoder is used for feedback.
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Get the linear measurement acceleration.
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Get the linear measurement position (applies circumference conversion).
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Get the linear measurement velocity (applies circumference conversion).
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Get the mechanism acceleration (derived from velocity).
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Get the mechanism position (applies gearing). Uses the external (absolute) encoder when one is configured with SmartMotorControllerConfig::WithUseExternalFeedbackEncoder(), otherwise the relative encoder. Use GetRelativeMechanismPosition() to only read the relative encoder.
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Get the mechanism velocity (applies gearing). Uses the external (absolute) encoder when one is configured with SmartMotorControllerConfig::WithUseExternalFeedbackEncoder(), otherwise the relative encoder. Use GetRelativeMechanismVelocity() to only read the relative encoder.
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Get a raw pointer to the underlying SPARK hardware object.
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Get a raw pointer to the internally managed SPARK configuration object.
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Get the mechanism position from the relative encoder in the motor (applies gearing). Never uses the external (absolute) encoder.
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Get the mechanism velocity from the relative encoder in the motor (applies gearing). Never uses the external (absolute) encoder.
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Get the raw rotor position (no gearing applied).
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Get the raw rotor velocity (no gearing applied).
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Get the stator (output) current draw.
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
SPARKs do not report supply current; always empty.
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Get the motor controller temperature.
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Return telemetry fields not supported by this motor controller implementation.
Subclasses override this to disable fields for hardware that lacks certain signals (e.g. SPARK controllers do not expose supply current).
Reimplemented from yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Read from the SPARK's encoder settings when the config is applied. The SPARK's closed loop uses the velocity as soon as it is filtered. A closed loop run on the SystemCore reads it from its status frame instead, which on average is half the frame's period older.
Reimplemented from yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Get the voltage currently applied to the motor.
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Seed the relative encoder from the absolute sensor position (one-shot on startup).
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Set the closed-loop output ramp rate.
| rampRate | Time to ramp from 0 to full output. |
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Select the active closed-loop gain slot.
| slot | Gain slot to activate. |
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Command a duty-cycle output to the motor.
| dutyCycle | Normalized duty cycle in [-1, 1]. |
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Set the encoder count direction.
| inverted | true to invert the encoder. |
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Write a linear distance into the encoder (seeds the position). Converts distance to turns using the configured mechanism circumference.
| distance | Linear distance to write. |
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Write a mechanism angle into the encoder (seeds the position).
| angle | Mechanism angle to write. |
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Linear version of SetEncoderVelocity(turns_per_second_t); throws without a mechanism circumference.
| velocity | Mechanism linear velocity. |
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Set the simulated encoder velocities. Throws std::runtime_error outside of simulation, since SPARKs do not support setting the encoder velocity.
| velocity | Mechanism velocity. |
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Update the exponential profile (run on the RoboRIO, SPARKs have no exponential profile). Missing values keep the configured ones.
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Set all three PID feedback gains at once (live update).
| kP | Proportional gain. |
| kI | Integral gain. |
| kD | Derivative gain. |
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Set all four feedforward gains at once (live update).
| kS | Static friction voltage. |
| kV | Velocity feedforward coefficient. |
| kA | Acceleration feedforward coefficient. |
| kG | Gravity feedforward coefficient. |
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Set the acceleration feedforward coefficient (live update).
| kA | Acceleration feedforward coefficient. |
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Set the derivative gain (live update).
| kD | Derivative gain. |
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Set the gravity feedforward gain (live update).
Uses kCos if an arm feedforward is configured (cosine gravity compensation), or kG otherwise (elevator/simple constant gravity compensation).
| kG | Gravity compensation coefficient. |
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Set the integral gain (live update).
| kI | Integral gain. |
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Set the proportional gain (live update).
| kP | Proportional gain. |
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Set the static friction feedforward (live update).
| kS | Static friction voltage. |
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Set the velocity feedforward coefficient (live update).
| kV | Velocity feedforward coefficient. |
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Set the lower soft limit via a linear measurement.
Requires both a mechanism circumference and an upper limit to already be configured. Converts the distance to turns using the circumference and applies it as the reverse soft limit on the SPARK hardware.
| lowerLimit | Minimum linear distance the mechanism may travel in reverse. |
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Set the upper soft limit via a linear measurement.
Requires both a mechanism circumference and a lower limit to already be configured. Converts the distance to turns using the circumference and applies it as the forward soft limit on the SPARK hardware.
| upperLimit | Maximum linear distance the mechanism may travel forward. |
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Update the mechanism circumference and rewrite the SPARK values that depend on it.
| circumference | New mechanism circumference. |
Reimplemented from yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Update the mechanism gearing and rewrite the SPARK values that depend on it (gains, MAXMotion constraints, tolerance and soft limits).
| gearing | New mechanism gearing. |
Reimplemented from yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Set both angular soft limits for the mechanism.
| lower | Lower angle limit. |
| upper | Upper angle limit. |
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Enable or disable the mechanism angular soft limits.
| enabled | true to enforce the limits. |
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Set the lower angular soft limit for the mechanism.
| lowerLimit | Lower angle limit. |
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Set the upper angular soft limit for the mechanism.
| upperLimit | Upper angle limit. |
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Set the maximum linear acceleration for the motion profile. Converts linear acceleration to turns per second squared using the configured mechanism circumference.
| maxAcc | Maximum linear acceleration. |
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Set the maximum angular acceleration for the motion profile.
| maxAcc | Maximum mechanism angular acceleration. |
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Set the maximum jerk of a velocity trapezoidal profile (its acceleration constraint). Has no effect on position profiles. MAXMotion has no jerk limit, so only the RoboRIO profile changes.
| maxJerk | Maximum angular jerk. |
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Set the maximum linear velocity for the motion profile. Converts linear velocity to turns per second using the configured mechanism circumference.
| maxVelocity | Maximum linear velocity. |
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Set the maximum angular velocity for the motion profile.
| maxVelocity | Maximum mechanism angular velocity. |
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Set the motor output direction.
| inverted | true to invert the motor direction. |
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Set the open-loop output ramp rate.
| rampRate | Time to ramp from 0 to full output. |
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Command a linear measurement position setpoint (closed-loop). Converts distance to turns using the configured mechanism circumference.
| distance | Target linear distance. |
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Command a mechanism angle position setpoint (closed-loop).
| angle | Target mechanism angle. |
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Set the stator (output) current limit.
| currentLimit | Maximum stator current. |
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Supply current limits are not supported on SPARKs; has no effect.
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Initialize the DCMotorSim used for simulation.
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Command a linear measurement velocity setpoint (closed-loop). Converts linear velocity to turns per second using the configured mechanism circumference.
| velocity | Target linear velocity. |
Implements yams::motorcontrollers::SmartMotorController.
|
virtual |
Command a linear measurement velocity setpoint (closed-loop).
| velocity | Target linear velocity. |
Implements yams::motorcontrollers::SmartMotorController.
| void yams::motorcontrollers::SmartMotorController::SetVelocity | ( | wpi::units::meters_per_second_t | velocity, |
| wpi::units::newton_t | feedforwardForce | ||
| ) |
Command a linear velocity setpoint with an additional feedforward force applied on top.
Throws SmartMotorControllerConfigurationException if the mechanism circumference is not configured.
| velocity | Target linear velocity. |
| feedforwardForce | Additional feedforward force at the mechanism. |
|
overridevirtual |
Command a mechanism angular velocity setpoint (closed-loop).
| velocity | Target mechanism angular velocity. |
Implements yams::motorcontrollers::SmartMotorController.
|
virtual |
Command a mechanism angular velocity setpoint (closed-loop).
| velocity | Target mechanism angular velocity. |
Implements yams::motorcontrollers::SmartMotorController.
|
virtual |
Command a mechanism angular velocity setpoint with an additional feedforward force applied on top, e.g. from a path-following set-point generator.
The force is converted to a voltage with SmartMotorControllerConfig::ConvertToVoltage and added by the RoboRIO closed-loop controller, so the mechanism circumference must be set.
| velocity | Target mechanism angular velocity. |
| feedforwardForce | Additional feedforward force at the mechanism. |
Reimplemented from yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Command a velocity setpoint with an additional feedforward force, sent to the SPARK as an arbitrary feedforward voltage (or added by the RoboRIO loop when an LQR is used).
| velocity | Target mechanism angular velocity. |
| feedforwardForce | Additional feedforward force at the mechanism. |
Reimplemented from yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Command a voltage output to the motor.
| voltage | Voltage to apply. |
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Set the idle (neutral) mode of the motor.
| mode | COAST or BRAKE. |
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Advance the motor simulation by one loop iteration.
Implements yams::motorcontrollers::SmartMotorController.
|
overridevirtual |
Periodically re-synchronize the relative encoder to the absolute sensor.
Implements yams::motorcontrollers::SmartMotorController.