Class DifferentialMotorConstants<MotorConfigsT extends ParentConfiguration>

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

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

    • Network

      public CANBus Network
      The network the mechanism is on. 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

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

      public double 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

      public MotorConfigsT extends ParentConfiguration 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

      public MotorConfigsT extends ParentConfiguration 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

      public boolean 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

    • DifferentialMotorConstants

      public DifferentialMotorConstants()
  • Method Details

    • withNetwork

      public final DifferentialMotorConstants<MotorConfigsT> withNetwork(CANBus newNetwork)
      Modifies the Network parameter and returns itself.

      The network the mechanism is on. Note that all devices must be on the same CAN bus.

      Parameters:
      newNetwork - Parameter to modify
      Returns:
      this object
    • withLeaderId

      public final DifferentialMotorConstants<MotorConfigsT> withLeaderId(int newLeaderId)
      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

      public final DifferentialMotorConstants<MotorConfigsT> withFollowerId(int newFollowerId)
      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

      public final DifferentialMotorConstants<MotorConfigsT> withAlignment(MotorAlignmentValue newAlignment)
      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 final 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 final 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

      public final DifferentialMotorConstants<MotorConfigsT> withClosedLoopRate(Frequency 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
    • withLeaderInitialConfigs

      public final DifferentialMotorConstants<MotorConfigsT> withLeaderInitialConfigs(MotorConfigsT newLeaderInitialConfigs)
      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

      public final DifferentialMotorConstants<MotorConfigsT> withFollowerInitialConfigs(MotorConfigsT newFollowerInitialConfigs)
      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 final 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