I’m an aerospace engineering student working on a flying wing uav project using a pixracer with PX4 as our flight control system. I had a question about how can I set up Auto_RTL for Fixed Wing so that when Auto_RTL is triggered (e.g. by lost comms or by low battery) the airplane will fly to the last waypoint (the one at the start of the landing approach), turn onto the pre-programmed landing glide slope and approach vector, and then land at the pre-programmed landing point?
When we tried to test this by sending HOME and RTL commands via the RC transmitter it does not behave this way. Landing safely at the pre-programmed landing point and approach vector in the event of loss comms or low battery is a requirement for our project.
This would be great!
I think the way you’d want to do this is with MAV_CMD_DO_LAND_START. (http://mavlink.org/messages/common)
MAV_CMD_DO_LAND_START can be in the mission plan (marking the start of a landing sequence) and sent as a command that jumps the mission to that point. The missing piece is tying that functionality to RTL.
This is the RTL code in navigator - https://github.com/PX4/Firmware/blob/master/src/modules/navigator/rtl.cpp#L153
and this is where the command MAV_CMD_DO_LAND_START is handeled https://github.com/PX4/Firmware/blob/master/src/modules/navigator/navigator_main.cpp#L495
Please feel free to ping me (@dagar on discuss, github, gitter, etc) if you have any questions.
Thanks for replying!
I see that in QGC 3.1 there is a “Land Start” waypoint. Is This the way to set MAV_CMD_DO_LAND_START in a mission plan? I do plan on looking into the firmware a bit more to see if this is doable in other versions of QGC as well.
Yes, that’s how you mark the start of a landing sequence, although just inserting it won’t do anything different.
The missing piece on the QGC side is sending sending MAV_CMD_DO_LAND_START as a COMMAND_LONG (http://mavlink.org/messages/common#COMMAND_LONG) it activates auto mission at MAV_CMD_DO_LAND_START.
Note: the current land button in QGC actually sends the command to switch to LAND mode which is currently completely separate from landing a preplanned mission. That’s something we could think about changing.
Navigator handles VEHICLE_CMD_DO_LAND_START here - https://github.com/PX4/Firmware/blob/master/src/modules/navigator/navigator_main.cpp#L513
If it finds a MAV_CMD_DO_LAND_START then it internally sends a VEHICLE_CMD_MISSION_START which tells commander to switch to AUTO_MISSION -https://github.com/PX4/Firmware/blob/master/src/modules/navigator/navigator_main.cpp#L518
Great post. I am also interested in this behavior getting added to PX4 for use in a professional fixed-wing mapping UAV we are developing. I am new to PX4, but am trying to learn. Is there a way to make a formal request that this be considered by the PX4 core dev team?
The current PX4 RTL behavior seems good for VTOL aircraft, but fixed wing aircraft need a different scheme. After some research, I think a Fixed-Wing RTL solution might look something along these lines:
Any time RTL is triggered the aircraft should do the MAV_CMD_DO_LAND_START thing described above. This could be pressing the [RTL] button in Qgc. Or it could be autopilot auto RTL from low battery (BAT_CRIT_THR?), Loss of Comms (NAV_DLL_CH_T expires without regaining comms?), and maybe in Loss of RC (NAV_RCL_LT expires?).
Other parameters associated with “Return to Land” should still work, although at the MAV_CMD_DO_LAND_START location instead of the “HOME” location. (e.g. RTL_RETURN_ALT, RTL_DESCEND_ALT, RTL_LAND_DELAY, RTL_MIN_DIST).
Does Qgc currently place both the Comms Hold Waypoint and the Airfield Home Waypoint at the “HOME” point in Qgc? Assuming NAV_DLL_CH_T occurs while loitering above the “Home” point, when it expires without regaining communications the fixed-wing aircraft should go to RTL as described above.
I suppose folks with hybrid aircraft (e.g. quad planes, etc) might want the ability to choose between VTOL or Fixed-Wing RTL types. Maybe “RTL type” could be selected as a parameter?
If Fixed-Wing RTL type is selected there should be a mission validity check that requires a valid landing waypoint and valid MAV_CMD_DO_LAND_START point before accepting the upload (this could happen in PX4 and/or Qgc).
Sorry for the long post. I’m sure I’m missing some important points. Any thoughts from the dev team are appreciated.
Thanks for the detail @Tcol. Some of this could be implemented fairly easily, some is more involved. The bottleneck for new development like this is often testing. Both testing the new desired behaviour works as expected and that you didn’t break any existing features.
You can request features by creating issues on github - https://github.com/PX4/Firmware/issues
If you can help work through the details and flight test we could find time to start working on this soon.
My account handle is called Antiheavy. I think I will change to Antiheavy here on discuss.px4.io for consistency.
And here I am again. Will try to use this handle @Antiheavy .
I am very interested in helping work through the details. I can offer flight testing as we try to get out every few days if we can.
Again, my fixed wing RTL feature request was posted as an issue on github here: https://github.com/PX4/Firmware/issues/6315
great news everyone! Proper fixed wing RTL is now in PX4 master!