What are the stages for initialising and executing a WayPoint Mission in DJI Windows SDK?
I am using the following code to try and initialise a Waypoint Mission and load it to the aircraft ( a DJI Mavic Air).
I first check the state of the waypoint handler, then initialise a waypoint, add it to the list, then include the list in the initialised waypoint mission. The method for loading the waypoint mission to the aircraft is then run and the state checked afterwards. The output from the debugs is seen below:
Waypoint state = READY_TO_UPLOAD;
New waypoint location - 55.555549621582,0.555555522441864
Load mission return value - INVALID_REQUEST_IN_CURRENT_STATE
Waypoint state = READY_TO_UPLOAD
The state of READY_TO_UPLOAD suggests that it is in a suitable state to upload the waypoint mission according to the Windows SDK documentation, however clearly the upload fails and the state remains unchanged.
What needs to be changed in order for the waypoint mission to successfully load so it can be run by the aircraft?
CODE:
//Check the initial state of the waypoint handler
var currentState = DJISDKManager.Instance.WaypointMissionManager.GetWaypointMissionHandler(0).GetCurrentState();
Debug.WriteLine("Waypoint state = {0}", currentState);
//Initialise new location coordinate
randomLocation.X = 55.55555;
randomLocation.Y = 0.55555555;
Debug.WriteLine("New waypoint location - {0},{1}", randomLocation.X, randomLocation.Y);
LocationCoordinate2D waypointLocation = new LocationCoordinate2D { latitude = randomLocation.X, longitude = randomLocation.Y };
// Create a waypoint instance and add to waypoint list
Waypoint waypoint = new Waypoint { location = waypointLocation };
waypointList.Add(waypoint);
//Create new waypoint mission instance and load in the waypoint list
WaypointMission waypointMission = new WaypointMission
{
waypointCount = 1,
autoFlightSpeed = 2.5,
finishedAction = WaypointMissionFinishedAction.NO_ACTION,
headingMode = WaypointMissionHeadingMode.USING_WAYPOINT_HEADING,
flightPathMode = WaypointMissionFlightPathMode.CURVED,
repeatTimes = 0,
waypoints = waypointList,
missionID = 1
};
//load the waypoint mission to the aircraft and check the current state
var load_retval = DJISDKManager.Instance.WaypointMissionManager.GetWaypointMissionHandler(0).LoadMission(waypointMission); ;
Debug.WriteLine("Load mission return value - {0}", load_retval);
currentState = DJISDKManager.Instance.WaypointMissionManager.GetWaypointMissionHandler(0).GetCurrentState();
Debug.WriteLine("Waypoint state = {0}", currentState);
请先登录再写评论。
评论
1 条评论