Arduplane autonomous aerobatics

And of course we needed to do that a bit lower :slight_smile:

The blip at the end we understand, and will be fixed as the navigation improvesā€¦

2 Likes

Environment, Edit Airport, In the properties info you will find 'Panoramic Image Facing (deg).

Ah, thatā€™s where I had seen it before. Iā€™m trying to rotate the runway in a 3D airport to match the heading of the one at my field, but canā€™t find a way to do that.

I did my first autotune on the AcroMaster today and tested my OpenTX setup for separate manual mode trims and expo (donā€™t want to bail to manual with 100% throw and no expo on this plane!). But no aerobatic scripts since my FC now refuses to boot with master or the new PR.

Workaround: force IOMCU reflash by booting with safety button pressed

Thanks @tridge - here is a single roll rolling circle with the new altitude + speed controller, as well as defined number of rolls (here one) + roll and circle direction :slight_smile:

2 Likes

oh goody goody GOODY!
looking promising.
just out of curiosity, what will happen on a loop that has the throttle setting too low causing the plane to stall on the way up?

Currently there are no sanity checks, performance checks or how is the maneuver progressing type checks. Manual mode is your friend in this situation. But of course it is early days with this developmentā€¦ Stall recognition and recover are all possible I guess - and would be useful well outside the aerobatic scope :slight_smile:

1 Like

roger on all that, andy. i was just wondering what would happen in the current mode.

Currently, if the model is stable and ā€˜mushesā€™, it will hold full up elevator trying to achieve a demanded pitch rate until the script times out - then will (may) hopefully recover to continue the mission. If the model stalls and happens to then hit a positive deck angle (unlikely), it may think the loop is finished, and continue on the mission. But more than likely things are going to end badly unless you change to manual modeā€¦ Once the plane stalls, there is no recovery except manual modeā€¦

The possibility to control flight maneuvers via LUA Script fascinates me among other things because of the various possibilities. Thanks to @tridge , @andyp and the others who helped make this brilliant idea a reality.
After the yaw rate controller for the ACRO mode was implemented and Tridge presented the Lua script, it was also time for me to dare with a real airplane.
The aircraft used is a Durafly Avios Grand Tundra, as it is both good-natured and sufficiently (knife-edge) aerobatic. The STOL characteristics are impressive by the way.


With the YAW Rate Controller alone, barrel rolls became real rolls in Acro Mode. The FC installed so far was a Pixhawk 1 (2MB), unfortunately does not have enough RAM to run the script. Therefore I installed a Matek F765 (V1) last week, which has power in abundance. Before the test flight I had only run the autotune (for all 3 axes). Out of curiosity, I didnā€™t feel like carefully setting the TECS parameters. To be safe, I set the waypoints to 110 meters altitude and only parameterized a 360Ā° roll. What can I say, it works ! For sure I will still adjust the TECS parameters and throttle parameters and get closer to the settingst. Thanks to the developers.

Rolf

5 Likes

Hi Rolf
Thatā€™s awesome! We are working on a better aerobatic implementationā€¦ it will take some time, but exciting things to come!
Andrew

In the meantime I have extended the demonstration flight and condensed it a bit:
https://vimeo.com/726520355
(For the rolling circle, note that the input parameters arg1/2 mean the rotation rate at which the circle is flown through (arg1) and the roll rate (arg2), respectively, and not the circle radius or number of rolls.)

1 Like

Slightly off topic, so Iā€™ll keep this to a single post, but lest us Rover guys get left outā€¦

I looked at the scripted aerobatics code for a loop, modified it for lateral nav, and put this quick little test together. For ease of triggering in SITL, I just poll for a switch to LOITER mode and then it does a counterclockwise circle before switching back to the previous mode. I could just as easily implement with NAV_SCRIPT_TIME but wanted an easy way to trigger on demand.

I think this guided mode capability can be leveraged for things like custom obstacle avoidance or complex path planning where straight line nav falls short. Thanks to all here who helped pioneer the bindings and examples!

local RUN_INTERVAL_MS   =  100
local ROVER_MODE_GUIDED =   15
local ROVER_MODE_LOITER =    5

