How do I use the LIDAR with a NavX-mxp?

I’m using Java. I understand the the NavX plugs into the RoboRio via USB, and the Lidar plugs into the NavX via i2c. What’s the programming for that? I was expecting some type of function within the NavX libraries along the lines of “.getDistance()” or at least “.getI2C()”, but nothing like that exists.

navX-MXP connects to the RoboRIO MXP port and can communicate with the RoboRIO via SPI or I2C. navX-MXP can also connect to the RoboRIO via USB as well.

If you are using an I2C LIDAR, and the navX-MXP is connected to the RoboRIO MXP port, then you do have the option to connect the LIDAR to the I2C pins on the navX-MXP (the navX-MXP IO Expansion page has details about that configuration - please review if you take that path). Your other option is to connect the LIDAR device to the I2C pins directly on the RoboRIO.

In both cases, communication with the LIDAR needs to be handled by software running on the RoboRIO. So in Java, that would be via the I2C class provided by the WPI library. The navX-MXP libraries would not be used to communicate with an I2C LIDAR.

The Kauaibots used LIDAR-Lite (version 2) in 2016, and the java code for that is here. As described above, communication occurs via the I2C class in the WPI Library.

I didn’t realize the NavX plugs directly into the RoboRio. With that said, I went to the link and read the NavX’s I2C address is 0x32. To communicate with the LIDAR with the address, would I use 0x32, being that it’s what the LIDAR is plugged into, or would I do 0x62 which is the LIDAR’s address? I’m not very familiar with I2C.

0x62. It’s like an IP address: If you were trying to talk to the roboRIO, would you enter the RIO’s address, or the radio’s address?

That explains it well, thank you. Also, here is the code that I decided on running. My next robotics meeting is Tuesday, so it’ll be a while before I can test it, but I’m putting it here so you guys can review it before I try testing it. (I’m only asking for tweaks on Robot.java and Lidar.java, so please don’t criticize my PID and Vision thing)

https://github.com/CyberCoyotes/Testing-Robot/tree/master/src/org/usfirst/frc/team3603/robot