Enabling the figure of eight mode

Hey,

I have seen that the developers team have written codes for tracking figure of eight. I wanted to include this feature in my flight stack. I wanted to understand how do I enable this, if not enable, what are the considerations that I have to take into while writing the algo on my own.

Thanks

Anybody from dev team?
please help!

So I am still on it, and if anybody here knows it please help!
Thanks

Have you checked the source code? And the pull requests adding support for it: Pull requests · PX4/PX4-Autopilot · GitHub

Yeah I actually did check the code and the pull requests as well.
The VEHICLE_CMD_DO_FIGUREEIGHT mavlink command is not there to command from QGC so I am not sure how do I trigger.
I somehow changed the if conditions and got the functions to run but apparently she starts sinking and aligns at 189 degree heading

also they have closed this issue on qgc because there is no MAV_CMD_DO_FIGURE_EIGHT command. So the only way to get it right is by using Auterion AMC?

Nowhere defined in common.xml (only in development.xml)

Presumably, yes. Worth asking Auterion.

1 Like

Figure eight works.

Just enable the compile flag CONFIG_FIGURE_OF_EIGHTin your defconfig and then add MAV_CMD_DO_FIGURE_EIGHT to either a fly view action in qgc or just change the existing loiter button to send that and it works fine.

@hamishwillee worth putting this anywhere or not really since it will get there soon enough?

1 Like

Thanks @JulianOes @ryanjAA . I’m a little furious this went into the flight stack without docs. I’ve added Fixed Wing Loiter Modes - Orbit and Figure 8 by hamishwillee · Pull Request #26194 · PX4/PX4-Autopilot · GitHub and reopened Need Support Figure of eight (8 figure) loitering by QGC · Issue #12778 · mavlink/qgroundcontrol · GitHub

@fly_check This works via MAVLink directly too (tested). Note though that you ONLY get an ACK from the command on Fixed wing and it isn’t clear what values in the command are respected. I am checking.

1 Like

Thanks @hamishwillee and @ryanjAA , I am trying it out as well. Have noted your inputs.
I had already enabled the CONFIG_FIGURE_OF_EIGHT in the defconfig.

I have never really worked on QGC side, is it maybe possible could you please let me know where to append the command?

Also even if i make changes on QGC, I will need to make changes in common.xml file as well right on PX4 side?
Thank you!

See the issue on the topic here Need Support Figure of eight (8 figure) loitering by QGC · Issue #12778 · mavlink/qgroundcontrol · GitHub

Basically you’re adding a command like the “Orbit at Location” item shown at that link when you click the map. As to how to do it, the easiest way is to see how QGC implements that Orbit command and copy the behaviour.

Also even if i make changes on QGC, I will need to make changes in common.xml file as well right on PX4 side?

No, you don’t have to make any changes to PX4 on simulator (at all). You would need to do a custom build to enable it on hardware - that is all covered in the PR I linked - [this one](https://github.com/PX4/PX4-Autopilot/pull/26194)

1 Like

If you need a faster solution, consider using a Custom Mavlink Action. Its super easy to implement.
Example json:
{
“version”: 1,
“fileType”: “CustomActions”,
“actions”: [
{
“label”: “Figure 8”,
“description”: “PX4 MAV_CMD_DO_FIGURE_EIGHT”,
“mavCmd”: 35,
“param1”: 80,
“param2”: 30,
“param3”: 0,
“param4”: 1.0,
“param5”: 47.398175,
“param6”: 8.5444,
“param7”: 200
}
]
}
Save to the correct spot, enable the setting in QGC, set the path to your file and that did the trick for me. Then you get a Button under Actions that you can directly use.

I gave the exact settings and when i initiated the action the aircraft starts to sink and flies at a constant heading

Let me explain what that action currently does:
The Mavlink Command is in that version set to a specific lat/lon/alt. So its expected to fly there first, before starting the 8. (Location near the default sitl takeoff point.
I do not have capacity currently to figure out how to set it to the current position, probably something like zero or NaN.