Quote:
Originally Posted by tech2077
In case anyone is interested, I wrote up a java class for this, you can use the start/stop functions to use the built in updater Timer, or use the update function to only poll distance when needed.
LIDAR.java
|
Please correct me if I'm wrong, but there appears to be a bug in this file. You are calling updater.scheduleAtFixedRate(), which would be fine if you didn't already have a while() loop inside your TimerTask. Since you have a while loop, the run() function will never exit, so essentially your timer is useless and is acting like just a Thread object to run this function in the background indefinitely. The 'period' argument isn't being used, so the sensor will be polled every 10ms.
Also, since it came into the discussion, our team is using Java and we have been able to successfully use our RoboRio I2C port for a MaxBotix ultrasonic sensor, but not for the LIDAR sensor. Trying to use the LIDAR gives us write and read errors.