WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
wpi::SharpIR Class Reference

#include <wpi/hardware/range/SharpIR.hpp>

Inheritance diagram for wpi::SharpIR:
wpi::util::Sendable wpi::util::SendableHelper< SharpIR >

Public Member Functions

 SharpIR (int channel, double a, double b, wpi::units::meter_t min, wpi::units::meter_t max)
 Manually construct a SharpIR object.
int GetChannel () const
 Get the analog input channel number.
wpi::units::meter_t GetRange () const
 Get the range from the distance sensor.
void InitSendable (wpi::util::SendableBuilder &builder) override
 Initializes this Sendable object.
Public Member Functions inherited from wpi::util::Sendable
virtual constexpr ~Sendable ()=default
Public Member Functions inherited from wpi::util::SendableHelper< SharpIR >
constexpr SendableHelper (const SendableHelper &rhs)=default
constexpr SendableHelperoperator= (const SendableHelper &rhs)=default

Static Public Member Functions

static SharpIR GP2Y0A02YK0F (int channel)
 Sharp GP2Y0A02YK0F is an analog IR sensor capable of measuring distances from 20cm to 150cm.
static SharpIR GP2Y0A21YK0F (int channel)
 Sharp GP2Y0A21YK0F is an analog IR sensor capable of measuring distances from 10cm to 80cm.
static SharpIR GP2Y0A41SK0F (int channel)
 Sharp GP2Y0A41SK0F is an analog IR sensor capable of measuring distances from 4cm to 30cm.
static SharpIR GP2Y0A51SK0F (int channel)
 Sharp GP2Y0A51SK0F is an analog IR sensor capable of measuring distances from 2cm to 15cm.

Additional Inherited Members

Protected Member Functions inherited from wpi::util::SendableHelper< SharpIR >
constexpr ~SendableHelper ()

Constructor & Destructor Documentation

◆ SharpIR()

wpi::SharpIR::SharpIR ( int channel,
double a,
double b,
wpi::units::meter_t min,
wpi::units::meter_t max )

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
channelAnalog input channel the sensor is connected to
aConstant A
bConstant B
minMinimum distance to report
maxMaximum distance to report

Member Function Documentation

◆ GetChannel()

int wpi::SharpIR::GetChannel ( ) const

Get the analog input channel number.

Returns
analog input channel

◆ GetRange()

wpi::units::meter_t wpi::SharpIR::GetRange ( ) const

Get the range from the distance sensor.

Returns
range of the target returned by the sensor

◆ GP2Y0A02YK0F()

SharpIR wpi::SharpIR::GP2Y0A02YK0F ( int channel)
static

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

Parameters
channelAnalog input channel the sensor is connected to
Returns
sensor object

◆ GP2Y0A21YK0F()

SharpIR wpi::SharpIR::GP2Y0A21YK0F ( int channel)
static

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

Parameters
channelAnalog input channel the sensor is connected to
Returns
sensor object

◆ GP2Y0A41SK0F()

SharpIR wpi::SharpIR::GP2Y0A41SK0F ( int channel)
static

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

Parameters
channelAnalog input channel the sensor is connected to
Returns
sensor object

◆ GP2Y0A51SK0F()

SharpIR wpi::SharpIR::GP2Y0A51SK0F ( int channel)
static

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

Parameters
channelAnalog input channel the sensor is connected to
Returns
sensor object

◆ InitSendable()

void wpi::SharpIR::InitSendable ( wpi::util::SendableBuilder & builder)
overridevirtual

Initializes this Sendable object.

Parameters
buildersendable builder

Implements wpi::util::Sendable.


The documentation for this class was generated from the following file: