* .crazyflie.client.controller.InputEvent)
*/
@Override
public void onInput(InputEvent event) {
if (event instanceof AxisControlEvent) {
AxisControlEvent e = (AxisControlEvent) event;
if (crazyflie != null) {
char thrust = 0;
float t = e.getTrust() - 1.0f;
thrust = (char) (Math.abs(t) * (Crtp.MAX_THRUST / 2));
if (on && crazyflie.isConnected() && !window.isPlay()) {
crazyflie.sendSetpoint(e.getRoll() * maxRoll, e.getPitch()
* maxPitch, e.getYaw() * maxYaw, thrust);
recorder.record(e.getRoll() * maxRoll, e.getPitch()
* maxPitch, e.getYaw() * maxYaw, thrust);
}
}
return;
}
if (event instanceof AltHoldEvent) {
AltHoldEvent e = (AltHoldEvent) event;
log.info("AltHold: " + e.isHold());
crazyflie.setAltHold(e.isHold());
return;
}
if (event instanceof StartEvent) {
on = ((StartEvent) event).isOn();