Class PhysicsSim

java.lang.Object
swervelib.simulation.ctre.PhysicsSim

public class PhysicsSim extends Object
Manages physics simulation for CTRE products.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    (package private) static class 
    Holds information about a simulated device.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
    private static final PhysicsSim
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addTalonFX(com.ctre.phoenix.motorcontrol.can.TalonFX falcon, double accelToFullTime, double fullVel)
    Adds a TalonFX controller to the simulator.
    void
    addTalonFX(com.ctre.phoenix.motorcontrol.can.TalonFX falcon, double accelToFullTime, double fullVel, boolean sensorPhase)
    Adds a TalonFX controller to the simulator.
    void
    addTalonSRX(com.ctre.phoenix.motorcontrol.can.TalonSRX talon, double accelToFullTime, double fullVel)
    Adds a TalonSRX controller to the simulator.
    void
    addTalonSRX(com.ctre.phoenix.motorcontrol.can.TalonSRX talon, double accelToFullTime, double fullVel, boolean sensorPhase)
    Adds a TalonSRX controller to the simulator.
    void
    addVictorSPX(com.ctre.phoenix.motorcontrol.can.VictorSPX victor)
    Adds a VictorSPX controller to the simulator.
    static PhysicsSim
    Gets the robot simulator instance.
    (package private) static double
    random(double max)
     
    (package private) static double
    random(double min, double max)
     
    void
    run()
    Runs the simulator: - enable the robot - simulate sensors

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • PhysicsSim

      public PhysicsSim()
  • Method Details

    • getInstance

      public static PhysicsSim getInstance()
      Gets the robot simulator instance.
      Returns:
      PhysicsSim instance.
    • 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 device
      accelToFullTime - The time the motor takes to accelerate from 0 to full, in seconds
      fullVel - 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 device
      accelToFullTime - The time the motor takes to accelerate from 0 to full, in seconds
      fullVel - The maximum motor velocity, in ticks per 100ms
      sensorPhase - 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 device
      accelToFullTime - The time the motor takes to accelerate from 0 to full, in seconds
      fullVel - 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 device
      accelToFullTime - The time the motor takes to accelerate from 0 to full, in seconds
      fullVel - The maximum motor velocity, in ticks per 100ms
      sensorPhase - 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