WaypointMission feature in MSDK is consisted of WaypointMission class, WaypontMissionOperator class, Waypoint class and WaypointAction class.
You can treat a WaypointMissionOperator as an operator of a waypointMission, it is a static member so it does not need to be created or instantiated, you only need to get it from MissionControl and use it. Its common methods are loadMission(), uploadMission(), startMission(), retryUploadMission(), downloadMission(), resumeMission(), pauseMission() and stopMission(). You can refer a common waypointMission flow from figure 1.
Figure 1. WaypointMission flow
a state machine in WaypointMissionOperator is called WaypointMissionState. Its initial state is READY_TO_UPLOAD. We haveto build up a WaypointMission before calling loadMission(). The next step is calling upLoadMission() to upload a mission into the aircraft via airlink. Since all the waypoints are uploaded one by one each time, you need to use WaypointMissionUploadEvent's getProgress() to check the upload progress. Now the WaypontMissionOperator's state will be changed to UPLOADING. If the upload action is failed, you need to call retryUploadMission(). If the upload action is successful, the WaypontMissionOperator's state will change to READY_TO_EXECUTE. Then you can call startMission() to start the mission and the WaypontMissionOperator's state will change to EXECUTING.
WaypointMission is a special element that you don't need to create it, you need to create its builder.
- WaypointMission.Builder builder = new WaypointMission.Builder()
- Define some attributes inside this builder such as autoFlightSpeed, maxFlightSpeed and finishedAction.
- Create a List<Waypoint>, create some waypoints and add them in.
- Call builder.build.
We will put Waypoint and WaypointAction together to discuss. Waypoint is a waypoint inside a waypointMission. Once a waypoint is set, the aircraft will fly toawrd to it and execute pre-defined waypointActions.
- The maximun distance between 2 waypoints is 2km.
- The minimum distance between 2 waypoints is 0.5m.
- You can only set up to 99 waypoints.
- P4R can set up to 200 wapoints.
- The maximum distance for a waypointMission is 40km.
WaypointAction has STAY, START_TAKE_PHOTO, START_RECORD, STOP_RECORD, ROTATE_AIRCRAFT and GIMBAL_PITCH.
- STAY can set up to 32767ms.
- START_TAKE_PHOTO, START_RECORD, STOP_RECORD can set up to 6s.
- The range of ROTATE_AIRCRAFT is -180~180.
- The range of GIMBAL_PITCH is -90~0.
After adding these waypointActions, the aircraft can execute some basic missions. We are introducing a state machine called WaypointMissionExecuteState. It is very different from WaypointMissionState. WaypointMissionState is the state machine of WaypointMissionOperator. WaypointMissionExecuteState is the state machine of WaypointMission. Please don't mess up with them. For WaypointMissionExecuteState, we are focusing on INITIALIZING, MOVING, BEGIN_ACTION, DOING_ACTION and FINISHED_ACTION. You can refer to figure 2.
Figure 2. WaypointMissionExecuteState Flow
Comments
0 comments
Please sign in to leave a comment.