Table of Contents

Class ProximityParamsConfigs

Namespace
CTRE.Phoenix6.Configs
Assembly
Phoenix6.Hardware.dll

Configs that affect the ToF Proximity detection

Includes proximity mode and the threshold for simple detection
public class ProximityParamsConfigs : IParentConfiguration, ISerializable, ICloneable
Inheritance
ProximityParamsConfigs
Implements
Inherited Members

Fields

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 Value1
  • Maximum Value15000
  • Default Value2500
  • Units
public double MinSignalStrengthForValidMeasurement

Field Value

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 Value0
  • Maximum Value1
  • Default Value0.01
  • Unitsm
public double ProximityHysteresis

Field Value

double

ProximityThreshold

Threshold for object detection.

  • Minimum Value0
  • Maximum Value4
  • Default Value0.4
  • Unitsm
public double ProximityThreshold

Field Value

double

Methods

Clone()

Creates a copy of this config group.

public ProximityParamsConfigs Clone()

Returns

ProximityParamsConfigs

Deserialize(string)

Deserialize string and put values into this object

public StatusCode Deserialize(string to_deserialize)

Parameters

to_deserialize string

String to deserialize

Returns

StatusCode

OK if deserialization is OK

Serialize()

Serialize this object into a string

public string Serialize()

Returns

string

This object's data serialized into a string

ToString()

Provides the string representation of this object

public override string ToString()

Returns

string

WithMinSignalStrengthForValidMeasurement(double)

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 Value1
  • Maximum Value15000
  • Default Value2500
  • Units
public ProximityParamsConfigs WithMinSignalStrengthForValidMeasurement(double newMinSignalStrengthForValidMeasurement)

Parameters

newMinSignalStrengthForValidMeasurement double

Parameter to modify

Returns

ProximityParamsConfigs

Itself

WithProximityHysteresis(double)

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 Value0
  • Maximum Value1
  • Default Value0.01
  • Unitsm
public ProximityParamsConfigs WithProximityHysteresis(double newProximityHysteresis)

Parameters

newProximityHysteresis double

Parameter to modify

Returns

ProximityParamsConfigs

Itself

WithProximityThreshold(double)

Modifies this configuration's ProximityThreshold parameter and returns itself for method-chaining and easier to use config API.

Threshold for object detection.
  • Minimum Value0
  • Maximum Value4
  • Default Value0.4
  • Unitsm
public ProximityParamsConfigs WithProximityThreshold(double newProximityThreshold)

Parameters

newProximityThreshold double

Parameter to modify

Returns

ProximityParamsConfigs

Itself