if (ArrayUtils.isEmpty(uris)) {
log.error("No Interfaces are found");
return;
}
log.info("Found: {}", Arrays.toString(uris));
Crazyflie crazyflie = new Crazyflie();
Logging logging = crazyflie.getLogging();
crazyflie.addListener(new LogListener() {
@Override
public void valuesReceived(String name, Map<String, Object> values) {
log.info("{}", values.toString());
}
}, "stabilizer", "baro");
crazyflie.getLogging().addGroup("stabilizer", 200, "stabilizer.roll",
"stabilizer.pitch", "stabilizer.yaw", "stabilizer.thrust");
crazyflie.getLogging().addGroup("baro", 200, "baro.aslLong",
"baro.temp", "baro.pressure");
logging.startAll();
crazyflie.addListener(new ConnectionListener() {
@Override
public void linkQualityUpdate(CrtpDriver l, int quality) {
// log.info("linkQualityUpdate: {}", quality);
}
@Override
public void disconnected(CrtpDriver l) {
log.info("disconnected");
}
@Override
public void connectionSetupFinished(CrtpDriver l) {
log.info("connectionSetupFinished");
}
@Override
public void connectionLost(CrtpDriver l) {
log.info("connectionLost");
}
@Override
public void connectionInitiated(CrtpDriver l) {
log.info("connectionInitiated");
}
@Override
public void connectionFailed(CrtpDriver l) {
log.info("connectionFailed");
}
});
try {
crazyflie.connect(uris[0]);
while (!Thread.currentThread().isInterrupted())
Thread.sleep(1000);
} finally {
crazyflie.disconnect();
}
}