MSDK4.15.1, M300机型,执行航点动作无效,设置航点拍照没有照片,航点动作onExecutionUpdate 回调出错
CompletedMSDK4.15.1, M300机型,航点动作上传没有出错,执行航点动作无效,设置航点拍照没有照片,航点动作回调onExecutionUpdate方法报错Unknown error, please contact SDK dev team, code: 65535。
下面是创建航点动作的代码,帮忙看下是否有问题,多谢了!!
public class WaypointV2Factory {
//旋转飞机的偏航角
public static WaypointV2Action getRotateActuator(int actionId, int startIndex, float heading) {
WaypointActuator waypointActuator = new WaypointActuator.Builder()
.setActuatorType(ActionTypes.ActionActuatorType.AIRCRAFT_CONTROL)
.setAircraftControlActuatorParam(new WaypointAircraftControlParam.Builder()
.setAircraftControlType(ActionTypes.AircraftControlType.ROTATE_YAW)
.setRotateYawParam(new WaypointAircraftControlRotateYawParam.Builder()
.setDirection(WaypointV2MissionTypes.WaypointV2TurnMode.CLOCKWISE)
.setRelative(false)
.setYawAngle(heading).build())
.build())
.build();
WaypointTrigger waypointTrigger = new WaypointTrigger.Builder()
.setTriggerType(ActionTypes.ActionTriggerType.REACH_POINT)
.setAssociateParam(new WaypointV2AssociateTriggerParam.Builder()
.setAssociateType(ActionTypes.AssociatedTimingType.AFTER_FINISHED)
.setAssociateActionID(actionId)
.setWaitingTime(0)
.build())
.build();
WaypointV2Action waypointV2Action = new WaypointV2Action.Builder()
.setTrigger(waypointTrigger)
.setActuator(waypointActuator)
.setActionID(actionId)
.build();
return waypointV2Action;
}
//云台
public static WaypointV2Action getGimbalAction(int actionId, int startIndex, float pitch) {
Rotation rotaion = new Rotation.Builder()
.pitch(pitch)
.time(1)
.mode(RotationMode.RELATIVE_ANGLE)
.build();
WaypointActuator waypointActuator = new WaypointActuator.Builder()
.setActuatorType(ActionTypes.ActionActuatorType.GIMBAL)
.setGimbalActuatorParam(new WaypointGimbalActuatorParam.Builder()
.rotation(rotaion)
.operationType(ActionTypes.GimbalOperationType.ROTATE_GIMBAL)
.build())
.build();
WaypointTrigger waypointTrigger = new WaypointTrigger.Builder()
.setTriggerType(ActionTypes.ActionTriggerType.REACH_POINT)
.setReachPointParam(new WaypointReachPointTriggerParam.Builder()
.setStartIndex(startIndex)
.setAutoTerminateCount(1)
.build()).build();
WaypointV2Action gimbalAction = new WaypointV2Action.Builder()
.setActionID(actionId)
.setTrigger(waypointTrigger)
.setActuator(waypointActuator)
.build();
return gimbalAction;
}
//拍照航点动作
public static WaypointV2Action getTakePhotoAction(int actionId, int startIndex) {
WaypointActuator waypointActuator = new WaypointActuator.Builder()
.setActuatorType(ActionTypes.ActionActuatorType.CAMERA)
.setCameraActuatorParam(new WaypointCameraActuatorParam.Builder()
.setCameraOperationType(ActionTypes.CameraOperationType.SHOOT_SINGLE_PHOTO)
.build())
.build();
WaypointTrigger waypointTrigger = new WaypointTrigger.Builder()
.setTriggerType(ActionTypes.ActionTriggerType.REACH_POINT)
.setReachPointParam(new WaypointReachPointTriggerParam.Builder()
.setStartIndex(startIndex)
.setAutoTerminateCount(1)
.build()).build();
WaypointV2Action takePhotoAction = new WaypointV2Action.Builder()
.setActionID(actionId)
.setTrigger(waypointTrigger)
.setActuator(waypointActuator)
.build();
return takePhotoAction;
}
//开始录像航点动作
public static WaypointV2Action getStartRecordVideoAction(int actionId, int startIndex) {
WaypointActuator waypointActuator = new WaypointActuator.Builder()
.setActuatorType(ActionTypes.ActionActuatorType.CAMERA)
.setCameraActuatorParam(new WaypointCameraActuatorParam.Builder()
.setCameraOperationType(ActionTypes.CameraOperationType.START_RECORD_VIDEO)
.build())
.build();
WaypointTrigger waypointTrigger = new WaypointTrigger.Builder()
.setTriggerType(ActionTypes.ActionTriggerType.REACH_POINT)
.setReachPointParam(new WaypointReachPointTriggerParam.Builder()
.setStartIndex(startIndex)
.setAutoTerminateCount(1)
.build()).build();
WaypointV2Action recordVideoAction = new WaypointV2Action.Builder()
.setActionID(actionId)
.setTrigger(waypointTrigger)
.setActuator(waypointActuator)
.build();
return recordVideoAction;
}
//结束录像航点动作
public static WaypointV2Action getStopRecordVideoAction(int actionId, int startIndex) {
WaypointActuator waypointActuator = new WaypointActuator.Builder()
.setActuatorType(ActionTypes.ActionActuatorType.CAMERA)
.setCameraActuatorParam(new WaypointCameraActuatorParam.Builder()
.setCameraOperationType(ActionTypes.CameraOperationType.STOP_RECORD_VIDEO)
.build())
.build();
WaypointTrigger waypointTrigger = new WaypointTrigger.Builder()
.setTriggerType(ActionTypes.ActionTriggerType.REACH_POINT)
.setReachPointParam(new WaypointReachPointTriggerParam.Builder()
.setStartIndex(startIndex++)
.setAutoTerminateCount(startIndex)
.build())
.build();
WaypointV2Action stopRecordVideoAction = new WaypointV2Action.Builder()
.setActionID(actionId)
.setTrigger(waypointTrigger)
.setActuator(waypointActuator)
.build();
return stopRecordVideoAction;
}
//按照距离间距拍照
public static WaypointV2Action takePhotoByDistance(int actionId, int startIndex, float distance) {
WaypointActuator waypointActuator = new WaypointActuator.Builder()
.setActuatorType(ActionTypes.ActionActuatorType.CAMERA)
.setCameraActuatorParam(new WaypointCameraActuatorParam.Builder()
.setCameraOperationType(ActionTypes.CameraOperationType.SHOOT_SINGLE_PHOTO)
.build())
.build();
WaypointTrigger waypointTrigger = new WaypointTrigger.Builder()
.setTriggerType(ActionTypes.ActionTriggerType.SIMPLE_INTERVAL)
.setIntervalTriggerParam(new WaypointIntervalTriggerParam.Builder()
.setStartIndex(startIndex)
.setType(ActionTypes.ActionIntervalType.DISTANCE)
.setInterval(distance)
.build()
)
.build();
WaypointV2Action takePhotoAction = new WaypointV2Action.Builder()
.setActionID(actionId)
.setTrigger(waypointTrigger)
.setActuator(waypointActuator)
.build();
return takePhotoAction;
}
//按照时间的间距拍照
public static WaypointV2Action takePhotoByTime(int actionId, int startIndex, float time) {
WaypointActuator waypointActuator = new WaypointActuator.Builder()
.setActuatorType(ActionTypes.ActionActuatorType.CAMERA)
.setCameraActuatorParam(new WaypointCameraActuatorParam.Builder()
.setCameraOperationType(ActionTypes.CameraOperationType.SHOOT_SINGLE_PHOTO)
.build())
.build();
WaypointTrigger waypointTrigger = new WaypointTrigger.Builder()
.setTriggerType(ActionTypes.ActionTriggerType.SIMPLE_INTERVAL)
.setIntervalTriggerParam(new WaypointIntervalTriggerParam.Builder()
.setStartIndex(startIndex)
.setType(ActionTypes.ActionIntervalType.TIME)
.setInterval(time)
.build()
)
.build();
WaypointV2Action takePhotoAction = new WaypointV2Action.Builder()
.setActionID(actionId)
.setTrigger(waypointTrigger)
.setActuator(waypointActuator)
.build();
return takePhotoAction;
}
}
Please sign in to leave a comment.
Comments
2 comments