Hello Everyone,
I've recently had the chance to get some basic acrobatic moves scripted for fixed-wing airplanes. They are far from perfect, but I wanted to share.
In the (slightly choppy) video, you'll see a left roll, a right roll and most of a loop.
Let's talk a bit about how to set this up:
1) You need a Hardware In Loop (HIL) setup. I use X-plane. There's a good tutorial on setting up a X-plane HIL configuration here.
2) All of your regular controls and modes should work properly in the simulator.
3) You need a python based script. You can start with the one I've put together. It's attached here. "simple_script.txt"
4) With X-plane, the APM Mission Planner (MP) and the script open, get your plane in the air and press "p" for pause. "a" will put you in chase view ("w" to go back in the plane) and "-" and "=" will zoom your view of the plane in and out.
5) In the MP click on the "Flight Data" button, then select the "Actions" tab underneath the Heads-Up-Display.
6) Click on the "Script" button. This will bring up another window with a preloaded script (for arducopter). Switch to the already open "simple_script.txt" and select-all then copy.
7) Go to the python script window and paste "simple_script.txt" in the python script window. DO NOT close it yet.
8) Go to X-plane, and press "p" again to un-pause the plane.
9) Go back to your python script window and close it. This will trigger the execution of the script when you click "yes" in the pop-up.
10) Watch your plane do some rolls, and most of a loop.
Let's also talk a bit about issues and my thoughts for the future.
1) I do not seem to get RC control back after the script has run. I'm not sure what's going on here.
2) (IANAP) I am not a programmer, but I feel like we should be able to create python classes (objects?) that take pertinent arguments. For the roll class it could include (direction, rate, duration) and the class would handle the slight down elevator when inverted, etc...
3) It also seems like we could effectively have another PID type of structure in the scripts that would give us smooth loops. I'd like to see us just pass two arguments to a loop class, size of loop, and what direction. 0 is perpendicular to the ground up, 90 would be a flat loop parallel to the ground going to the right, 270 to the left.
4) Is there a way to temporarily make stabilize a negative value? This would seem to give us solid inverted flight.
5) Eventually I envision an "Acrobatic Move Repository" where we can keep moves for different vehicles. At some point, I see a set of macros that you can just string together an entire acrobatic show.
I'm looking forward to your comments, and seeing what others come up with! Thanks!
John C.
Comments
Hi John, nice!
For some reason It´s triggering my rudder and aileron outputs as well in stabilized mode. In Manual It´s fine. Have tried looking for any mixed params but no luck. Any Ideas ? Thanks.
+Karol - What do exactly mean by "send RC override message with value 0" ?
TIA
Big on PX4 I am sure
Hi, I have done some experiments with this on my project. About 1. point try to send RC override message with value 0, this should bring you back to control, but this is still problem when you want interrupt scripted manoeuvre, or when telemetry failed.
This is the start of something big ;-)