Virtual stick - drone not moving
Hi DJI Team,
We're having an issue with our software, where the drone sometimes doesn't move when we switch to virtual stick and send commands. This happens only sometimes (~30% ?). The only solution that we've found is to switch to S (sport) mode, the to P again, and resume.
We have investigated extensively, but couldn't find the reason. We can see in the logs that the drone does switch to virtual stick (VirtualStickStateListener::onVirtualStickStateUpdate receives isVirtualStickEnable = true).
We also toggle advanced mode, but this is also already enabled. However, we always get currentFlightControlAuthorityOwner = UNKNOWN.
So far, our only hypothesis is that there is sometimes too much wind, and the drone refuses to switch. But it doesn't raise any error.
Do you know any reason why the drone is not switching to virtual stick ? Any thing we can do in the code to detect it ?
Sometimes if you send virtual stick commands to the drone too fast it will overload the system and refuse to execute those commands. My guess is you're running into that.
Agent comment from YIGUI LIU in Zendesk ticket #161822:
Dear Developer,
You can also determine if virtual stick control is activated by checking whether the flight mode obtained via getFlightMode is set to JOYSTICK. In general, the following scenarios may cause the virtual stick to exit:
- Disconnection between the remote controller and the aircraft.
- The aircraft switches to a different flight mode (e.g., Attitude Mode).
- Execution of other operations that require aircraft control while using the virtual stick (e.g., waypoint missions, return-to-home).
- The aircraft reaches altitude limits, distance limits, or restricted flight zones, which will disable the virtual stick.
Alternatively, can the issue be reproduced when flying with a simulator? This helps rule out environmental factors.
Relevant documents:https://sdk-forum.dji.net/hc/en-us/articles/4402495686553-When-you-can-enable-virtual-stick
Best Regards,
DJI Innovations SDK Technical Support Team
°°°
Thanks for the info. As far as I can tell, we are not in any of these cases. I don't understand how to get a FlightController, isn't it in the old version of the SDK ? How can I check the flightMode in the new version ?
@godfreynolan thanks for the tip, we've seen that too. But we hardcode a 2s pause between enableVirtualStick and the moment we send control commands. Do you know how long it can take ?
Agent comment from YIGUI LIU in Zendesk ticket #161822:
Dear Developer,
Are you using MSDK v4 or MSDK v5? Their interfaces for obtaining the flight mode are as follows: MSDK v4
-
Key: FlightControllerKey.FLIGHT_MODE
-
API doc: https://developer.dji.com/api-reference/android-api/Components/FlightController/DJIFlightController_DJIFlightControllerCurrentState.html#djiflightcontroller_djiflightcontrollercurrentstate_flightmode_inline MSDK v5
-
Key: FlightControllerKey.KeyFlightMode
-
API doc: https://developer.dji.com/api-reference-v5/android-api/Components/IKeyManager/Key_FlightController_FlightControllerKey.html?search=keyflightmode&i=0&#key_flightcontroller_msdkflightmode_inline
We appreciate your email and wish you a wonderful day!
Best Regards,
DJI Innovations SDK Technical Support Team
°°°
Thanks, I'll try to log it and see if it gives any hint. But that doesn't really solve my problem, do you know what could be preventing the virtual sticks ?
Also, is there any way to get an error in the code, to know that we couldn't switch to Virtual Stick ? We don't receive any error in the callback
Agent comment from YIGUI LIU in Zendesk ticket #161822:
Dear Developer,
The reasons for the virtual stick disengagement were provided in the earlier reply.
n addition, the virtual stick requires continuous transmission of control commands. You can try increasing the command transmission frequency to 25Hz to see if it can reduce the occurrence of the problem.
Moreover, you can try flying in the simulator to check if the issue is caused by environmental factors.
Best Regards,
DJI Innovations SDK Technical Support Team
°°°
Thanks for your answer, but as I mentioned, none of the reasons you provided apply to our case (as far as we can tell). We have no issue in simulator. We receive no error when calling enableVirtualSticks.
How can we investigate ?
Agent comment from YIGUI LIU in Zendesk ticket #161822:
Dear Developer,
What is the model of the aircraft you are using? The MSDK R&D team has feedback that for the M300 and M350, it is not possible to obtain the current control authority via VirtualStickStateListener or FlightControllerKey.KeyFlightControlCurrentAuthority, as the aircraft firmware does not return the corresponding value to the MSDK.
Additionally, the M300 and M350 have relatively poor speed fusion capability. The control speed commands sent via virtual sticks require a minimum of approximately 1 m/s to take effect. You can try adjusting the sent control speed.
If the issue persists, please provide the following information so we can forward it to the R&D team for further analysis: 【MSDK Version】 【Drone Model & Firmware Version】 【Detailed Fault Phenomenon】 【Specific Time Period When the Fault Occurred】 【CSDK Logs】Path: Remote Controller/Android/data/[app package name]/files/LOG/CSDK/logs. The file name corresponds to the time when the log started being recorded. 【MSDK Logs】Compress all logs of the corresponding date from Remote Controller/Android/data/[app package name]/files/LOG or /sdcard/dji/[app package name]/log into a single file. 【Aircraft Logs】Connect the drone to a computer and export the DAT file via the DJI Assistant 2 software. 【Remote Controller Logs】Connect the remote controller to a computer and export the DAT file via the DJI Assistant 2 software.
Log files can be uploaded to the cloud disk: https://pan-sec.djicorp.com/s/2sP6xfPJ5r55ETA
Best Regards,
DJI Innovations SDK Technical Support Team
°°°
We have seen the issue on M4E, M300 and M350.
The control speed commands sent via virtual sticks require a minimum of approximately 1 m/s to take effect
That's weird, because we ramp up the speed control, so it starts at 0 m/s, and it works fine most of the time.
I'm sorry but none of the explanations you gave explain why switching the remote mode (P -> S -> P) fixes the issue. Do you know what that does ?
We will try to capture the full logs on our next flights.
Agent comment from YIGUI LIU in Zendesk ticket #161822:
Dear Developer,
Sorry, we also don’t know the impact caused by switching the remote control mode. It may be that if no control commands are sent via the virtual sticks for a certain period of time, the flight controller determines that the virtual sticks have been exited, and switching the remote control mode then restores the virtual stick state.
We recommend providing relevant logs, fault time, and other information so that we can submit them to the R&D team for analyzing the specific case.
Best Regards,
DJI Innovations SDK Technical Support Team
°°°