Class ProximityParamsConfigs

java.lang.Object
com.ctre.phoenix6.configs.ProximityParamsConfigs
All Implemented Interfaces:
ParentConfiguration, ISerializable

public class ProximityParamsConfigs extends Object implements ParentConfiguration
Configs that affect the ToF Proximity detection

Includes proximity mode and the threshold for simple detection

  • Field Details

    • ProximityThreshold

      public double ProximityThreshold
      Threshold for object detection.
      • Minimum Value: 0
      • Maximum Value: 4
      • Default Value: 0.4
      • Units: m
    • ProximityHysteresis

      public double ProximityHysteresis
      How far above and below the threshold the distance needs to be to trigger undetected and detected, respectively. This is used to prevent bouncing between the detected and undetected states for objects on the threshold.

      If the threshold is set to 0.1 meters, and the hysteresis is 0.01 meters, then an object needs to be within 0.09 meters to be detected. After the object is first detected, the distance then needs to exceed 0.11 meters to become undetected again.

      • Minimum Value: 0
      • Maximum Value: 1
      • Default Value: 0.01
      • Units: m
    • MinSignalStrengthForValidMeasurement

      The minimum allowable signal strength before determining the measurement is valid.

      If the signal strength is particularly low, this typically means the object is far away and there's fewer total samples to derive the distance from. Set this value to be below the lowest strength you see when you're detecting an object with the CANrange; the default of 2500 is typically acceptable in most cases.

      • Minimum Value: 1
      • Maximum Value: 15000
      • Default Value: 2500
      • Units:
  • Constructor Details

  • Method Details

    • withProximityThreshold

      public ProximityParamsConfigs withProximityThreshold(double newProximityThreshold)
      Modifies this configuration's ProximityThreshold parameter and returns itself for method-chaining and easier to use config API.

      Threshold for object detection.

      • Minimum Value: 0
      • Maximum Value: 4
      • Default Value: 0.4
      • Units: m
      Parameters:
      newProximityThreshold - Parameter to modify
      Returns:
      Itself
    • withProximityThreshold

      public ProximityParamsConfigs withProximityThreshold(Distance newProximityThreshold)
      Modifies this configuration's ProximityThreshold parameter and returns itself for method-chaining and easier to use config API.

      Threshold for object detection.

      • Minimum Value: 0
      • Maximum Value: 4
      • Default Value: 0.4
      • Units: m
      Parameters:
      newProximityThreshold - Parameter to modify
      Returns:
      Itself
    • getProximityThresholdMeasure

      Helper method to get this configuration's ProximityThreshold parameter converted to a unit type. If not using the Java units library, ProximityThreshold can be accessed directly instead.

      Threshold for object detection.

      • Minimum Value: 0
      • Maximum Value: 4
      • Default Value: 0.4
      • Units: m
      Returns:
      ProximityThreshold
    • withProximityHysteresis

      public ProximityParamsConfigs withProximityHysteresis(double newProximityHysteresis)
      Modifies this configuration's ProximityHysteresis parameter and returns itself for method-chaining and easier to use config API.

      How far above and below the threshold the distance needs to be to trigger undetected and detected, respectively. This is used to prevent bouncing between the detected and undetected states for objects on the threshold.

      If the threshold is set to 0.1 meters, and the hysteresis is 0.01 meters, then an object needs to be within 0.09 meters to be detected. After the object is first detected, the distance then needs to exceed 0.11 meters to become undetected again.

      • Minimum Value: 0
      • Maximum Value: 1
      • Default Value: 0.01
      • Units: m
      Parameters:
      newProximityHysteresis - Parameter to modify
      Returns:
      Itself
    • withProximityHysteresis

      public ProximityParamsConfigs withProximityHysteresis(Distance newProximityHysteresis)
      Modifies this configuration's ProximityHysteresis parameter and returns itself for method-chaining and easier to use config API.

      How far above and below the threshold the distance needs to be to trigger undetected and detected, respectively. This is used to prevent bouncing between the detected and undetected states for objects on the threshold.

      If the threshold is set to 0.1 meters, and the hysteresis is 0.01 meters, then an object needs to be within 0.09 meters to be detected. After the object is first detected, the distance then needs to exceed 0.11 meters to become undetected again.

      • Minimum Value: 0
      • Maximum Value: 1
      • Default Value: 0.01
      • Units: m
      Parameters:
      newProximityHysteresis - Parameter to modify
      Returns:
      Itself
    • getProximityHysteresisMeasure

      Helper method to get this configuration's ProximityHysteresis parameter converted to a unit type. If not using the Java units library, ProximityHysteresis can be accessed directly instead.

      How far above and below the threshold the distance needs to be to trigger undetected and detected, respectively. This is used to prevent bouncing between the detected and undetected states for objects on the threshold.

      If the threshold is set to 0.1 meters, and the hysteresis is 0.01 meters, then an object needs to be within 0.09 meters to be detected. After the object is first detected, the distance then needs to exceed 0.11 meters to become undetected again.

      • Minimum Value: 0
      • Maximum Value: 1
      • Default Value: 0.01
      • Units: m
      Returns:
      ProximityHysteresis
    • withMinSignalStrengthForValidMeasurement

      public ProximityParamsConfigs withMinSignalStrengthForValidMeasurement(double newMinSignalStrengthForValidMeasurement)
      Modifies this configuration's MinSignalStrengthForValidMeasurement parameter and returns itself for method-chaining and easier to use config API.

      The minimum allowable signal strength before determining the measurement is valid.

      If the signal strength is particularly low, this typically means the object is far away and there's fewer total samples to derive the distance from. Set this value to be below the lowest strength you see when you're detecting an object with the CANrange; the default of 2500 is typically acceptable in most cases.

      • Minimum Value: 1
      • Maximum Value: 15000
      • Default Value: 2500
      • Units:
      Parameters:
      newMinSignalStrengthForValidMeasurement - Parameter to modify
      Returns:
      Itself
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • deserialize

      public StatusCode deserialize(String to_deserialize)
      Specified by:
      deserialize in interface ParentConfiguration
    • serialize

      public String serialize()
      Specified by:
      serialize in interface ISerializable