dji-sdk / Mobile-SDK-Android

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

M300 gets stuck at waypoints #763

Open tobiasfriden opened 3 years ago

tobiasfriden commented 3 years ago

Hello,

I am trying to implement a WaypointV2 mission with MSDK and Matrice 300 RTK.

However, I have issues where the drone sometimes gets randomly "stuck" between waypoints, i. e. the WaypointV2MissionOperatorListener reports that the waypoint before has been reached, and then the drone stops in the air. Pushing the remote controller stick does not solve the issue, but pausing and then resuming the mission causes the drone to start going backwards along the waypoints.

Everything works fine when WaypointV2FlightPathMode is set to GOTO_POINT_STRAIGHT_LINE_AND_STOP but I get this behaviour with both CURVATURE_CONTINUOUS_PASSED and COORDINATE_TURN. I assume it is related to the damping distance as changing this value makes it stop at other waypoints, but I am not sure how to set it (I find the documentation quite unclear).

Any help or explanation what causes this behaviour greatly appreciated!

tobiasfriden commented 3 years ago

Some further info: I added a print in the onExecutionUpdate callback and I can see that in the problematic mode the "reached" count stops updating (and after a while the drone stops) but when using GOTO_POINT_STRAIGHT_LINE_AND_STOP it keeps reaching waypoints. So it seems it is not reaching the waypoints (which explains why it would start going backwards)

dji-dev commented 3 years ago

Agent comment from William Wong in Zendesk ticket #43736:

Dear Client Thank you for contacting DJI.

I feel like these two waypoints mode cannot activate the waypoint trigger, try GOTO_POINT_CURVE_AND_STOP and see if the reachPoint trigger has been trigger or not.

Hopefully our solution can help you. Kindly Regards, DJI Developer Support


inline-1040295511.png

tobiasfriden commented 3 years ago

Hello,

I tried the GOTO_POINT_CURVE_AND_STOP and I get issues in this mode as well. Here is a log output from my app:

2021-02-05 11:18:08.851 2534-2534/com.dronemissioncontrol.dmcplanning D/V2Handler: total waypoints: 17
2021-02-05 11:18:09.011 2534-3805/com.dronemissioncontrol.dmcplanning D/V2Handler: uploaded: -1/17
2021-02-05 11:18:09.525 2534-3805/com.dronemissioncontrol.dmcplanning D/V2Handler: uploaded: 12/17
2021-02-05 11:18:10.166 2534-3805/com.dronemissioncontrol.dmcplanning D/V2Handler: uploaded: 16/17
2021-02-05 11:18:10.176 2534-3805/com.dronemissioncontrol.dmcplanning D/V2Handler: action upload: READY_TO_UPLOAD
2021-02-05 11:18:10.682 2534-3805/com.dronemissioncontrol.dmcplanning D/V2Handler: action upload: UPLOADING
2021-02-05 11:18:10.908 2534-3805/com.dronemissioncontrol.dmcplanning D/V2Handler: action upload: UPLOADING
2021-02-05 11:18:11.140 2534-3805/com.dronemissioncontrol.dmcplanning D/V2Handler: action upload: UPLOADING
2021-02-05 11:18:11.374 2534-3805/com.dronemissioncontrol.dmcplanning D/V2Handler: action upload: UPLOADING
2021-02-05 11:18:11.383 2534-3805/com.dronemissioncontrol.dmcplanning D/V2Handler: action upload: READY_TO_EXECUTE
2021-02-05 11:18:40.535 2534-3805/com.dronemissioncontrol.dmcplanning D/V2Handler: reached: 1
2021-02-05 11:18:40.535 2534-3805/com.dronemissioncontrol.dmcplanning D/V2Handler: MOVING
2021-02-05 11:18:48.251 2534-3805/com.dronemissioncontrol.dmcplanning D/V2Handler: reached: 2
2021-02-05 11:18:48.251 2534-3805/com.dronemissioncontrol.dmcplanning D/V2Handler: MOVING
2021-02-05 11:18:53.228 2534-3805/com.dronemissioncontrol.dmcplanning D/V2Handler: reached: 3
2021-02-05 11:18:53.231 2534-3805/com.dronemissioncontrol.dmcplanning D/V2Handler: MOVING
2021-02-05 11:18:59.517 2534-3805/com.dronemissioncontrol.dmcplanning D/V2Handler: reached: 4
2021-02-05 11:18:59.517 2534-3805/com.dronemissioncontrol.dmcplanning D/V2Handler: MOVING

As can be seen, after reaching the 4th waypoint the state is still MOVING but the drone just stops (horizontal velocity 0). The flight mode is still reported as F-WP.

Edit: When it stops in this mode, i noticed in the HMS system in DJI Pilot that there is actually a "Flight Controller Data Error" (code 0x1610004d) and I cannot do another mission without restarting the drone.

