How to use DJI OSDK to make M100 fly to a desired GPS Location?

Viewed 268

I am very new to DJI OSDK. I am currently working on a project, where I need to give the GPS coordinates of a certain location to my M100 and it will fly to that location.

I am currently following the DJI OSDK documentation for Ubntu Linux. I tried using the Waypoints Mission.

In the 'Waypoints' mission, if I set the variable 'wayptPolygonSides' to 1, and then set the desired the GPS coordinates in the iterative algorithm for generating the waypoint, I get this:

STATUS/1 @ getErrorCodeMessage, L656: runWaypointMission
STATUS/1 @ getCMDSetMissionMSG, L883: MISSION_OBTAIN_CONTROL_REQUIRED

STATUS/1 @ printInfo, L204: Mission Manager status:

STATUS/1 @ printInfo, L205: There are 1 waypt missions and 0 hotpoint missions
Initializing Waypoint Mission..
Waypoint created at (LLA): 0.534897 -1.680698 10.000000
Creating Waypoints..
Waypoint created at (LLA): 0.534897 -1.680698 10.000000

STATUS/1 @ getErrorCodeMessage, L656: uploadWaypoints
STATUS/1 @ getCMDSetMissionMSG, L883: WAYPOINT_MISSION_DATA_NOT_ENOUGH
Waypoint created at (LLA): 0.534900 -1.681000 15.000000

STATUS/1 @ getErrorCodeMessage, L656: uploadWaypoints
STATUS/1 @ getCMDSetMissionMSG, L883: WAYPOINT_MISSION_DATA_NOT_ENOUGH
Waypoint created at (LLA): 0.534897 -1.680698 10.000000

STATUS/1 @ getErrorCodeMessage, L656: uploadWaypoints
STATUS/1 @ getCMDSetMissionMSG, L883: WAYPOINT_MISSION_DATA_NOT_ENOUGH
Uploading Waypoints..

STATUS/1 @ getErrorCodeMessage, L656: runWaypointMission
STATUS/1 @ getCMDSetMissionMSG, L883: MISSION_OBTAIN_CONTROL_REQUIRED
1 Answers

The comment about a minimum number of waypoints isn't correct, far as I know the min wp required = 2. Your problem is evident by this log statement:

STATUS/1 @ getCMDSetMissionMSG, L883: MISSION_OBTAIN_CONTROL_REQUIRED

If you're following the sample in the DJI OSDK, you'll see in the main.cpp file for mission sample under the linux platform, line 54 of version 3.9.0 requests referenced control:

vehicle->obtainCtrlAuthority(functionTimeout);

I imagine you're missing this line, or not ensuring it runs correctly.

Additionally, ensure you have the correct control mode selected on the flight controller/Matrice in the DJI Assistant app. See this page for more information on control modes.

Related