Custom Flight Mode for Timed Elevator Inputs

I’m working on a research project where I need to have the elevator perform a set of timed elevator deflections in order to find the aircraft’s coefficient of moment. The maneuver is a “2-1-1-2”, which means the elevator is moved its extreme positive angle for two seconds, then down for one, up for one, and down for two.

The most I’ve found on this has been the servo command in the advanced tab on qgroundcontrol, but I haven’t seen anything on changing the deflection after a period of time. I’m sure its possible given its connection to GPS_Time, but I don’t know of a way to do it. Is this possible, and if so, where should I start looking?

Hi Deafro,

I don’t think this is currently supported but it should be fairly easy to implement in master, at least in a quick fix way. What you could do is to overwrite the stick inputs in sensors.cpp and use the hrt_absolute_time() function for the time calculations.

The problem with overwriting the stick inputs is that the 2-1-1-2 maneuver needs to be executed during normal flight. My idea was to make a separate autopilot channel to handle the elevator deflections. That way when the pilot gets the plane into position, they can switch to that channel, and have the autopilot execute the maneuver. Then with the maneuver finished, they switch to manual again and fly as normal.

I’m afraid it don’t really understand yet. So you want the pilot to fly in let’s say altitude control mode, and then when the custom flight mode is engaged the autopilot is still running the attitude controller on roll but not on pitch, since you want to do max deflections on the elevator?

I’m thinking to have a custom flight mode made to specifically to perform this elevator deflection. The idea is to get the plane into the proper position manually. Once its in position, the flight mode is engaged, causing the elevator to perform the needed deflections. The pilot switches to manual and retakes control after the maneuver is executed.

So the only difference between what I proposed and what you want is that you want it to be displayed as a flight mode in the ground station and not just be activated on a switch?
I mean the autopilot would still be performing all the flap deflections, steps, ramps, chirps or whatever. You would fly the plane manually to the correct position and when you flick the switch your pitch stick would be overwritten with the maneuver, e.g. 2-1-1-2 and then the pilot has the control again.
Or am I still misunderstanding you?

That’s exactly what I’m saying. I think I misunderstood what your were first suggesting. You said I would override the stick inputs, but wouldn’t that just cause the elevator to just loop the maneuver? I don’t understand how you could make a toggle switch using the base code.

I would read a switch (e.g. that bounces back like a button) when you press it start overwriting the pitch stick with what you want and stop overwriting when the maneuver is finished or when you press it again to abort.

This is now a pr if you are still interested

This is perfect! Thank you so much for letting me know about this. I’ll be trying it out soon.