dji-dev commented 3 years ago

Agent comment from William Wong in Zendesk ticket #43736:

Dear Client Thank you for contacting DJI.

I have tried locally but I havn;t meet your problem, have you update your firmware to the latest? Or you can just send me your waypoint coordinates and settings without actions, I will test it locally.

Hopefully our solution can help you. Kindly Regards, DJI Developer Support


inline-609259958.png

tobiasfriden commented 3 years ago

Hello,

I will try to provide as much information as possible. Here is the log for creating the mission (along with waypoint coordinates):

2021-02-08 10:42:51.649 D/V2Handler: (i,lat,lng,alt): 0,57.3431407,12.3007324,50.0
2021-02-08 10:42:51.649 D/V2Handler: (i,lat,lng,alt): 1,57.343236,12.300419,49.966316
2021-02-08 10:42:51.649 D/V2Handler: (i,lat,lng,alt): 2,57.343236,12.300419,39.966316
2021-02-08 10:42:51.649 D/V2Handler: (i,lat,lng,alt): 3,57.343395,12.30045,40.052406
2021-02-08 10:42:51.649 D/V2Handler: (i,lat,lng,alt): 4,57.3435739,12.3004849,40.112846
2021-02-08 10:42:51.649 D/V2Handler: (i,lat,lng,alt): 5,57.343395,12.30045,40.052406
2021-02-08 10:42:51.649 D/V2Handler: (i,lat,lng,alt): 6,57.343236,12.300419,39.966316
2021-02-08 10:42:51.649 D/V2Handler: (i,lat,lng,alt): 7,57.343076,12.30039,39.973854
2021-02-08 10:42:51.650 D/V2Handler: (i,lat,lng,alt): 8,57.342915,12.300359,39.974934
2021-02-08 10:42:51.650 D/V2Handler: (i,lat,lng,alt): 9,57.3427361,12.3003246,39.935196
2021-02-08 10:42:51.650 D/V2Handler: (i,lat,lng,alt): 10,57.342915,12.300359,39.974934
2021-02-08 10:42:51.650 D/V2Handler: (i,lat,lng,alt): 11,57.343076,12.30039,39.973854
2021-02-08 10:42:51.650 D/V2Handler: (i,lat,lng,alt): 12,57.343236,12.300419,39.966316
2021-02-08 10:42:51.650 D/V2Handler: (i,lat,lng,alt): 13,57.343236,12.300419,49.966316
2021-02-08 10:42:51.650 D/V2Handler: (i,lat,lng,alt): 14,57.3431407,12.3007324,50.0
2021-02-08 10:42:51.650 D/V2Handler: total waypoints: 15
2021-02-08 10:42:51.773 D/V2Handler: uploaded: -1/15
2021-02-08 10:42:51.955 D/V2Handler: uploaded: 12/15
2021-02-08 10:42:52.372 D/V2Handler: uploaded: 14/15
2021-02-08 10:43:23.466 D/V2Handler: reached: 1
2021-02-08 10:43:23.466 D/V2Handler: GO_TO_FIRST_WAYPOINT
2021-02-08 10:43:31.275 D/V2Handler: reached: 2
2021-02-08 10:43:31.275 D/V2Handler: MOVING
2021-02-08 10:43:36.280 D/V2Handler: reached: 3
2021-02-08 10:43:36.281 D/V2Handler: MOVING
2021-02-08 10:43:42.591 D/V2Handler: reached: 4
2021-02-08 10:43:42.591 D/V2Handler: MOVING

