大疆社区
标题: 关于V2Action上传Error code -1999的问题 [打印本页]
作者: luckydog 时间: 2020-10-24
标题: 关于V2Action上传Error code -1999的问题
IOS MSDK关于V2 Action的介绍很少,swift没有,oc的只有waypoint没有action的,只好参考android的,但是一直被error code -1999困扰,附上代码,请高手指点下,我要实现的就是到航点停下拍个照再飞往下一个航点
let trigger1 = DJIWaypointV2Trigger()
trigger1.actionTriggerType = .reachPoint
let reachParam1 = DJIWaypointV2ReachPointTriggerParam()
reachParam1.startIndex = 0
reachParam1.waypointCountToTerminate = 0
trigger1.reachPointTriggerParam = reachParam1
let actuator1 = DJIWaypointV2Actuator()
actuator1.type = .aircraftControl
let controlParam1 = DJIWaypointV2AircraftControlParam()
controlParam1.operationType = .flyingControl
controlParam1.flyControlParam.isStartFlying = false
actuator1.aircraftControlActuatorParam = controlParam1
let action1 = DJIWaypointV2Action()
action1.trigger = trigger1
action1.actuator = actuator1
action1.actionId = 0
let trigger2 = DJIWaypointV2Trigger()
trigger2.actionTriggerType = .actionAssociated
let associateParam = DJIWaypointV2AssociateTriggerParam()
associateParam.actionAssociatedType = .afterFinished
associateParam.waitingTime = 1
associateParam.actionIdAssociated = 0
trigger2.associateTriggerParam = associateParam
let actuator2 = DJIWaypointV2Actuator()
actuator2.type = .camera
let gimbalParam2 = DJIWaypointV2CameraActuatorParam()
gimbalParam2.operationType = .takePhoto
actuator2.cameraActuatorParam = gimbalParam2
let action2 = DJIWaypointV2Action()
action2.actionId = 1
action2.trigger = trigger2
action2.actuator = actuator2
let trigger3 = DJIWaypointV2Trigger()
trigger3.actionTriggerType = .actionAssociated
let associateParam2 = DJIWaypointV2AssociateTriggerParam()
associateParam2.actionAssociatedType = .afterFinished
associateParam2.waitingTime = 0
associateParam2.actionIdAssociated = 1
trigger3.associateTriggerParam = associateParam2
let actuator3 = DJIWaypointV2Actuator()
actuator3.type = .aircraftControl
let controlParam3 = DJIWaypointV2AircraftControlParam()
controlParam3.operationType = .flyingControl
controlParam3.flyControlParam.isStartFlying = true
actuator3.aircraftControlActuatorParam = controlParam3
let action3 = DJIWaypointV2Action()
action3.actionId = 2
action3.trigger = trigger3
action3.actuator = actuator3
DJISDKManager.missionControl()?.waypointV2MissionOperator().uploadWaypointActions([action1,action2,action3], withCompletion: { (error) in
if error != nil{
print("动作上传失败\(error)")
}else{
print("动作上传成功")
}
})
作者: 想养一条边牧 时间: 2020-10-26
看起来没问题吧,不加动作能够执行吗?
作者: 王大奔 时间: 2020-11-12
flyControlParam 这个参数需要自己初始化一下
作者: 美洲豹梦想去千岛湖转场 时间: 2020-12-22
亲,你解决了码。我也一致遇到这个问题,头疼中~
作者: 美洲豹梦想去千岛湖转场 时间: 2020-12-23
我找到原因了,不要在callback里调用startMissionWithCompletion, startMissionWithCompletion必须运行在主线程中,坑死了,大疆好像又没说明必须在主线程运行!
欢迎光临 大疆社区 (https://bbs.dji.com/) |
Powered by Discuz! X3.2 |