Skip to content

SDK_SERVICE_GIMBAL_ROTATE_YAW_OUT_OF_RANGE .. when drone is flying #548

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
petered opened this issue Apr 20, 2025 · 5 comments
Open

SDK_SERVICE_GIMBAL_ROTATE_YAW_OUT_OF_RANGE .. when drone is flying #548

petered opened this issue Apr 20, 2025 · 5 comments

Comments

@petered
Copy link

petered commented Apr 20, 2025

I'm having this problem with an M3T, on 5.14.0 (also 5.13.0)

So, as you may know, if you call the GimbalKey.KeyRotateByAngle key when the drone is flying, it rotates its body in the yaw-direction instead of the gimbal.

That's good - means it can rotate 360 degrees.

The problem is - if the drone is flying and you to rotate by, say, 30 degrees to the right, it still fails with code "SDK_SERVICE_GIMBAL_ROTATE_YAW_OUT_OF_RANGE" . Well sure - it would be out of range if the drone was on the ground and it had to actually rotate its gimbal. But since the drone is flying, it is using its body to rotate, and that check should be ignored.

Here's how I create the gimbal rotation objet that I pass to the drone:

fun getGimbalRotation(mode: GimbalAngleRotationMode, pitchDeg: Double, yawDeg: Double, durationSec: Double = 1.0): GimbalAngleRotation {
    return GimbalAngleRotation(
        mode,
        pitchDeg,
        0.0,
        yawDeg,
        false,
        false,
        false,
        durationSec,
        false,
        1000
    )
}

The problem occurs for both ABSOLUTE and RELATIVE rotation

Can we fix this so that it ignores the yaw check when the drone is flying? Is there a workaround?

Thank you.


我现在用的是M3T,无人机固件版本5.14.0(5.13.0也有这个问题)。

可能你也知道,当无人机在飞的时候,如果你调用GimbalKey.KeyRotateByAngle,它会用机身来做yaw方向的旋转,而不是转动云台。

这本来挺好的,因为这样一来就可以360度随意旋转了。

但问题来了——现在无人机明明正在飞,如果我想向右转个30度,它还是会报错,提示SDK_SERVICE_GIMBAL_ROTATE_YAW_OUT_OF_RANGE。
这明显不对啊。如果是在地面上,云台确实转不到那么大的角度,会超范围。但现在明明在飞,它用的是机身旋转,这个检查是不是就该跳过了?

下面是我创建云台旋转对象然后发给无人机的代码:

fun getGimbalRotation(mode: GimbalAngleRotationMode, pitchDeg: Double, yawDeg: Double, durationSec: Double = 1.0): GimbalAngleRotation {
    return GimbalAngleRotation(
        mode,
        pitchDeg,
        0.0,
        yawDeg,
        false,
        false,
        false,
        durationSec,
        false,
        1000
    )
}

有没有办法修一下,让它在飞行状态时忽略yaw角度的检测?
或者说,有没有什么临时的解决方法?

谢谢啦!

@petered
Copy link
Author

petered commented Apr 20, 2025

My temporary workaround is to just split the gimbal rotation request into several smaller ones.

fun splitGimbalAngleRotationIntoIncrements(
    gimbalAngleRotation: GimbalAngleRotation,
    maxYawPerStep: Double = 20.0
): List<GimbalAngleRotation> {

    val totalYaw = gimbalAngleRotation.yaw ?: 0.0
    val totalPitch = gimbalAngleRotation.pitch ?: 0.0
    val steps = ceil(abs(totalYaw) / maxYawPerStep).toInt().coerceAtLeast(1)
    val yawIncrement = totalYaw / steps
    val pitchIncrement = totalPitch / steps
    val durationPerStep = (gimbalAngleRotation.duration ?: 1.0) / steps

    return (1..steps).map {
        GimbalAngleRotation(
            gimbalAngleRotation.mode,
            pitchIncrement,
            0.0,
            yawIncrement,
            gimbalAngleRotation.pitchIgnored,
            gimbalAngleRotation.rollIgnored,
            gimbalAngleRotation.yawIgnored,
            durationPerStep,
            gimbalAngleRotation.jointReferenceUsed,
            gimbalAngleRotation.timeout
        )
    }
}

@dji-dev
Copy link
Contributor

dji-dev commented Apr 21, 2025

Agent comment from YIGUI LIU in Zendesk ticket #140441:

Dear Developer,

During flight, the rotation of the gimbal's yaw angle is not necessarily completed by the rotation of the aircraft's fuselage. This is related to the gimbal mode you set, which is defined by GimbalKey.KeyGimbalMode. For detailed information, please refer to the document:
https://sdk-forum.dji.net/hc/en-us/articles/14657158053529-Why-does-turning-the-gimbal-yaw-axis-cause-the-aircraft-to-rotate

Currently, for the M3T, you can obtain the rotation range through GimbalKey.GimbalAttitudeRange. The yaw direction range is from -20 to 20. If it exceeds this range, an error message corresponding to SDK_SERVICE_GIMBAL_ROTATE_YAW_OUT_OF_RANGE will be prompted.

If you have already bypassed this error by splitting the rotation into multiple small angles, you can continue to use this method for now.

Best Regards,
DJI Innovations SDK Technical Support Team

°°°

@petered
Copy link
Author

petered commented Apr 21, 2025

Thank you for your answer and for providing that helpful article. From this it seems that in flight, the aircraft is in YAW_FOLLOW mode by default - because when I rotate the gimbal, the aircraft follows. On the ground it seems to be in Free mode - because the gimbal will yaw freely.

So my specific feature request then is "When the aircraft is in YAW_FOLLOW mode - please disable the OUT_OF_RANGE check, because it is not needed"

A further request would be that when the requested limit is exceeded (e.g. the gimbal is in FREE mode, its limit is 20°, and I ask for 21°) - the gimbal just rotates to the maximum allowed value, instead of giving an error and not rotating at all. Same for other things like Pitch, Zoom, etc. If a limit is exceeded - you can always communicate that in the response callback after the drone does its best to perform the task.

@dji-dev
Copy link
Contributor

dji-dev commented Apr 22, 2025

Agent comment from YIGUI LIU in Zendesk ticket #140441:

Dear Developer,

We will convey the interface optimization suggestions you put forward to the MSDK R&D team.

The first point you mentioned indeed has great value for interface optimization. The second point is more about the unified specification of the MSDK interface. For input parameters that exceed the limits, reporting an error directly instead of trying to execute the operation as much as possible is beneficial for developers to identify incorrect input parameters and avoid problems in advance.

Best Regards,
DJI Innovations SDK Technical Support Team

°°°

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants