dji-sdk / Mobile-SDK-Android

DJI Mobile SDK for Android: http://developer.dji.com/mobile-sdk/
Other
980 stars 579 forks source link

Virtual Joysticks doesn't work WITH GPS #1213

Open sonatuzun opened 1 year ago

sonatuzun commented 1 year ago

I am able to control using drones using virtual joystick commands while indoors (low gps signal GPSSignalLevel.LEVEL_0). But I can't control drone using virtual sticks when there is a high GPS signal (higher than ~12 satelites connected, GPSSignalLevel.LEVEL_4 / LEVEL_5).

This issue both happens in the sample project (SDK 4.16.4) and my personal project (SDK 4.16.1). This issue also occurs on both DJI Air 2S and DJI Mavic Mini.

While debugging neither sendVirtualStickFlightControlData nor setVirtualStickModeEnabled reports any errors.

While joysticks are working as intended FligthMode is FlightMode.JOYSTICK. While joysticks are NOT working FlightMode is FlightMode.GPS_ATTI.

What can we do to fix this problem and use virtual sticks to control the drone?

DJI-William commented 1 year ago

First of all, our latest Android MSDK version is 4.16.4, please try the latest MSDK. The sendVirtualStickFlightControlData will only work if your FlightMode = JOYSTICK. Once you have called the setVirtualStickModeEnabled, the FlightMode should change to JOYSTICK. So you must fail to enable the joystick, you need to check why is that. The joystick can only be enabled when the aircraft is flying disregard the GPS. Please try our sample and see if it is working.

sonatuzun commented 1 year ago

Thanks for quick reply! I have tried with the latest version of the sample project aswell. It doesn't work there either.

In our project, I call set VirtualStickModeEnabled(true, callback) multiple times every second. Though the flight mode remains GPS_ATTI. I think something should be not working and/or overriden in the process but I don't know what since callback doesn't report any errors.

DJI-William commented 1 year ago

You shouldn't call VirtualStickModeEnabled multiple times per second. You only need to call it once when you want to use. The callback must report something. Have you check if your RC is in N/P mode? Please read this article, When you can enable virtual stick?. The GPS_ATTI mode seems not right, you cannot enable the virtual stick from this mode.

sonatuzun commented 1 year ago

The RC is in normal mode. I've added logs to the sample v4.16.4. I get this when flying indoors: image

But I get this while flying outdoors. image

Is the problem drone being in GPS_ATTI? If so how can I fix it?

sonatuzun commented 1 year ago

Here is a more detailed log. 

image

I only call setVirtualStickEnabled once at the beginning of the program. Here it seems like the drone tries to stay in the JOYSTICK mode but something in the environment forces it to switch to GPS_ATTI or even DETOUR mode. What is interesting to me is this doesn't happen indoors, but only when we try to fly outdoors or in a nearby garage.

DJI-William commented 1 year ago

It enters ATTI maybe bacause the visual system isn't working properly. Are you flying under a light environment?

sonatuzun commented 1 year ago

Yes, we are flying in an environment with sun light . We also flied in environments with or without wind and obstacles. The errors happens in all scenarios where we have enpugh GPS signal. We are also sure that the optic sensors are working because the drone avoids our hand and obstacles around it.

sonatuzun commented 1 year ago

Could it be related to overall device health? We realized it flew a bit more reliably after we replaced damaged propellers. When trying to fly outside it responded our joystick commands the first time but didn't respond to them when we fly again. We're thinking:

Are any of the scenarios likely?

If the problem is related to overall device health how should I debug and what are the things I should log to pinpoint the problem?

(we used 4.16.4 sample project in our tests)

DJI-William commented 1 year ago

image If your situation satisfied with the above requirement, there should be no software restriction. As far as I know there are no other users report such issues. So After that it may be your aircraft hardware issue, very hard to debug.

sonatuzun commented 1 year ago

I see this is unfortunate. I am also unable to use virtual sticks in the simulator aswell (again using the sample app). This happens regardless if I'm inside or outside. But the RC can control the drone in the simulator. I wanted to mention this incase it might provide a clue to out problem.