File tree Expand file tree Collapse file tree 3 files changed +26
-2
lines changed
Expand file tree Collapse file tree 3 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -171,7 +171,15 @@ public class {{subsystemName}} extends SubsystemBase {
171171 // Set input voltage from motor controller to simulation
172172 // Note: This may need to be talonfx.getSimState().getMotorVoltage() as the input.
173173 //armSim.setInput(dcMotor.getVoltage(dcMotor.getTorque(armSim.getCurrentDrawAmps()), armSim.getVelocityRadPerSec()));
174+ // armSim.setInput(getVoltage());
175+ // Sets input voltage based on whether it is talon fx or not
176+ {{ #if (or (eq motorControllerType ' TalonFX' ) (eq motorControllerType ' TalonFXS' ))}}
177+ // Use motor voltage for TalonFX simulation input
178+ armSim.setInput(talonfx.getSimState().getMotorVoltage());
179+ {{ else }}
180+ // Use getVoltage() for other controllers
174181 armSim.setInput(getVoltage());
182+ {{ /if }}
175183
176184 // Update simulation by 20ms
177185 armSim.update(0.020);
Original file line number Diff line number Diff line change @@ -170,7 +170,15 @@ public class {{subsystemName}} extends SubsystemBase {
170170 // Set input voltage from motor controller to simulation
171171 // Note: This may need to be talonfx.getSimState().getMotorVoltage() as the input
172172 //elevatorSim.setInput(dcMotor.getVoltage(dcMotor.getTorque(elevatorSim.getCurrentDrawAmps()), elevatorSim.getVelocityMetersPerSecond() * positionToRotations * 2 * Math.PI));
173- elevatorSim.setInput(getVoltage());
173+ // elevatorSim.setInput(getVoltage());
174+
175+ {{ #if (or (eq motorControllerType ' TalonFX' ) (eq motorControllerType ' TalonFXS' ))}}
176+ // Use motor voltage for TalonFX simulation input
177+ elevatorSim.setInput(motor.getSimState().getMotorVoltage());
178+ {{ else }}
179+ // Use getVoltage() for other controllers
180+ elevatorSim.setInput(getVoltage());
181+ {{ /if }}
174182
175183 // Update simulation by 20ms
176184 elevatorSim.update(0.020);
Original file line number Diff line number Diff line change @@ -178,7 +178,15 @@ public void simulationPeriodic() {
178178 // Set input voltage from motor controller to simulation
179179 // Note: This may need to be talonfx.getSimState().getMotorVoltage() as the input
180180 //pivotSim.setInput(dcMotor.getVoltage(dcMotor.getTorque(pivotSim.getCurrentDrawAmps()), pivotSim.getVelocityRadPerSec()));
181- pivotSim.setInput(getVoltage());
181+ // pivotSim.setInput(getVoltage());
182+ // Set input voltage from motor controller to simulation
183+ {{ #if (or (eq motorControllerType ' TalonFX' ) (eq motorControllerType ' TalonFXS' ))}}
184+ // Use motor voltage for TalonFX simulation input
185+ pivotSim.setInput(motor.getSimState().getMotorVoltage());
186+ {{ else }}
187+ // Use getVoltage() for other controllers
188+ pivotSim.setInput(getVoltage());
189+ {{ /if }}
182190
183191 // Update simulation by 20ms
184192 pivotSim.update(0.020);
You can’t perform that action at this time.
0 commit comments