-
Notifications
You must be signed in to change notification settings - Fork 32
Algorithms
So what algorithms are we actually using?
The SDK is very much one based on firing off messages and then waiting for status updates. So let's take a quick look at how we're using it to try to avoid missing moves/shots etc.
The flowcharts below are simplified and don't show handling for errors, or user triggered presentation stop.
Gimbal attitude is easy to change - you send it a message "Move to pitch X, yaw Y and roll Z"
Once that's done - you wait for it to send gimbal state updates - and look at the returned values of current pitch/yaw/roll.
We will wait 5 times "the time the gimbal has been told to use + 0.5s" (currently a total of about 5s) for the reported values to get close enough to the requested values before giving up with an "Unable to set gimbal attitude" error.
This is a little more complex - since the camera can be shooting or storing.
We ask it to take a shot - and then wait for updates. When checking - if the camera hasn't even started shooting - we send the take a photo command again. If it's started shooting or is storing - we'll just wait for another loop. So - it gets 5 attempts to actually start taking a photo - and once a photo is started it gets 5 attempts (currently 10 seconds total) to actually save it.
This is more complex - there's an issue with "yaw to this angle" functionality in the current firmware versions (drift protection was disabled by DJI). So we have to "yaw with this speed" - and we're still working on the best method here. Sadly - some users are still experiencing drift - even though DJI says that this is less affected. We're pushing for them to re-enabled drift protection on yaw.

