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.
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
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?
@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.
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.
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)
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.
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.