SharpIR

class wpilib.SharpIR(channel: int, a: float, b: float, minCM: float, maxCM: float)

Bases: Sendable

Manually construct a SharpIR object. The distance is computed using this formula: A*v ^ B. Prefer to use one of the static factories to create this device instead.

Parameters:
  • channel – Analog input channel the sensor is connected to

  • a – Constant A

  • b – Constant B

  • minCM – Minimum distance to report in centimeters

  • maxCM – Maximum distance to report in centimeters

static GP2Y0A02YK0F(channel: int) wpilib._wpilib.SharpIR

Sharp GP2Y0A02YK0F is an analog IR sensor capable of measuring distances from 20cm to 150cm.

Parameters:

channel – Analog input channel the sensor is connected to

Returns:

sensor object

static GP2Y0A21YK0F(channel: int) wpilib._wpilib.SharpIR

Sharp GP2Y0A21YK0F is an analog IR sensor capable of measuring distances from 10cm to 80cm.

Parameters:

channel – Analog input channel the sensor is connected to

Returns:

sensor object

static GP2Y0A41SK0F(channel: int) wpilib._wpilib.SharpIR

Sharp GP2Y0A41SK0F is an analog IR sensor capable of measuring distances from 4cm to 30cm.

Parameters:

channel – Analog input channel the sensor is connected to

Returns:

sensor object

static GP2Y0A51SK0F(channel: int) wpilib._wpilib.SharpIR

Sharp GP2Y0A51SK0F is an analog IR sensor capable of measuring distances from 2cm to 15cm.

Parameters:

channel – Analog input channel the sensor is connected to

Returns:

sensor object

getChannel() int

Get the analog input channel number.

Returns:

analog input channel

getRange() wpimath.units.centimeters

Get the range from the distance sensor.

Returns:

range of the target returned by the sensor

initSendable(builder: wpiutil._wpiutil.SendableBuilder) None