use of com.robo4j.hw.rpi.i2c.lidar.LidarLiteDevice in project robo4j by Robo4J.
the class LidarLiteTest method main.
public static void main(String[] args) throws IOException, InterruptedException {
LidarLiteDevice ld = new LidarLiteDevice();
while (true) {
ld.acquireRange();
Thread.sleep(100);
System.out.println(String.format("Distance: %.02fm", ld.readDistance()));
Thread.sleep(500);
}
}
use of com.robo4j.hw.rpi.i2c.lidar.LidarLiteDevice in project robo4j by Robo4J.
the class LaserScanner method onInitialization.
@Override
protected void onInitialization(Configuration configuration) throws ConfigurationException {
super.onInitialization(configuration);
pan = configuration.getString("servo", "laserscanner.servo");
// Using degrees for convenience
servoRange = (float) configuration.getFloat("servoRange", 45.0f);
// Using angular degrees per second.
angularSpeed = configuration.getFloat("angularSpeed", 90.0f);
// Minimum acquisition time, in ms
minimumAcquisitionTime = configuration.getFloat("minAquisitionTime", 2.0f);
// Trim to align left to right and right to left scans (in degrees)
trim = configuration.getFloat("trim", 0.0f);
try {
lidar = new LidarLiteDevice(getBus(), getAddress());
} catch (IOException e) {
throw new ConfigurationException(String.format("Failed to initialize lidar device. Make sure it is hooked up to bus: %d address: %xd", getBus(), getAddress()), e);
}
}
Aggregations