libPlayingWithFusion 2022.01.12
Playing With Fusion driver library for FRC roboRIO
frc::TMD37003 Class Reference

#include <TMD37003.h>

Public Member Functions

 TMD37003 (I2C::Port i2cPort)
 
void ConfigureColorSense (double alsIntegrationTime, int alsGain)
 
void ConfigureProximitySense (double proximitySampleTime, double proximityPulseLength, int numProximityPulses, int proximityGain, int proximityLedCurrent)
 
void SetGain (double r, double g, double b, double c, double gamma)
 
Color GetColor ()
 
double GetHue ()
 
double GetSaturation ()
 
double GetRed ()
 
double GetGreen ()
 
double GetBlue ()
 
double GetAmbientLightLevel ()
 
double GetProximity ()
 

Constructor & Destructor Documentation

◆ TMD37003()

TMD37003::TMD37003 ( I2C::Port  i2cPort)

Create Instance of TMD3700 color sensor driver.

Parameters
i2cPortInternal/MXP I2C port on the roboRIO

Member Function Documentation

◆ ConfigureColorSense()

void TMD37003::ConfigureColorSense ( double  alsIntegrationTime,
int  alsGain 
)

Configure TMD3700 Color (Ambient Light Sensing) parameters.

Parameters
alsIntegrationTimeColor sensing sample time in milliseconds. Value may range from 2.8 to 721ms. Longer sample times act to filtered the sampled color.
alsGainColor sensor gain as a value between 1 and 64.

◆ ConfigureProximitySense()

void TMD37003::ConfigureProximitySense ( double  proximitySampleTime,
double  proximityPulseLength,
int  numProximityPulses,
int  proximityGain,
int  proximityLedCurrent 
)

Configure TMD3700 Proximity sense parameters.

Parameters
proximitySampleTimeProximity sensing sample time in milliseconds. Value may range from 0.088 to 22.528 ms.
proximityPulseLengthLengh of each IR LED pulse during proximity measurement in milliseconds. Value must fall between 0.004 and 0.032 ms.
numProximityPulsesNumber of proximity IR LED pulses which occur during each sample period
proximityGainProximity sensor gain as a value between 1 and 8.
proximityLedCurrentProximity IR LED current in milliamps. Value must fall between 6 and 192 mA

◆ GetAmbientLightLevel()

double TMD37003::GetAmbientLightLevel ( )

Get clear (Ambient) channel value.

Returns
Normalized clear channel value as ratio between 0 and 1.

◆ GetBlue()

double TMD37003::GetBlue ( )

Get blue channel value.

Returns
Normalized blue channel value as ratio between 0 and 1..

◆ GetColor()

Color TMD37003::GetColor ( )

Get gamma corrected RGB values from sensor

Returns
Value of RGB samples

◆ GetGreen()

double TMD37003::GetGreen ( )

Get green channel value.

Returns
Normalized green channel value as ratio between 0 and 1..

◆ GetHue()

double TMD37003::GetHue ( )

Get the measured color (hue).

Returns
Measured hue in degrees

◆ GetProximity()

double TMD37003::GetProximity ( )

Get proximity value.

Returns
Normalized proximity value as ratio between 0 and 1.

◆ GetRed()

double TMD37003::GetRed ( )

Get red channel value.

Returns
Normalized red channel value as ratio between 0 and 1..

◆ GetSaturation()

double TMD37003::GetSaturation ( )

Get measured color saturation.

Returns
Measured saturation as ratio between 0 and 1

◆ SetGain()

void TMD37003::SetGain ( double  r,
double  g,
double  b,
double  c,
double  gamma 
)

Specifiy gains and gamma value to convert raw RGB samples to normalized RGB values to aproximate sRGB space.

The default gains are calibrated for the built in white LED. If another lighting source is used this function may be required to specify the white point.

Channels are calculated using:

{Normilized value} = ({Raw value} * gain) ^ (1/gamma)

Parameters
rRed channel gain
gGreen channel gain
bBlue channel gain
cClear (ambient) channel gain
gammaGamma vaulke used to convert raw (linear) samples to something that responds like a human eye

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