dji-sdk / Mobile-SDK-iOS

DJI Mobile SDK for iOS: http://developer.dji.com/mobile-sdk/
Other
576 stars 255 forks source link

Waypoint V2 Distance Interval not taking photos at specified distance #501

Open brien-crean opened 2 years ago

brien-crean commented 2 years ago

The SDK does not seem to be taking photos at the specified distance interval. After running a few tests with different distances it's taking a quarter of the photos that it should.

E.g. If a flight line between two waypoints is 200m and I set the interval to be 4m the camera should take around 50 photos but instead I get 12. I ran this a few times on different flights with different path lengths and photo distance intervals. It seems to be increasing the distance interval by a factor of 4.

Am I doing something wrong?

iOS SDK 4.15.2 M300 with P1 camera

  DJIWaypointV2Actuator* actuator = [[DJIWaypointV2Actuator alloc] init];
  actuator.actuatorIndex = 0;
  actuator.type = DJIWaypointV2ActionActuatorTypeCamera;
  DJIWaypointV2CameraActuatorParam* cameraActuatorParam = [[DJIWaypointV2CameraActuatorParam alloc] init];
  cameraActuatorParam.operationType = DJIWaypointV2ActionActuatorCameraOperationTypeTakePhoto;
  actuator.cameraActuatorParam = cameraActuatorParam;

  DJIWaypointV2Trigger* trigger = [[DJIWaypointV2Trigger alloc] init];
  trigger.actionTriggerType = DJIWaypointV2ActionTriggerTypeInterval;
  DJIWaypointV2IntervalTriggerParam* distTrigParam = [[DJIWaypointV2IntervalTriggerParam alloc] init];
  distTrigParam.actionIntervalType = DJIWaypointV2ActionIntervalTypeDistance;
  distTrigParam.interval = 4.0;
  distTrigParam.startIndex = 0;
  trigger.intervalTriggerParam = distTrigParam;

  DJIWaypointV2Action *action = [[DJIWaypointV2Action alloc] init];
  action.trigger = trigger;
  action.actuator = actuator;
  action.actionId = ++startActionID;
dji-dev commented 2 years ago

Agent comment from DJI SDK in Zendesk ticket #59906:

尊敬的开发者,感谢您联系DJI 大疆创新 由于github不是我们主要的咨询渠道,您的问题可能跟进不及时。我们建议您通过填写表单( https://djisdksupport.zendesk.com/hc/zh-cn/requests/new )向我们反馈问题。或者您也可以在论坛发帖,与其它开发者交流。论坛链接:https://djisdksupport.zendesk.com/hc/zh-cn/community/topics

Dear developer, thank you for contacting DJI. Since github is not our main consultation channel, your questions may not be followed up in time. We recommend that you fill in the form (https://djisdksupport.zendesk.com/hc/en-us/requests/new) to report problems to us. Or you can post in the forum to communicate with other developers. Forum link: https://djisdksupport.zendesk.com/hc/zh-cn/community/topics

°°°

dji-dev commented 2 years ago

Agent comment from cheney.zeng in Zendesk ticket #59906:

Because your same questions are in different work order, and the answer will be in the #59918, please check it.

°°°

brien-crean commented 2 years ago

Thanks for the reply. I think I found the cause of the issue. After further testing it seems like the enums DJIWaypointV2ActionIntervalTypeDistance and DJIWaypointV2ActionIntervalTypeTime have potentially been mixed up in the SDK.

If I configure an action to shoot photos at intervals between two waypoints with DJIWaypointV2ActionIntervalTypeDistance as the actionIntervalType and pass it a value of 6 as the interval. Instead of taking photos every 6 metres it takes a photo every 6 seconds.

If I do the reverse, set the interval type to time and pass a value of 6, photos are taken every 6 metres instead of every 6 seconds.

dji-dev commented 2 years ago

Agent comment from cheney.zeng in Zendesk ticket #59906:

I have tested it here, and I set it as 12m distance interval trigger for shooting single photo, and the speed is set as 2m/s, it works well.

And if I set it as 6m distance interval trigger, if the speed is 1m/s, it would work as well. If the speed set too large, the Camera could not be stable for taking photos.

As we mentioned in previous mail, the Camera need times to shoot and handle the photo, so if the aircraft moves too fast between the 2 interval point, the take photo action will be affected.

If your distance interval value is too small, the flight speed also should be small.

As you mentioned that you set it as distance, but actually the time interval trigger, the issue does not exist, as my test result, the 12m distance interval trigger and 2m/s flight speed, the photo taking interval is 6 seconds.

°°°

byuarus commented 2 years ago

Hi @dji-dev,

I'm also using: iOS SDK 4.15.2 M300 with P1 camera

I can confirm that from my tests I receive the same results as @brien-crean. The DJIWaypointV2ActionIntervalTypeDistance and DJIWaypointV2ActionIntervalTypeTime are definitely mixed up in the SDK. Please give this issue a second review.

Thank you

Code that I'm using for tests:


    func takeDistanceIntervalPhotosAction(waypointIndex: Int, distance: Double, actionID: UInt) -> DJIWaypointV2Action {
        let intervalTriggerParam = DJIWaypointV2IntervalTriggerParam()
        intervalTriggerParam.actionIntervalType = .time // Bug in DJISDK time and distance are inverted
        intervalTriggerParam.interval = Float(distance)
        intervalTriggerParam.startIndex = UInt(waypointIndex)

        let trigger = DJIWaypointV2Trigger()
        trigger.actionTriggerType = .interval
        trigger.intervalTriggerParam = intervalTriggerParam

        let cameraActuatorParam = DJIWaypointV2CameraActuatorParam()
        cameraActuatorParam.operationType = .takePhoto

        let actuator = DJIWaypointV2Actuator()
        actuator.type = .camera
        actuator.cameraActuatorParam = cameraActuatorParam

        let action = DJIWaypointV2Action()
        action.trigger = trigger
        action.actuator = actuator
        action.actionId = actionID

        return action
    }
dji-dev commented 2 years ago

Agent comment from cheney.zeng in Zendesk ticket #59906:

Hi byuarus,

In my test result, the 12m distance interval trigger and 2m/s flight speed, the photo taking interval is 6 second. Could you have a try, and if the issue does exist in your side, please use mobile phone to record a video to us further check.

And also you could provide your test distance interval value and flight speed for us to review it.

°°°