mickrideout / pix4d-flightplan-to-anafi

Pix4D to Parrot Anafi flight plan translator
Other
1 stars 0 forks source link

Retrieve 'cameraPitch' value to insert it into the flightplan #3

Closed epysod12 closed 9 months ago

epysod12 commented 1 year ago

Hi mickrideout,

By default, it looks like the tilt value is 90 degrees, could we grab the "cameraPitch" value from the Pix4D JSON and include it in the FF6 flightplan?

I noticed a strange thing about it, warning, it stings the eyes: Writing a positive value in FF6 JSON is equivalent to writing a negative value in FF6 Application, and the tilt goes UP! Writing a negative value in FF6 JSON is equivalent to writing a positive value in FF6 Application, and the tilt goes DOWN!

Visually, it looks like this: (be careful, these pictures don't make sense) :D

_ positive -> negative -> UP! 001

_ negative -> positive -> DOWN! 002

(we can see a demonstration of this use here, in this tutorial in French: Flightplan leçon 3 - Orienter la caméra)

It's especially the occasion here to document this oddity, but also to see if it was possible to implement it directly in your script, by simply adding the "minus" sign to get the right angle. It frequently happens to put value at 80 degrees in a flightplan to reduce certain distortions that one could have by photogrammetry.

Thanks in advance!

epysod12

mickrideout commented 1 year ago

Hi epysod12,

Thats very confusing that having the tilt inverted between the json and the GUI.

Looking at your sample Pix4D JSON (now placed in samples/details.pix4dcapture-mission in the repo):

      {
        "mediaDescriptor": {
          "mediaId": "103002140467.JPG"
        },
        "pose": {
          "cameraOrientation": [
            325.3234437725471,
            3.76535223517333,
            0.7089872428648107
          ],
          "location": [
            6.1001816574204515,
            49.744621771390925,
            7.03810453414917
          ],
          "orientation": [
            325.3234437725471,
            3.76535223517333,
            0.7089872428648107
          ],
          "time": 1.66903313E9,
          "velocity": [
            0.8711458444595337,
            -0.6026827692985535,
            -0.0932857096195221
          ]
        },
        "source": "Telemetry"
      },

"cameraOrientation" appears to the entry where we could potentially obtain the pitch from. I came across this post: https://community.pix4d.com/t/question-about-camera-orientation-using-measured-location-and-rotatio/8322/2 which explains the values as being:

Kappa: Describes the Azimuth of the image. E.g. a value of 135 degrees means, the camera is pointing in the direction of South-East. Valid values are 0 to 360 degress, clockwise around the Z-axis of the used coordinate system (LV03 in my case).
Omega: Describes the down- or upward looking angle. E.g. the value 0 stands for nadir looking, the value 180 stands for verticaly upward looking and 90 stands for horizontal looking.
Phi: Describes the left / right tilting of the camera. In my case it is fixed to horizontally.

So it would appear that the Omega value is the pitch, however in the sample Pix4D sample, "orientation", and "cameraOrientation" are very similar so that would mean the camera in this sample is looking straight ahead?

As I originally just set the tilt on the take off element, Ive made a quick fix which was to add a command line option --tilt which takes an integer. I have also defaulted it to 80 if the option isn't specified. Do you think this would suffice for our use case, or should we be using the "cameraOrientation" omega value?

Thanks

mickrideout

epysod12 commented 1 year ago

Hi mickrideout,

Sorry for the delay, the job absorbed me for several weeks...

Yes, I had seen this too, the "cameraOrientation" information. But I had difficulty integrating it into my Bash script, so I left it aside for now. For the flightplan converter, I think we can keep this for a future improvement.

Just now, I suggest setting the Tilt with the "cameraPitch" value from the Pix4D JSON, like here: Screenshot_20230726_230649 Just adding a "minus" sign to obtain the correct value for the FF6 flightplan. Here, the correct parameter for the savedPlan.json would be: {"type":"Tilt", "angle":-80, "speed":180}

Thanks to you, we can already adjust the Tilt angle at prompt. Can we still modify like this:

And finally, in core.clj, what do you think to complete your previous modification with this: "-n" "--title TITLE" "Title of the flightplan" "-n" "--name TITLE" "Title of the flightplan" (to avoid confusion when reading quickly the command line...)

Thank you for your patience ;)

epysod12

mickrideout commented 1 year ago

Hi epysod12,

Sorry for the long delay on this. I moved to Australia so I was swamped with life admin.

Based on your suggestions I have fixed the following:

The commit for this is: https://github.com/mickrideout/pix4d-flightplan-to-anafi/commit/1b0875cc44eae8cb69eaf2a5447c365aefb7ea49

I hope this helps

mickrideout

epysod12 commented 9 months ago

Hi mickrideout,

Thanks, it works as expected now, good job ! I can close this one.

epysod12