LRQQQOsmo Mobile 37-24 15:49
setYawControlMode(YawControlMode.ANGULAR_VELOCITY)或者setYawControlMode(YawControlMode.ANGLE),直接给YAW赋值就好了。这个在官方的demo中有示例的
kv8867-23 19:52
要用虚拟摇杆virtual stick 的相关方法。
djiuser_2qce9367-24 16:23
您好 那我让它每次旋转90度,每次加90,超过180就改成(原角度+90)-360这样旋转 但是实际上他并没有完全按照设定的角度旋转,这是我的代码
private void aircraftYaw(float angle){
Attitude attitude = flightController.getState().getAttitude();
float pitch = (float) attitude.pitch;
float roll = (float) attitude.roll;
float yaw = (float) attitude.yaw + angle;
if (yaw > 180){
yaw = yaw - 360;
}
flightController.sendVirtualStickFlightControlData
(new FlightControlData(pitch, roll, yaw,0),
null);
}
djiuser_2qce936Phantom 4 Advanced2020-7-24 16:23
您好 那我让它每次旋转90度,每次加90,超过180就改成(原角度+90)-360这样旋转 但是实际上他并没有完全按照设定的角度旋转,这是我的代码
private void aircraftYaw(float angle){
Attitude attitude = flightController.getState().getAttitude();
float pitch = (float) attitude.pitch;
float roll = (float) attitude.roll;
float yaw = (float) attitude.yaw + angle;
if (yaw > 180){
yaw = yaw - 360;
}
flightController.sendVirtualStickFlightControlData
(new FlightControlData(pitch, roll, yaw,0),
null);
}
欢迎光临 大疆社区 (https://bbs.dji.com/) | Powered by Discuz! X3.2 |