TMD37003

class playingwithfusion.TMD37003(i2cPort: wpilib._wpilib.I2C.Port)

Bases: pybind11_builtins.pybind11_object

Create Instance of TMD3700 color sensor driver.

Parameters

i2cPort – Internal/MXP I2C port on the roboRIO

configureColorSense(alsIntegrationTime: float, alsGain: int)None

Configure TMD3700 Color (Ambient Light Sensing) parameters.

Parameters
  • alsIntegrationTime – Color sensing sample time in milliseconds. Value may range from 2.8 to 721ms. Longer sample times act to filtered the sampled color.

  • alsGain – Color sensor gain as a value between 1 and 64.

configureProximitySense(proximitySampleTime: float, proximityPulseLength: float, numProximityPulses: int, proximityGain: int, proximityLedCurrent: int)None

Configure TMD3700 Proximity sense parameters.

Parameters
  • proximitySampleTime – Proximity sensing sample time in milliseconds. Value may range from 0.088 to 22.528 ms.

  • proximityPulseLength – Lengh of each IR LED pulse during proximity measurement in milliseconds. Value must fall between 0.004 and 0.032 ms.

  • numProximityPulses – Number of proximity IR LED pulses which occur during each sample period

  • proximityGain – Proximity sensor gain as a value between 1 and 8.

  • proximityLedCurrent – Proximity IR LED current in milliamps. Value must fall between 6 and 192 mA

getAmbientLightLevel()float

Get clear (Ambient) channel value.

Returns

Normalized clear channel value as ratio between 0 and 1.

getBlue()float

Get blue channel value.

Returns

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

getColor()wpilib.Color

Get gamma corrected RGB values from sensor

Returns

Value of RGB samples

getGreen()float

Get green channel value.

Returns

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

getHue()float

Get the measured color (hue).

Returns

Measured hue in degrees

getProximity()float

Get proximity value.

Returns

Normalized proximity value as ratio between 0 and 1.

getRed()float

Get red channel value.

Returns

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

getSaturation()float

Get measured color saturation.

Returns

Measured saturation as ratio between 0 and 1

setGain(r: float, g: float, b: float, c: float, gamma: float)None

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
  • r – Red channel gain

  • g – Green channel gain

  • b – Blue channel gain

  • c – Clear (ambient) channel gain

  • gamma – Gamma vaulke used to convert raw (linear) samples to something that responds like a human eye