Package frc.spectrumLib.swerve
Class MapleSimSwerveDrivetrain.TalonFXMotorControllerWithRemoteCanCoderSim
java.lang.Object
frc.spectrumLib.swerve.MapleSimSwerveDrivetrain.TalonFXMotorControllerSim
frc.spectrumLib.swerve.MapleSimSwerveDrivetrain.TalonFXMotorControllerWithRemoteCanCoderSim
- All Implemented Interfaces:
SimulatedMotorController
- Enclosing class:
- MapleSimSwerveDrivetrain
public static class MapleSimSwerveDrivetrain.TalonFXMotorControllerWithRemoteCanCoderSim
extends MapleSimSwerveDrivetrain.TalonFXMotorControllerSim
Extends
MapleSimSwerveDrivetrain.TalonFXMotorControllerSim to also drive a remote CANcoder simulation state.
Used for steer motors whose feedback device is a remote CANcoder.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.ironmaple.simulation.motorsims.SimulatedMotorController
SimulatedMotorController.GenericMotorController -
Field Summary
Fields inherited from class frc.spectrumLib.swerve.MapleSimSwerveDrivetrain.TalonFXMotorControllerSim
id -
Constructor Summary
ConstructorsConstructorDescriptionTalonFXMotorControllerWithRemoteCanCoderSim(TalonFX talonFX, CANcoder cancoder) Constructs the adapter for a steer motor paired with a remote CANcoder. -
Method Summary
Modifier and TypeMethodDescriptionupdateControlSignal(Angle mechanismAngle, AngularVelocity mechanismVelocity, Angle encoderAngle, AngularVelocity encoderVelocity) Injects simulated supply voltage, position, and velocity into the remote CANcoder sim state, then delegates to the parent implementation to update the TalonFX and return the requested motor voltage.
-
Constructor Details
-
TalonFXMotorControllerWithRemoteCanCoderSim
Constructs the adapter for a steer motor paired with a remote CANcoder.- Parameters:
talonFX- the steer TalonFX motor controllercancoder- the remote CANcoder used as the steer feedback sensor
-
-
Method Details
-
updateControlSignal
public Voltage updateControlSignal(Angle mechanismAngle, AngularVelocity mechanismVelocity, Angle encoderAngle, AngularVelocity encoderVelocity) Injects simulated supply voltage, position, and velocity into the remote CANcoder sim state, then delegates to the parent implementation to update the TalonFX and return the requested motor voltage.- Specified by:
updateControlSignalin interfaceSimulatedMotorController- Overrides:
updateControlSignalin classMapleSimSwerveDrivetrain.TalonFXMotorControllerSim- Parameters:
mechanismAngle- current mechanism-side angle (written to the CANcoder)mechanismVelocity- current mechanism-side angular velocity (written to the CANcoder)encoderAngle- current encoder (rotor-side) angle (forwarded to TalonFX)encoderVelocity- current encoder angular velocity (forwarded to TalonFX)- Returns:
- the voltage the controller is requesting from the simulated battery
-