(After reached 4 it stops in the air.) The simulation is started at coordinates 57.3431407,12.3007324. Also noticable is that when I start the mission, the drone just does takeoff to 1.2 meters and then stops. I have to push right stick forward in order for it to ascend to 50 meters (but after ascending to 50 it starts moving by itself, until it reaches the point where it gets completely stuck. Then pushing the stick doesn't help either). I tried to disable obstacle avoidance in Pilot app but no change.

My code for creating waypoints/the mission:

Log.d(TAG, "(i,lat,lng,alt): " + djiWaypoints.size() + "," + point.latitude() + "," + point.longitude()+ "," + alt);
WaypointV2 wp = new WaypointV2.Builder()
        .setAltitude(alt)
        .setCoordinate(
                new LocationCoordinate2D(
                        point.latitude(),
                        point.longitude()
                )
        )
        .setAutoFlightSpeed(6)
        .setMaxFlightSpeed(10)
        .setHeadingMode(WaypointV2MissionTypes.WaypointV2HeadingMode.AUTO)
        .setFlightPathMode(djiWaypoints.size() == 0
                ? WaypointV2MissionTypes.WaypointV2FlightPathMode.GOTO_POINT_STRAIGHT_LINE_AND_STOP
                : WaypointV2MissionTypes.WaypointV2FlightPathMode.GOTO_POINT_CURVE_AND_STOP)
        .setUsingWaypointAutoFlightSpeed(true)
        .setUsingWaypointMaxFlightSpeed(true)
        .build();
djiWaypoints.add(wp);
WaypointV2Mission.Builder missionBuilder = new WaypointV2Mission.Builder();
for(WaypointV2 wp : wpList){
    missionBuilder.addWaypoint(wp);
}
missionBuilder.setMissionID(new Random().nextInt(65535));
missionBuilder.setMaxFlightSpeed(10);
missionBuilder.setFinishedAction(WaypointV2MissionTypes.MissionFinishedAction.NO_ACTION);
missionBuilder.setGotoFirstWaypointMode(WaypointV2MissionTypes.MissionGotoWaypointMode.SAFELY);

Actions is just an empty list.

I tried also with CURVATURE_CONTINUOUS_PASSED (same mission) and then it doesn't even reach 4 (just stops after reached 3). But in that case there is no error in the HMS.

With GOTO_POINT_STRAIGHT_LINE_AND_STOP on all the waypoints (again same mission) it works without issues.

Screenshots from DJI Pilot showing firmware and the error (which appears after the drone gets stuck in the mission): image image

Edit: I am running latest MSDK (4.14-trial1) but had the same issue with 4.13.1.

tobiasfriden commented 3 years ago

@dji-dev any update? Did you try it out?

dewens12 commented 3 years ago

I have updated my firmware.

Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows 10

From: DJImailto:notifications@github.com Sent: Sunday, February 7, 2021 1:44 AM To: dji-sdk/Mobile-SDK-Androidmailto:Mobile-SDK-Android@noreply.github.com Cc: Subscribedmailto:subscribed@noreply.github.com Subject: Re: [dji-sdk/Mobile-SDK-Android] M300 gets stuck at waypoints (#763)

Agent comment from William Wong in Zendesk ticket #43736https://djisdksupport.zendesk.com/agent/tickets/43736:

Dear Client Thank you for contacting DJI.

I have tried locally but I havn;t meet your problem, have you update your firmware to the latest? Or you can just send me your waypoint coordinates and settings without actions, I will test it locally. [https://camo.githubusercontent.com/7ab4c0fc6586d0aae6cf129581e6c9a15719159e16b6260959320be5397847f0/68747470733a2f2f646a6973646b737570706f72742e7a656e6465736b2e636f6d2f6174746163686d656e74732f746f6b656e2f73503344735a67743248476e487231477755644f4e736932612]https://camo.githubusercontent.com/7ab4c0fc6586d0aae6cf129581e6c9a15719159e16b6260959320be5397847f0/68747470733a2f2f646a6973646b737570706f72742e7a656e6465736b2e636f6d2f6174746163686d656e74732f746f6b656e2f73503344735a67743248476e487231477755644f4e736932612f3f6e616d653d696e6c696e652d3630393235393935382e706e67

Hopefully our solution can help you. Kindly Regards, DJI Developer Support

​ inline-609259958.pnghttps://djisdksupport.zendesk.com/attachments/token/sP3DsZgt2HGnHr1GwUdONsi2a

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/dji-sdk/Mobile-SDK-Android/issues/763#issuecomment-774628784, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAXVIRI46OAAZNJRD7SZ4ILS5ZAHBANCNFSM4XCZXCBA.

dji-dev commented 3 years ago

Agent comment from William Wong in Zendesk ticket #43736:

Dear Client Thank you for contacting DJI.

We have tested but we cannot replicate the error, would you possbile to generate this error in DJI Pilot also. We doubt it is a signal drone's problem.

Hopefully our solution can help you. Kindly Regards, DJI Developer Support

tobiasfriden commented 2 years ago

Hello @dji-dev , I am still (more than 6 months later) seeing the same issue with latest drone firmware and SDK version (4.15.1). I still get "Flight controller data error" and the drone gets stuck when performing the mission. Could there be any issue with my drone?

cenmmy commented 2 years ago

我也遇到了相同的问题,无人机开始执行航点任务后,有时在上升过程中意外暂停,有时在航点任务的执行过程中意外暂停。当暂停时,有时可以通过遥控的暂停键恢复航点任务继续执行,但有时不行(ˉ▽ˉ;)...,且有时停止航点任务后遥控器遥感在某个方向上不起作用。。。

cenmmy commented 2 years ago

补充一点,上述情况均发生在实际飞行中,在模拟器中飞行是正常的。

cenmmy commented 2 years ago

经过测试,使用DJI Pilot中的航点飞行功能也存在同样的问题,怀疑是错误避障导致,关闭了水平避障之后问题解决

bbenson09 commented 2 years ago

Yup, I've had this problem too. Try turning off horizontal obstacle avoidance, as cenmmy said. That's fixed it for me.