Android Question problem executing dji waypoint missions

shb777

Active Member
Licensed User
I'm getting many errors when trying to execute waypoint missions. More than 50% of the time. I notice in your waypoint mission project,
you don't do anything if this fails.
Code:
B4X:
WaitFor (WaypointOperator.StartMission) WaypointOperator_Result (Success As Boolean, ErrorMessage AsString)Log("Start: " & Success & ", " & ErrorMessage)
MissionState(True)
Is this intentional, and have you gotten errors executing waypoint missions yourself? Three errors I'm getting are:


the execution could not be executed

error uploading: execution of this process timed out.

error uploading: the system is too busy to execute the action
 

Erel

Administrator
Staff member
Licensed User
This is the code from my example:
B4X:
WaypointOperator.LoadMission(builder)
Wait For (WaypointOperator.UploadMission) WaypointOperator_Result (Success As Boolean, ErrorMessage As String)
If Success Then
   Sleep(1000) '<--- required. Otherwise it will fail
   Wait For (WaypointOperator.StartMission) WaypointOperator_Result (Success As Boolean, ErrorMessage As String)
   Log("Start: " & Success & ", " & ErrorMessage)
   MissionState(True)
Else
   Log("Error uploading: " & ErrorMessage)
   ToastMessageShow("Error uploading: " & ErrorMessage, True)
End If

I've find out that the Sleep helps there. You are correct that it is better to show a message if it failed to start.
It worked properly for me with the sleep.
 
Upvote 0

shb777

Active Member
Licensed User
it's been working a lot better today. I only got one error last time I flew. I'm gonna investigate my program, for too many calls
to the drone, that might be overloading the on board processors.
 
Upvote 0

shb777

Active Member
Licensed User
i flew near dusk, and a could hardly execute any waypoint missions. kept getting this:
error uploading: the system is too busy to execute the action

i can see where the onboard cpu's would have to work harder with less light.

i'm only executing this
B4X:
DJIFlightControllerCurrentState = controller.CurrentState
every 400 ms. that doesn't seem that much
 
Upvote 0

shb777

Active Member
Licensed User
I thought this advice was pretty funny.

Best option IMO, after each mission. Shut down AC and RC. Re-Start and Re-load. That should help with any errors and ensure the aircraft's mission upload is cleared and ready for another upload. Seen this quite a few times in other applications.
 
Upvote 0

shb777

Active Member
Licensed User
this seems to make sense


'You need To manually check If mission uploaded successfully. For example,
'WaypointMissionOperator.uploadMission callback returns Not after mission
'uploaded, but after mission started To upload. And If you have long enough mission
'And call WaypointMissionOperator.startMission inside uploadMission callback you
' will receive exactly this message - "The execution could not be executed". So you
' need To wait While
' WaypointMissionOperator().getCurrentState() == WaypointMissionState.UPLOADING
' And after that check If WaypointMissionOperator().getCurrentState() ==
' WaypointMissionState.READY_TO_EXECUTE before call
' WaypointMissionOperator.startMission.

so we need to use getCurrentState() but our waypoint operator doesn't have that implemented
 
Last edited:
Upvote 0

Erel

Administrator
Staff member
Licensed User
You know that it was uploaded successfully by checking the value of the Success parameter.

You can get the current state with:
B4X:
Sub GetMissionOperatorState As String
 Dim jo As JavaObject = WaypointOperator
 jo = jo.RunMethod("getCurrentState", Null)
 If jo.IsInitialized = False Then Return "NA"
 Return jo.RunMethod("getName", Null)
End Sub
 
Upvote 0

shb777

Active Member
Licensed User
You know that it was uploaded successfully by checking the value of the Success parameter.

You can get the current state with:
B4X:
Sub GetMissionOperatorState As String
Dim jo As JavaObject = WaypointOperator
jo = jo.RunMethod("getCurrentState", Null)
If jo.IsInitialized = False Then Return "NA"
Return jo.RunMethod("getName", Null)
End Sub
thanks I'll test this tomorrow.
 
Upvote 0
Top