Search in sources :

Example 1 with CalibratedGyro

use of com.robo4j.hw.rpi.i2c.gyro.CalibratedGyro in project robo4j by Robo4J.

the class GyroL3GD20Unit method onInitialization.

@Override
protected void onInitialization(Configuration configuration) throws ConfigurationException {
    super.onInitialization(configuration);
    sensitivity = Sensitivity.valueOf(configuration.getString(PROPERTY_KEY_SENSITIVITY, "DPS_245"));
    period = configuration.getInteger(PROPERTY_KEY_PERIOD, 10);
    highPassFilter = configuration.getBoolean(PROPERTY_KEY_HIGH_PASS_FILTER, true);
    try {
        gyro = new CalibratedGyro(new GyroL3GD20Device(getBus(), getAddress(), sensitivity, highPassFilter));
    } 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);
    }
}
Also used : CalibratedGyro(com.robo4j.hw.rpi.i2c.gyro.CalibratedGyro) ConfigurationException(com.robo4j.core.ConfigurationException) IOException(java.io.IOException) GyroL3GD20Device(com.robo4j.hw.rpi.i2c.gyro.GyroL3GD20Device)

Aggregations

ConfigurationException (com.robo4j.core.ConfigurationException)1 CalibratedGyro (com.robo4j.hw.rpi.i2c.gyro.CalibratedGyro)1 GyroL3GD20Device (com.robo4j.hw.rpi.i2c.gyro.GyroL3GD20Device)1 IOException (java.io.IOException)1