local circle_angle = 0
local circle_angle_increment = 1    -- increment the target angle by 1 deg every 0.1 sec (i.e. 10deg/sec)
local circle_speed = 1              -- velocity is always 1m/s
local last_mode = vehicle:get_mode()

function do_circle()
    local mode = vehicle:get_mode()

    if mode == ROVER_MODE_LOITER then
        circle_angle = 0
        vehicle:set_mode(ROVER_MODE_GUIDED)
    end

    if mode ~= ROVER_MODE_GUIDED then
        if mode ~= ROVER_MODE_LOITER then
            last_mode = mode
        end
        return do_circle, RUN_INTERVAL_MS
    end

    -- calculate velocity vector
    circle_angle = circle_angle + circle_angle_increment
    if (circle_angle >= 360) then
        vehicle:set_mode(last_mode)
        return do_circle, RUN_INTERVAL_MS
    end
    local target_vel = Vector3f()
    target_vel:x(math.sin(math.rad(circle_angle)) * circle_speed)
    target_vel:y(math.cos(math.rad(circle_angle)) * circle_speed)
    target_vel:z(0)

    -- send velocity request
    if not (vehicle:set_target_velocity_NED(target_vel)) then
        gcs:send_text(0, "failed to execute velocity command")
    end
    return do_circle, RUN_INTERVAL_MS
end

return do_circle()
6 Likes

weā€™ve made a lot more progress, and can now put entire aerobatic schedules on a switch or in a mission
demo here:

some docs here:
https://github.com/ArduPilot/ardupilot/tree/master/libraries/AP_Scripting/examples/Aerobatics/Trajectory

2 Likes

I flew the same schedule on a Flex Innovations Yak55 today:

Overall it did well, but didnā€™t maintain height in the rolling circle


iā€™m going to see if I can improve knifeedge height hold to get the rolling circle right

7 Likes

Incredible and absolutely ingenious.
A thousand thanks to Tridge and all those involved. Even the non-trajectory version seemed to be a miracle of technology for some of my pilot friends at the airfield. One of them suspected during the rolling circle, when I held the transmitter aside, that he had become a Candid Camera victim and the actual pilot was hidden behind a bush.

Now I want to exchange the old aerobatic script in my tundra against this new one. The parameters of most maneuvers are clear to me. I want to take the radii from the logfiles of the previous flights.

But two understanding questions I have before planning a mission:

What is the difference between maneuver 15 = Immelman Turn and 6 = Immelmann (FastRoll) . I guess the roll at no.15 is flown slower ?

No.19, Stall turn. I suppose it is the maneuver also called Hammerhead Turn. ā€œRadiusā€ and ā€œHeightā€ make sense as to what it means. But what does the parameter 3 " direction" mean in this context.

Does an airspeed sensor make sense or not ?

Rolf

Hi Rolf

The trajectory stuff really is amazing!!

#15 - the exit roll rate is based on the manouver radius - the bigger the radius, the slower the roll rate - so scales for different aircraft. #6 always does a fast roll regardless of set radiusā€¦

The stall turn is experimental - we are still working on how to achieve a stall turn, snap roll and spin. Also still working on a barrel roll. I would suggest not using the stall turn at the moment. This stuff is ā€˜bleeding edgeā€™ :slight_smile:

Test in SITL and enjoy! More pre-made schedules to come!
Andrew (with huge thanks to Tridge, Matthew Hampsey, Paul Riseborough and Henry Wurzburg)

1 Like

Thatā€™s an interesting idea. I have been thinking about the crossover with Object Avoidance too. Not sure what to do with it thought. Would it mean having to move OA into Lua out off c++? Interesting idea perhaps but also a lot of work ā€¦
Alternatively - might there be some way for OA (in c++) to trigger Lua script navigation?

It doesnā€™t mean OA has to move strictly to Lua. A script could work in conjunction with existing OA.

I already have a prototype script that neatly circumvents geofences, which avoids some of the less desirable effects of the existing path planning algorithms (specifically, existing BR and Dijkstra end up skipping more of the preplanned path than is desirable when mowing with a Rover).

Iā€™m not comfortable releasing that script to the masses just yet, as it takes very direct control that could result in bad behavior, and Iā€™d like to mitigate the associated risk(s) a bit better before submitting it as an example or for use at large.

Which plotter is this for planned vs actual trajectory? Looks quite handy.