Package swervelib.simulation.ctre
Class PhysicsSim
java.lang.Object
swervelib.simulation.ctre.PhysicsSim
Manages physics simulation for CTRE products.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classHolds information about a simulated device. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ArrayList<PhysicsSim.SimProfile>private static PhysicsSim -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTalonFX(com.ctre.phoenix.motorcontrol.can.TalonFX falcon, double accelToFullTime, double fullVel) Adds a TalonFX controller to the simulator.voidaddTalonFX(com.ctre.phoenix.motorcontrol.can.TalonFX falcon, double accelToFullTime, double fullVel, boolean sensorPhase) Adds a TalonFX controller to the simulator.voidaddTalonSRX(com.ctre.phoenix.motorcontrol.can.TalonSRX talon, double accelToFullTime, double fullVel) Adds a TalonSRX controller to the simulator.voidaddTalonSRX(com.ctre.phoenix.motorcontrol.can.TalonSRX talon, double accelToFullTime, double fullVel, boolean sensorPhase) Adds a TalonSRX controller to the simulator.voidaddVictorSPX(com.ctre.phoenix.motorcontrol.can.VictorSPX victor) Adds a VictorSPX controller to the simulator.static PhysicsSimGets the robot simulator instance.(package private) static doublerandom(double max) (package private) static doublerandom(double min, double max) voidrun()Runs the simulator: - enable the robot - simulate sensors
-
Field Details
-
sim
-
_simProfiles
-
-
Constructor Details
-
PhysicsSim
public PhysicsSim()
-
-
Method Details
-
getInstance
Gets the robot simulator instance.- Returns:
PhysicsSiminstance.
-
random
static double random(double min, double max) -
random
static double random(double max) -
addTalonSRX
public void addTalonSRX(com.ctre.phoenix.motorcontrol.can.TalonSRX talon, double accelToFullTime, double fullVel) Adds a TalonSRX controller to the simulator.- Parameters:
talon- The TalonSRX deviceaccelToFullTime- The time the motor takes to accelerate from 0 to full, in secondsfullVel- The maximum motor velocity, in ticks per 100ms
-
addTalonSRX
public void addTalonSRX(com.ctre.phoenix.motorcontrol.can.TalonSRX talon, double accelToFullTime, double fullVel, boolean sensorPhase) Adds a TalonSRX controller to the simulator.- Parameters:
talon- The TalonSRX deviceaccelToFullTime- The time the motor takes to accelerate from 0 to full, in secondsfullVel- The maximum motor velocity, in ticks per 100mssensorPhase- The phase of the TalonSRX sensors
-
addTalonFX
public void addTalonFX(com.ctre.phoenix.motorcontrol.can.TalonFX falcon, double accelToFullTime, double fullVel) Adds a TalonFX controller to the simulator.- Parameters:
falcon- The TalonFX deviceaccelToFullTime- The time the motor takes to accelerate from 0 to full, in secondsfullVel- The maximum motor velocity, in ticks per 100ms
-
addTalonFX
public void addTalonFX(com.ctre.phoenix.motorcontrol.can.TalonFX falcon, double accelToFullTime, double fullVel, boolean sensorPhase) Adds a TalonFX controller to the simulator.- Parameters:
falcon- The TalonFX deviceaccelToFullTime- The time the motor takes to accelerate from 0 to full, in secondsfullVel- The maximum motor velocity, in ticks per 100mssensorPhase- The phase of the TalonFX sensors
-
addVictorSPX
public void addVictorSPX(com.ctre.phoenix.motorcontrol.can.VictorSPX victor) Adds a VictorSPX controller to the simulator.- Parameters:
victor- The VictorSPX device
-
run
public void run()Runs the simulator: - enable the robot - simulate sensors
-