M300 Waypoint Actions not executing - Android SDK
1872 7 2021-12-21
Uploading and Loding Picture ...(0/1)
o(^-^)o
djiuser_GbQqZSV3maj9
lvl.2

India
Offline

Hello,
I am integrating waypoint missions 2.0 for M300 and have followed below code for reference
https://github.com/dji-sdk/Mobile-SDK-Android/blob/master/Sample%20Code/app/src/main/java/com/dji/sdk/sample/demo/missionoperator/WaypointV2MissionOperatorView.java

I wanted to click a photo when I reach a waypoint. To do this I have written below code

                    val waypointAction1Trigger = WaypointTrigger.Builder()
                        .setTriggerType(ActionTypes.ActionTriggerType.REACH_POINT)
                        .setReachPointParam(WaypointReachPointTriggerParam.Builder()
                            .setStartIndex(i)
                            .setAutoTerminateCount(i+1)
                            .build())
                        .build();


                    val wpaActuator =WaypointActuator.Builder()
                        .setActuatorType(ActionTypes.ActionActuatorType.CAMERA)
                        .setCameraActuatorParam(
                        WaypointCameraActuatorParam.Builder()
                            .setCameraOperationType(ActionTypes.CameraOperationType.SHOOT_SINGLE_PHOTO)
                            .build()
                    ).build()


                    val wp = WaypointV2Action.Builder()
                        .setActionID(i)
                        .setActuator(wpaActuator)
                        .setTrigger(waypointAction1Trigger)
                        .build()



Although I get a success message after uploading the waypoint actions, the actions do not actually execute.


Can you tell me what mistake am I doing exactly ?


Also, it would be great if DJI can maintain some documentation on how Waypoint Triggers and Actuautors are supposed to be used and how they work.


Please help me.
2021-12-21
Use props
djiuser_OR8EW5uz3gSA
lvl.4

Canada
Offline

Your code looks good to me. Is the ActionID definitely unique? It won't run the action if not. I usually set a starting action id as 100 and increment from there. What camera do you have attached?
2021-12-22
Use props
djiuser_GbQqZSV3maj9
lvl.2

India
Offline

djiuser_OR8EW5uz3gSA Posted at 12-22 10:12
Your code looks good to me. Is the ActionID definitely unique? It won't run the action if not. I usually set a starting action id as 100 and increment from there. What camera do you have attached?

Hey, thank you for your reply.

I debugged the code and found out that the Index that I was assigning to the start Index of the trigger was wrong. Now, I have set the correct index. Although I have not tested the code yet because of the drone unavailability, I am sure that this must be the issue. I will definitely let you know once I test it.

Also, I am using the H20 cam.

Thank you so much for your help. Without you asking me to check the ID, I would not have been able to  fix this issue.
2021-12-22
Use props
djiuser_OR8EW5uz3gSA
lvl.4

Canada
Offline

djiuser_GbQqZSV3maj9 Posted at 12-22 21:57
Hey, thank you for your reply.

I debugged the code and found out that the Index that I was assigning to the start Index of the trigger was wrong. Now, I have set the correct index. Although I have not tested the code yet because of the drone unavailability, I am sure that this must be the issue. I will definitely let you know once I test it.

You're welcome. Yeah the documentation isn't the clearest on this mission type and especially on how actions work. It took me quite a bit of trial and error to figure out something as simple as taking a photo at a waypoint
2021-12-24
Use props
djiuser_GbQqZSV3maj9
lvl.2

India
Offline

djiuser_OR8EW5uz3gSA Posted at 12-24 12:46
You're welcome. Yeah the documentation isn't the clearest on this mission type and especially on how actions work. It took me quite a bit of trial and error to figure out something as simple as taking a photo at a waypoint

Hey, I tried this with the drone and its working fine. I am facing one more issue, how do get the action Hover to work ?

I am using following code for hover as waypoint action:
val hoverTrigger = WaypointTrigger.Builder()
                        .setTriggerType(ActionTypes.ActionTriggerType.ASSOCIATE)
                        .setAssociateParam(
                            WaypointV2AssociateTriggerParam.Builder()
                                .setAssociateActionID(indexOfLastAddedWaypointToTheList)
                                .setAssociateType(ActionTypes.AssociatedTimingType.AFTER_FINISHED)
                                .setWaitingTime(waitingTime.toFloat())
                                .build()
                        )
                        .build()

                    val hoverActuator = WaypointActuator.Builder()
                        .setActuatorType(ActionTypes.ActionActuatorType.AIRCRAFT_CONTROL)
                        .setAircraftControlActuatorParam(
                            WaypointAircraftControlParam.Builder()
                                .setAircraftControlType(ActionTypes.AircraftControlType.START_STOP_FLY)
                                .setFlyControlParam(
                                    WaypointAircraftControlStartStopFlyParam.Builder()
                                        .setStartFly(false).build()
                                )
                                .build()
                        )
                        .build()

                    val hoverWaypointAction = WaypointV2Action.Builder()
                        .setActionID(indexOfLastAddedWaypointToTheList)
                        .setActuator(hoverActuator)
                        .setTrigger(hoverTrigger)
                        .build()


Can you please tell me what exactly am I doing wrong here ?
2021-12-27
Use props
djiuser_OR8EW5uz3gSA
lvl.4

Canada
Offline

I'm afraid I have not tried to get the drone to hover.

Have you tried to get the drone to hover with a different trigger type, e.g. reach point. Just to see if the actuator is configured correctly

Is there an error code when uploading the actions to the drone or when the action tries to execute?

You can usually see these in the WaypointV2ActionListener callback functions.
2022-1-2
Use props
notadroneguy
lvl.2

India
Offline

djiuser_OR8EW5uz3gSA Posted at 1-2 22:36
I'm afraid I have not tried to get the drone to hover.

Have you tried to get the drone to hover with a different trigger type, e.g. reach point. Just to see if the actuator is configured correctly

Hey, I am not getting any error as such. I tried the reach point trigger with actuator to stop flying, and then added an associate trigger to continue flying after 5 seconds.

This worked but only at the last waypoint. When I try to do this at the waypoints in the middle, it does not work.
2022-1-3
Use props
djiuser_OR8EW5uz3gSA
lvl.4

Canada
Offline

Turns out I need this type of action also. So I got this to work by creating an associate trigger with 0 waiting time to stop flying. I associated that with the first action I uploaded and then created another associate trigger to start flying when the previous action (stop flying) is finished after 10 seconds.

Order of my actions:
Gimbal Pitch - reach trigger
Stop Flying - associate trigger to when Gimbal pitch action is finished
Start Flying - waiting time of 10 seconds before it executes - associated with Stop flying action
...Rest of my actions

One mistake I made that may or may not help is I was incorrectly incrementing my Action ID with a postfix operator when I should have used prefix. This resulted in actions having the wrong associateActionID.

e.g.
postfix: actionID++
prefix:++actionID
2022-1-5
Use props
Advanced
You need to log in before you can reply Login | Register now

Credit Rules