可以通过 START_STOP_FLY 动作来实现。具体方法为:
WaypointActuator waypointAction1Actuator = new WaypointActuator.Builder()
.setActuatorType(ActionTypes.ActionActuatorType.AIRCRAFT_CONTROL)
.setAircraftControlActuatorParam(new WaypointAircraftControlParam.Builder()
.setAircraftControlType(ActionTypes.AircraftControlType.START_STOP_FLY)
.setFlyControlParam(new WaypointAircraftControlStartStopFlyParam.Builder()
.setStartFly(false)
.build())
.build())
.build();
执行这个action后飞机会悬停,悬停期间您可以执行其它的航点动作。待其它航点动作都执行完毕后,通过触发器,触发START_STOP_FLY 航点动作,继续航线任务。继续航线任务的代码可以参考:
WaypointTrigger waypointAction2Trigger = new WaypointTrigger.Builder()
.setTriggerType(ActionTypes.ActionTriggerType.ASSOCIATE)
.setAssociateParam(new WaypointV2AssociateTriggerParam.Builder()
.setAssociateActionID(associateActionId)
.setAssociateType(ActionTypes.AssociatedTimingType.AFTER_FINISHED)
.setWaitingTime(0)
.build())
.build();
WaypointActuator waypointAction2Actuator = new WaypointActuator.Builder()
.setActuatorType(ActionTypes.ActionActuatorType.AIRCRAFT_CONTROL)
.setAircraftControlActuatorParam(new WaypointAircraftControlParam.Builder()
.setAircraftControlType(ActionTypes.AircraftControlType.START_STOP_FLY)
.setFlyControlParam(new WaypointAircraftControlStartStopFlyParam.Builder()
.setStartFly(true)
.build())
.build())
.build();
WaypointV2Action waypointAction2 = new WaypointV2Action.Builder()
.setActionID(++actionId)
.setTrigger(waypointAction2Trigger)
.setActuator(waypointAction2Actuator)
.build();
waypointV2ActionList.add(waypointAction2);
执行完这个action之后飞机会解除悬停状态,这样就实现了航点动作的悬停功能。
评论
0 条评论
请登录写评论。