Class DifferentialMotorConstants<MotorConfigsT extends ParentConfiguration>

java.lang.Object
com.ctre.phoenix6.mechanisms.DifferentialMotorConstants<MotorConfigsT>

public class DifferentialMotorConstants<MotorConfigsT extends ParentConfiguration> extends Object
  • Field Details

    • CANBusName

      Name of the CAN bus the mechanism is on. Possible CAN bus strings are:
      • "rio" for the native roboRIO CAN bus
      • CANivore name or serial number
      • SocketCAN interface (non-FRC Linux only)
      • "*" for any CANivore seen by the program
      • empty string (default) to select the default for the system:
        • "rio" on roboRIO
        • "can0" on Linux
        • "*" on Windows
      Note that all devices must be on the same CAN bus.
    • LeaderId

      public int LeaderId
      CAN ID of the leader motor in the differential mechanism. The leader will have the differential output added to its regular output.
    • FollowerId

      public int FollowerId
      CAN ID of the follower motor in the differential mechanism. The follower will have the differential output subtracted from its regular output.
    • Alignment

      The alignment of the differential leader and follower motors, ignoring the configured inverts.
    • SensorToDifferentialRatio

      The ratio of sensor rotations to the differential mechanism's difference output, where a ratio greater than 1 is a reduction.

      When not using a separate sensor on the difference axis, the sensor is considered half of the difference between the two motor controllers' mechanism positions/velocities. As a result, this should be set to the gear ratio on the difference axis in that scenario, or any gear ratio between the sensor and the mechanism differential when using another sensor source.

    • ClosedLoopRate

      public double ClosedLoopRate
      The update rate of the closed-loop controllers. This determines the update rate of the differential leader's DifferentialOutput status signal, the follower's Position and Velocity signals, and the relevant signals for any other selected differential sensor.
    • LeaderInitialConfigs

      The initial configs used to configure the differential leader. The default value is the factory-default.

      Users may change the initial configuration as they need. Any config that's not referenced in the DifferentialMotorConstants class is available to be changed.

      The list of configs that will be overwritten is as follows:

    • FollowerInitialConfigs

      The initial configs used to configure the differential follower. The default value is the factory-default.

      Users may change the initial configuration as they need. Any config that's not referenced in the DifferentialMotorConstants class is available to be changed.

      The list of configs that will be overwritten is as follows:

      If FollowerUsesCommonLeaderConfigs is set to true (default), the following configs are copied from LeaderInitialConfigs:
    • FollowerUsesCommonLeaderConfigs

      Whether the follower should overwrite some of its initial configs with common configs from the LeaderInitialConfigs, such as current limits. The list of configs that are copied is documented in FollowerInitialConfigs.
  • Constructor Details

  • Method Details

    • withCANBusName

      Modifies the CANBusName parameter and returns itself.

      Name of the CAN bus the mechanism is on. Possible CAN bus strings are:

      • "rio" for the native roboRIO CAN bus
      • CANivore name or serial number
      • SocketCAN interface (non-FRC Linux only)
      • "*" for any CANivore seen by the program
      • empty string (default) to select the default for the system:
        • "rio" on roboRIO
        • "can0" on Linux
        • "*" on Windows
      Note that all devices must be on the same CAN bus.
      Parameters:
      newCANBusName - Parameter to modify
      Returns:
      this object
    • withLeaderId

      Modifies the LeaderId parameter and returns itself.

      CAN ID of the leader motor in the differential mechanism. The leader will have the differential output added to its regular output.

      Parameters:
      newLeaderId - Parameter to modify
      Returns:
      this object
    • withFollowerId

      Modifies the FollowerId parameter and returns itself.

      CAN ID of the follower motor in the differential mechanism. The follower will have the differential output subtracted from its regular output.

      Parameters:
      newFollowerId - Parameter to modify
      Returns:
      this object
    • withAlignment

      Modifies the Alignment parameter and returns itself.

      The alignment of the differential leader and follower motors, ignoring the configured inverts.

      Parameters:
      newAlignment - Parameter to modify
      Returns:
      this object
    • withSensorToDifferentialRatio

      public DifferentialMotorConstants<MotorConfigsT> withSensorToDifferentialRatio(double newSensorToDifferentialRatio)
      Modifies the SensorToDifferentialRatio parameter and returns itself.

      The ratio of sensor rotations to the differential mechanism's difference output, where a ratio greater than 1 is a reduction.

      When not using a separate sensor on the difference axis, the sensor is considered half of the difference between the two motor controllers' mechanism positions/velocities. As a result, this should be set to the gear ratio on the difference axis in that scenario, or any gear ratio between the sensor and the mechanism differential when using another sensor source.

      Parameters:
      newSensorToDifferentialRatio - Parameter to modify
      Returns:
      this object
    • withClosedLoopRate

      public DifferentialMotorConstants<MotorConfigsT> withClosedLoopRate(double newClosedLoopRate)
      Modifies the ClosedLoopRate parameter and returns itself.

      The update rate of the closed-loop controllers. This determines the update rate of the differential leader's DifferentialOutput status signal, the follower's Position and Velocity signals, and the relevant signals for any other selected differential sensor.

      Parameters:
      newClosedLoopRate - Parameter to modify
      Returns:
      this object
    • withClosedLoopRate

      Modifies the ClosedLoopRate parameter and returns itself.

      The update rate of the closed-loop controllers. This determines the update rate of the differential leader's DifferentialOutput status signal, the follower's Position and Velocity signals, and the relevant signals for any other selected differential sensor.

      Parameters:
      newClosedLoopRate - Parameter to modify
      Returns:
      this object
    • withLeaderInitialConfigs

      Modifies the LeaderInitialConfigs parameter and returns itself.

      The initial configs used to configure the differential leader. The default value is the factory-default.

      Users may change the initial configuration as they need. Any config that's not referenced in the DifferentialMotorConstants class is available to be changed.

      The list of configs that will be overwritten is as follows:

      Parameters:
      newLeaderInitialConfigs - Parameter to modify
      Returns:
      this object
    • withFollowerInitialConfigs

      Modifies the FollowerInitialConfigs parameter and returns itself.

      The initial configs used to configure the differential follower. The default value is the factory-default.

      Users may change the initial configuration as they need. Any config that's not referenced in the DifferentialMotorConstants class is available to be changed.

      The list of configs that will be overwritten is as follows:

      If FollowerUsesCommonLeaderConfigs is set to true (default), the following configs are copied from LeaderInitialConfigs:
      Parameters:
      newFollowerInitialConfigs - Parameter to modify
      Returns:
      this object
    • withFollowerUsesCommonLeaderConfigs

      public DifferentialMotorConstants<MotorConfigsT> withFollowerUsesCommonLeaderConfigs(boolean newFollowerUsesCommonLeaderConfigs)
      Modifies the FollowerUsesCommonLeaderConfigs parameter and returns itself.

      Whether the follower should overwrite some of its initial configs with common configs from the LeaderInitialConfigs, such as current limits. The list of configs that are copied is documented in FollowerInitialConfigs.

      Parameters:
      newFollowerUsesCommonLeaderConfigs - Parameter to modify
      Returns:
      this object