Mobile-SDK-Android-V5 icon indicating copy to clipboard operation
Mobile-SDK-Android-V5 copied to clipboard

DJI mini4pro gps / heading accuracy issue

Open HEEJUN-SHIN opened this issue 2 months ago • 6 comments

Hello, developers.

I am using MINI 4 PRO (V01.00.0800) with RC-N2 (V01.01.0300).

In order to take exactly the same scene of photo every time, I use gps coordinate and yaw direction.

But everytime I try to fly the drone to the same gps coordinate and yaw direction, the actual location and heading is slightly different with my intention.

To get the gps coordinate, I used this

LocationCoordinate3D coord = keymanager.getValue(KeyTools.createKey(FlightControllerKey.KeyAircraftLocation3D));

To get the yaw direction, I used this function.

public double getCurrentYaw() {
        Attitude att = (Attitude) keymanager.getValue(
                KeyTools.createKey(FlightControllerKey.KeyAircraftAttitude)
        );

        if (att != null && att.getYaw() != null) {
            // DJI SDK: -180 ~ 180 [deg], North=0, CW+
            double yawNED = Math.toRadians(att.getYaw());

            // 변환: NED → ENU
            double yawENU = Math.PI / 2.0 - yawNED;

            // wrap to [-π, π]
            yawENU = Math.atan2(Math.sin(yawENU), Math.cos(yawENU));

            return yawENU;  // ROS의 euler_from_quaternion 과 동일 기준
        } else {
            Log.w("DroneModel", "Attitude or yaw is null in getCurrentYaw()");
            return 0.0; // fallback 값
        }
    }

My fly_to function does not seem to be wrong, since when the drone arrived the location and direction was exactly same with the pre-designated location.

The altitude error is even worse, that the drone is crawling at the ground (~0.5m) but the coord.getAltitude() is 2~3m.

The very problem is that this problem does not happen all the time but in the occasional manner.

Thanks.

HEEJUN-SHIN avatar Oct 06 '25 06:10 HEEJUN-SHIN

Agent comment from LIPING.ZHOU in Zendesk ticket #158597:

Dear Developer,

Hello, thank you for contacting DJI.

Currently, it is the combined Chinese National Day and Mid-Autumn Festival holiday. Our engineering team members are on vacation and will return shortly. We will respond to your inquiry as soon as possible after the holiday. Thank you for your understanding.

We hope our solution can be helpful to you. Thank you for your email, and wish you a wonderful day!

Best Regards, DJI SDK Technical Support

°°°

dji-dev avatar Oct 07 '25 02:10 dji-dev

Agent comment from YIGUI LIU in Zendesk ticket #158597:

Dear Developer,

The accuracy of positioning and heading is limited by the quality of the positioning signal.

You can monitor FlightControllerKey.KeyGPSSignalLevel and ensure its value reaches LEVEL_4 or higher (indicating a good GPS status) before taking off and retrieving relevant key data. This should result in data that is closer to your expected values.

Best Regards, DJI Innovations SDK Technical Support Team

°°°

dji-dev avatar Oct 09 '25 03:10 dji-dev

Thanks for the reply.

Regarding your answer, I have two question.

  1. You said to check the gps signal level before taking off. Do you mean that the gps positioning value will be accurate after taking off, once the signal level is good before taking off? or It can be unaccurate after taking off even if the signal was good before taking off?

  2. With the similar perspective, I am curious about the gps positioning logic. Is it calculated value based on the first gps fix? or Is it the measured value that are obtained everytime?

If it is calculated value, the first gps signal level and the position calue itself before taking off will be much important, else the positioning value accurate can be considered independently..

HEEJUN-SHIN avatar Oct 09 '25 05:10 HEEJUN-SHIN

Agent comment from YIGUI LIU in Zendesk ticket #158597:

Dear Developer,

A good GPS signal before takeoff does not mean the positioning will remain accurate after takeoff, but it will affect the calculation of the takeoff point altitude and whether the takeoff can be performed normally.

Since your issue occurs intermittently, the MSDK only receives positioning information pushed by the flight controller. The flight controller typically obtains position data via GPS, which is why we recommend taking off and acquiring position information in an area with a strong GPS signal.

In short, the MSDK merely forwards data; the actual logic lies in the aircraft's firmware. The same issue is likely to occur when using the DJI Fly app for flight.

Best Regards, DJI Innovations SDK Technical Support Team

°°°

dji-dev avatar Oct 10 '25 03:10 dji-dev

Okay, I get that the SDK only forwards the data.

But even if the signal level is good, I found there are some error on the gps location.

For example, I have a fixed destination gps coordinate and let drone fly to the exact location.

But everytime I turn off and on the drone, and fly to the destination, there are some misalignment (1-2m).

Also, I set the heading yaw to be the same value, it also has some error. For example everytime, I set the yaw 90 deg, and the value is 90 deg, but the actual heading is quite different

Is it normal situation then??

HEEJUN-SHIN avatar Oct 10 '25 07:10 HEEJUN-SHIN

Agent comment from YIGUI LIU in Zendesk ticket #158597:

Dear Developer,

The positioning accuracy of GPS is at the meter level, while RTK can support higher centimeter-level accuracy.

I would like to confirm: through which interface are you setting the heading of the Mini 4 Pro? The MSDK should not provide a direct interface for setting it; only the waypoint file or virtual joystick can control the aircraft's yaw heading.

Additionally, are you obtaining the aircraft's attitude data through FlightControllerKey.KeyAircraftAttitude?

Best Regards, DJI Innovations SDK Technical Support Team

°°°

dji-dev avatar Oct 10 '25 11:10 dji-dev