dbaldwin / DronePan

DronePan - 360 aerial panoramas with DJI Inspire 1, Phantom 3/4, Mavic Pro and Osmo
http://www.dronepan.com
Other
104 stars 32 forks source link

Inspire 1 and Phantom 4 reporting incorrect gimbal values #48

Closed chrissearle closed 8 years ago

chrissearle commented 8 years ago

Check this log - http://pastebin.com/PdSaXZpJ

We set a yaw but it never moves.

Wonder if we need to check gimbal work mode - possible values:

DJIGimbalWorkModeFreeMode
DJIGimbalWorkModeFpvMode
DJIGimbalWorkModeYawFollowMode
DJIGimbalWorkModeUnknown

We can set with gimbal setGimbalWorkMode:withCompletion:

chrissearle commented 8 years ago

Second report - http://pastebin.com/GBR35eBT

chrissearle commented 8 years ago

Three i1s that won't reset because the yaw is not changing when we ask it to. But the users are saying that it is pointing towards craft forwards.

Is it possible that the gimbal yaw value is being sent relative to heading rather than relative to nose?

dbaldwin commented 8 years ago

We should confirm that these users are on the latest firmware. The yaw value should be relative to the nose of the aircraft. From the SDK header file:

DJIGimbalState "The current gimbal attitude in degrees. Roll, pitch and yaw are 0 if the gimbal is level with the aircraft and points in the forward direction of the aircraft."

chrissearle commented 8 years ago

It's odd - the logs show very clearly that the yaw value is not changing at all.

chrissearle commented 8 years ago

Feel free to ask in FB - I've asked - but not got a response yet.

https://www.facebook.com/groups/dronepan/permalink/256940001325255/?comment_id=256942621324993&comment_tracking=%7B%22tn%22%3A%22R%22%7D

chrissearle commented 8 years ago

DJIGimbalDelegate is here

https://github.com/dbaldwin/DronePan/blob/master/DronePan/GimbalController.swift#L316-L324

It's being called - but for some inspire's the yaw value is fixed - doesn't change.

chrissearle commented 8 years ago

More reports from inspire users including i1 pro too now. They say that they can see the gimbal is pointing forwards but the value in the DJIGimbalState is fixed (and nearly always negative in each error report so far). It simply doesn't change.

This is only observed in 3.1 - haven't had a release to testers of 3.1.1 and not observable in 3.2 until #55 (DJIGimbalDelegate method not called) is fixed.

dbaldwin commented 8 years ago

I changed the title to include include the P4. This commit fixes the delegate issue in SDK 3.2:

https://github.com/dbaldwin/DronePan/commit/185a901eeafaa6792309ddac55226b603babe235

and my P4 yaw value is not anywhere near zero even though the gimbal is pointed straight forward in the direction of the nose. See attached.

img_0102

dbaldwin commented 8 years ago

From DJI:

"I think for the Inspire 1 and Phantom 4, we now use the Ground System North as the 0 for the Yaw. ( Relative to the Nose). I think for our documentation about the GimbalState, we need to make some adjustment."

chrissearle commented 8 years ago

I don't understand the DJI response.

And surely the gimbal attitude should remain relative to nose without any other values? The aircraft heading changes - but not the gimbal yaw attitude relative to the aircraft. This feels like a regression.

chrissearle commented 8 years ago

https://github.com/dbaldwin/DronePan/wiki/Yaw-Values

chrissearle commented 8 years ago

So far it looks like:

This is hard to test - since in the simulator - that gimbal yaw figure is relative to the physical aircraft yaw of the unit being tested as it sits on the bench - not relative to the simulated aircraft yaw (which is what we are seeing from the flight controller delegate.

Still not sure what the correct fix is here.

chrissearle commented 8 years ago

I've added code to tell the gimbal controller what the aircraft yaw is.

Then - in check where we log what yaw is wanted and what the current yaw is - it also logs what the current AC yaw is.

We can then collect a set of logs - and compare - is it as simple as removing the ac yaw from current yaw for the P4 and I1?

mjerris commented 8 years ago

Do you need some testing on this? If so let me know what you need. I have inspire, p4 and osmo

dbaldwin commented 8 years ago

@mjerris when this beta goes to Testflight we'll definitely want help testing. Any and all testing is welcome since this issue has been plaguing us for a while.