Android 我能';t获取旋转我的幻影3 dji sdk 3.01
我尝试使用Sdk 3.0.1旋转我的幻影3,但没有成功 我的代码:Android 我能';t获取旋转我的幻影3 dji sdk 3.01,android,dji-sdk,Android,Dji Sdk,我尝试使用Sdk 3.0.1旋转我的幻影3,但没有成功 我的代码: DJIFlightController flightController = ((DJIAircraft) mProduct).getFlightController(); flightController.enableVirtualStickControlMode(new DJICompletionCallback() { @Override public void onResult(DJIError err
DJIFlightController flightController = ((DJIAircraft) mProduct).getFlightController();
flightController.enableVirtualStickControlMode(new DJICompletionCallback() {
@Override
public void onResult(DJIError error) {
if (error == null) {
showToast("enableVirtualStickControlMode: success");
} else {
showToast(error.getDescription());
}
}
});
try {
sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
showToast("Set yaw control mode to angle");
flightController.setHorizontalCoordinateSystem(DJIFlightControllerDataType.DJIVirtualStickFlightCoordinateSystem.Body);
flightController.setRollPitchControlMode(DJIFlightControllerDataType.DJIVirtualStickRollPitchControlMode.Angle);
flightController.setVerticalControlMode(DJIFlightControllerDataType.DJIVirtualStickVerticalControlMode.Velocity);
flightController.setYawControlMode(DJIFlightControllerDataType.DJIVirtualStickYawControlMode.Angle);
try {
sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
DJIFlightControllerDataType.DJIVirtualStickFlightControlData flightControlData =
new DJIFlightControllerDataType.DJIVirtualStickFlightControlData(0, 0, 45, 0);
flightController.sendVirtualStickFlightControlData(flightControlData, new DJICompletionCallback() {
@Override
public void onResult(DJIError error) {
if (error == null) {
showToast("Rotation: success");
} else {
showToast(error.getDescription());
}
}
});
try {
sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
flightController.disableVirtualStickControlMode(new DJICompletionCallback() {
@Override
public void onResult(DJIError error) {
if (error == null) {
showToast("disableVirtualStickControlMode: success");
} else {
showToast(error.getDescription());
}
}
});
我得到了“旋转:成功”的信息,但飞机不动。
我做错什么了吗?
非常感谢您的帮助。我以前遇到过这个问题。如果只调用一次
sendVirtualStickFlightControlData
,则性能是有线的。我已向DJI支持部门发送了一封电子邮件,他们建议我以5Hz的频率调用此方法。我测试了一下,一切都很好
比如:
Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
mFlightController.sendVirtualStickFlightControlData(flightControlData, new DJICompletionCallback() {
@Override
public void onResult(DJIError error) {
if (error == null) {
showToast("Rotation: success");
} else {
showToast(error.getDescription());
}
}
});
}
}, 0, 200);
我以前遇到过这个问题。如果只调用一次
sendVirtualStickFlightControlData
,则性能是有线的。我已向DJI支持部门发送了一封电子邮件,他们建议我以5Hz的频率调用此方法。我测试了一下,一切都很好
比如:
Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
mFlightController.sendVirtualStickFlightControlData(flightControlData, new DJICompletionCallback() {
@Override
public void onResult(DJIError error) {
if (error == null) {
showToast("Rotation: success");
} else {
showToast(error.getDescription());
}
}
});
}
}, 0, 200);