I have implemented the simple mode for the bad pilots like me


The main goal is:
1. Remember the YAW angle/orientation when you turn on the engines.
2.Then when you rotating the copter for yaw, it will know where is the "new" head and tail. It means that if the head of the copter looks at North when you turn on the engines, your "new" head will always look at Nord in spite of rotating by YAW.
It uses the rotation of the sticks(ROLL, PITCH) vector based on remembered YAW orientation...
E.g. when you rotate copter for 180 degree, its Head become a Tail and its Tail become a Head. Or if you rotate the copter for +90, its Head become a Right side and its Left side become a Head.
In two word you always know the Head direction or direction at all. And it can be used to save your copter when you loose the control, e.g. don't know the current direction or haven't an enough experience to control when the tail doesn't not look to you

Russian version: http://forum.rcdesign.ru/f123/thread221 ... ost2970794
----------UPDATED--------------------------------------------------------------------------------------------------------------------------
HOW TO:
- At first you need to have a magnetometer and accelerometer on the board
- It works independent from existent modes. I.e. you can use it not only with Level but also with Acro mode (but I have not tested in acro).
- Before flight try it in hands. Rotate for diff angles and make sure that front always the same.
- The head/front will be remembered when you turn on the engines. So it means that you can turn on/off the "simple/head free" mode during the flight...
To add this mode, pls. open your MultiWii_[N].pde
1. Add new static global vars in the begin of file:
Code: Select all
static uint8_t simpleMode = 0; // if simple mode is a activated
static int16_t simpleModeHold;
2. search for
Code: Select all
rcCommand[THROTTLE] = MINTHROTTLE + (int32_t)(MAXTHROTTLE-MINTHROTTLE)* (rcData[THROTTLE]-MINCHECK)/(2000-MINCHECK);
and insert after this the following:
Code: Select all
if(simpleMode) {
float radDiff = (heading - simpleModeHold) * 0.0174533f; // where PI/180 ~= 0.0174533
float cosDiff = cos(radDiff);
float sinDiff = sin(radDiff);
int16_t rcCommand_PITCH = rcCommand[PITCH]*cosDiff + rcCommand[ROLL]*sinDiff;
rcCommand[ROLL] = rcCommand[ROLL]*cosDiff - rcCommand[PITCH]*sinDiff;
rcCommand[PITCH] = rcCommand_PITCH;
}
3. search for (two places)
Code: Select all
armed = 1;
and replace it with the following (in two places):
Code: Select all
{
armed = 1;
simpleModeHold = heading;
}
4. search for
Code: Select all
if (rcOptions & activate[BOXMAG]) {
if (magMode == 0) {
magMode = 1;
magHold = heading;
}
} else magMode = 0;
and insert after this the following:
Code: Select all
if (rcOptions & activate[BOXGPSHOME]) {
if (simpleMode == 0) {
simpleMode = 1;
}
} else simpleMode = 0;
So it can be activated with GPSHOME box in UI. Hope you are not using the GPS for now

thx-
Alex