Rev Robotics 2m Sensor

Has anyone had any experience with this distance sensor? Although this sensor is inexpensive, for us it might be technically expensive as the API is C only and we are a Java shop.

If you’re indeed referring to the “2m Distance Sensor”, it should work essentially regardless of language. WPILib has built-in functionality to read i2c devices off of the RoboRIO’s i2c bus, even if a base-library REV made for convenience isn’t available (not that I’m aware of any existing). You’d just need to use the address REV lists on the product page, being 0x52.

1 Like

Thanks! We’ll order one and try it out on our test robot.

The C API is provided by ST, the sensor chip’s manufacturer. In FTC, this API is simplified and ported into the Java SDK by the FTC developers. Using this sensor in FRC would require porting the library to Java, LabVIEW, or C++. We do not have ported FRC libraries at this time, but here are some resources that can get you started:

For the FTC SDK, you would need to unpack the Hardware-release-sources.jar file. You will find the sensor related Java file in the following path:

An alternative to connecting the sensor directly to the roboRIO and porting the libraries would be to use the sensor with a co-processor, like an Arduino, and use the libraries that already exist.

@dyanoshak I have been trying to interface with the sensor through the Roborio I2C port (not MXP) with the FTC SDK code that you suggested. I am currently stuck because the code from FTC is heavily dependent on the FTC Qualcom library. It seems like the root code snipbit I am trying to decode is:

int range = (int)TypeConversion.byteArrayToShort( + 10, 2));

Any suggestions for how tro convert this to “FRC” code? If not, a simple explanantion of what this means would be great! Thanks

Is this the same for the REV color sensor?

1 Like

No, this is the Rev 2m Sensor (

I know that but is the issue that was described above of having to import the FTC library the same for the color sensor?