JasonK is pretty much on the money with his first comment. In the controlMixer() function (scroll down toward the bottom of the code, or ctrl+f to search for it), you have all of the freedom to make what we call "mixing assignments"
This means that we basically tell the sX_command_scaled and mX_command_scaled variables how they should move in response to which axis. Here are all of the variables of interest you might want to "assign" to one of the motor or servo outputs in the control mixer:
View attachment 191540
When we say "assign" all we mean is to say that the mX_command_scaled or sX_command_scaled variable is equal to any combination of these above things. For example, if we want motor 1 to have throttle control and stabilized roll control, we would make sure to include this line of code in the control mixer:
m1_command_scaled = thro_des + roll_PID; //+ or - minus depending on the direction the motor is stabilizing (this is a comment, btw, which does not affect the code)
If we want servo 1 to be centered and have unstabilized pitch and roll control (for standard elevons) we would include this line:
s1_command_scaled = 0.5 + roll_passthru + pitch_passthru;
The "amount" can be changed, simply by multiplying by a factor:
s1_command_scaled = 0.5 + 0.5*roll_passthru + pitch_passthru; //roll now has 1/2 the amount of throw as it did before
Servo not centered? Change the 0.5 to something else that centers it:
s1_command_scaled = 0.62 + 0.5*roll_passthru + pitch_passthru;
Want stabilized roll but unstabilized pitch?
s1_command_scaled = 0.62 + 0.5*roll_PID + pitch_passthru;
The code handles everything else in terms of declaring and writing out to the microcontroller pins. Assuming you did the default hardware setup, use this figure for hooking up servos/motors to the correct pins:
View attachment 191541
All of this is covered in more detail starting at tutorial 9.7 in the docs. Again--the ONLY thing you have to do now that the radio and IMU is properly setup is change 3-4 lines in the controlMixer() function. I'll have a video coming out soon where I walk through the code in more detail...it might be quite a bit more than you need to understand the basics, but might help break everything down and make it less daunting
Jasonk -- the purpose of this project is to eliminate the complexities of coding to bring it to a level that anyone can understand. Hence no arrays/data structures, classes, etc. Just variables that can be accessed freely whenever/wherever in the code. Is this the 'best' solution? Efficiency wise, absolutely not. There's plenty of things I would do differently too to optimize the code for performance. But the point is to give anyone the ability to change 5-6 lines of code in the control mixer for a highly custom aircraft configuration. Once we get the rc project up and running with a fixed dynamic configuration, we can then implement a simple 'if' statement and he can flip between flight modes. Once that is understood, we can start learning about how to fade between those flight modes. IMO, all of the other flight controllers are way too restrictive for custom projects in that you are forced into their GUI/architecture with absolutely no control over the code.
Also--teensy + IMU is about 12 grams once broken out like in the above pic, so not the lightest of the lightest but good enough for most everything