mickrideout / pix4d-flightplan-to-anafi

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

ANAFI won't start if TILT Camera setting below Takeoff #4

Closed epysod12 closed 7 months ago

epysod12 commented 1 year ago

Hi mickrideout,

In FreeFlight 6, as said in the title, Anafi just hovers if Tilt is placed below Takeoff. This issue is documented here, with visuals: ParrotPilots: Bug Tilt Camera / Takeoff

I reproduce here the 2 screenshots sent by Rodrigo del Pedregal: WON'T_WORK: won't_work

WILL_WORK: will_work

But in fact, there's also a problem for our converter: With my #first issue, I realize that the flightplan needs a Home Reference (in other word, a waypoint) to initialize the camera pitch, for this 2 reasons: camera pitch can't be placed directly below Takeoff: mission won't start... camera pitch can't be placed on the first waypoint: camera don't have time to be correctly oriented...

We can summarize as follows: NO_HOME - BAD: NO_HOME_BAD

NO_HOME - (relatively)GOOD: NO_HOME_GOOD

WITH_HOME - BAD: WITH_HOME_BAD

WITH_HOME - (really)GOOD: WITH_HOME_GOOD

Currently, --homeLatitude and --homeLongitude are optional, I would like to know your point of view on whether it should be made compulsory again in order to be able to insert the camera pitch correctly, as in the last image?

An alternative solution would be to double the first waypoint (over a period of 2 seconds, for example), the time for the camera to orient itself correctly, if no Home Reference are indicated.

And finally, an other request: after the mission (on the last slot), can we restore the camera to zero degree ("angle": 0) to avoid damaging the sensor while landing? (ok, we can make this manually, but sometimes we forget to do it...)

Thanks for your attention,

epysod12

mickrideout commented 1 year ago

Hi epysod12,

Thanks for discovering this problem. I've just pushed a bug fix now.

A summary of the change is:

  1. For home latitude / longitude, use the command line option values. If they are not set use the "homeCordinate" values in the Pix4D json.
  2. Removed the camera tilt action on the takeoff section of the flight plan.
  3. Added a start home waypoint set to home latitude / longitude. As there is no home altitude in the Pix4D json, I use the command line value (or its default of 100m). The camera tilt action is set on this waypoint to the "tilt" command line value (or its default of 80)
  4. Added a final home waypoint set to home latitude / longitude with a camera tilt action setting the angle to 0

Sorry I cannot test this myself due to my lack of working hardware. Let me know if this meets your needs.

Thanks

mickrideout

epysod12 commented 1 year ago

Hi mickrideout,

Thanks for this fixes, here are my observations:

  1. Good approach, I agree ;)
  2. Converter Takeoff and flightplan works now correctly with this fix! <- EDIT
  3. Default altitude at 100m is correct for me, with the possibility of choosing for particular cases. I'm talking about the Tilt option in the other topic...
  4. This point is a bit blocking because the JSON FF6 indicates surprising things when you just want an angular value to complete the flightplan. Here is what I notice:

Below is the JSON generated by the converter (not modified), the final angle at zero degree ("angle": 0) doesn't appear in FreeFlight 6: savedPlan_INI.txt

Now, with this change, we can see: start with -90° specify 90° at the last WP _ obtain 0° expected final Tilt savedPlan_T01.txt

And to compare, another JSON test file: start with -60° specify 38° at the last WP _ obtain 22° expected final Tilt savedPlan_T02.txt

I insist on the expected term, because it highlights that the intermediate value (the 38° in the second test) questions me a lot as to its origin...

If you have an idea of interpretation of this mystery, it would solve part of the problem ;) In the meantime, this modification can still be manual in the JSON FF6, not blocking, just strange...

Have a nice day!

epysod12

mickrideout commented 10 months ago

Hi epysod12,

For point 4, Im slightly confused. I think I made an assumption that the tilt action on waypoints are absolute angles, whereas they may be action commands to perform relative angle adjustments?

With your test file savedPlan_T02.txt, I can see the final two waypoints:

   {"follow":1,
    "continue":true,
    "speed":1,
    "yaw":0.0,
    "longitude":6.100155238088557,
    "lastYaw":0,
    "actions":
    [{"type":"ImageStopCapture"},
     {"type":"Tilt", "angle":38, "speed":180}],
    "latitude":49.74469250434431,
    "followPOI":false,
    "altitude":7},
   {"follow":1,
    "continue":true,
    "speed":1,
    "yaw":256,
    "longitude":6.100140461909822,
    "lastYaw":0,
    "actions":[{"type":"Tilt", "angle":22, "speed":180}],
    "latitude":49.74456489473456,
    "followPOI":false,
    "altitude":5}]},

Did you manually add {"type":"Tilt", "angle":38, "speed":180}] and "actions":[{"type":"Tilt", "angle":22, "speed":180}]?

Are we saying that tilt adjustments are relative to the current angle (as opposed to absolute)? So in the T02 test, as the initial angle was -60, adjusting the tilt to +38 resulted in a -22 camera angle? If this is the case, if we set the initial angle to -60, we would want to set 60 as the final angle to make the camera return to the zero position?

All the best

mickrideout

epysod12 commented 7 months ago

Hi mickrideout,

I didn't modify manually, it was FF6 which generated this part... I think so, for this part, tilt adjustments are relative to the current angle. But on this point, this can be set manually in the JSON file, no need to really insist in this thread. Have a nice day !

epysod12

epysod12 commented 2 months ago

Hi mickrideout,

I recently worked on a similar converter, from a QGroundControl .plan file. I can thus obtain a savedPlan.json file for FreeFlight6.

Here is the script: qgc-to-ff6 And (once again) a short article: Plan de vol et photogrammétrie avec ANAFI + QGC

Your project largely gave me the inspiration for my script, and I thank you for that ;) Have a nice day !

epysod12

mickrideout commented 2 months ago

Hi epysod12,

Good work and definitely a useful utility to have. I would use it myself if I hadnt killed my drone :) Interesting article you wrote too!