How to create a new flight mode to arduplane?

Hello guys,
I have one little situation with the arduplane software. We know how to create a new flight mode to arducopter, it is very simple to find some “how to” but I can’t find one method to do this to arduplane, could somebody help me?

I could be wrong… but I think the organization of ArduPlane makes it more difficult to add a mode than in Copter. Of course the difficulty depends on what you want the mode to do. Could you tell us the details of what you hope the mode to do, so we can help determine how hard it might be, and how to go about it?

(Someone please respond and let everyone know if I’m wrong!)

@magicrub might be able to give some tips.
Plane is a bit more monolithic than copter, although I believe there’s somewhat of a refactoring planned.

So, I and my teacher are developing a flight mode to stabilize an aircraft in extreme conditions, we did a code using fuzzy logic in matlab and we can simulate it in Xplane using sitl, but we want to translate this code to C ++ and we want to put it on the Arduplane to use in a pixhawk.

Nice!
The gitter.im/ArduPilot/Research channel might be worth visiting.
I’d suggest looking at how this branch implemented testing of an adaptive controller via a switch: https://github.com/rbeall/ardupilot/tree/plane-adaptive-control3
@tridge is pretty busy for the next couple of weeks, but ping him on the research gitter channel

What you are trying to do will be difficult. But if you are dedicated to learning how ArduPlane works, it may be possible. You could follow the example @james_pattison linked above.

Another option is to investigate a “Companion Computer.” Search the documentation. This is how folks in my lab have implemented custom controllers during flight.