PidCombine.cpp

Committer:
JamB
Date:
2019-04-11
Revision:
0:458d6472bd2d

File content as of revision 0:458d6472bd2d:

#include "mbed.h"
#include "PidCombine.h"

void pidcombine(float rolls, float pitchs)
{
    float roll = (rolls/2);
    float pitch = (pitchs-15);
    float top = roll+15;
    float bot = 15-roll;
    float centre = 15;
    
    while (pitch != 0)
    {
        if (pitch > 0)
        {
            if (top<48)
            {
                centre = centre+1;
                pitch = pitch-1;
                top=top+1;
            }else{
                pitch=0;
            }
        }else{
            if (bot>-18)
            {
                centre=centre-1;
                pitch=pitch+1;
                bot=bot-1;
            }else{
                pitch=0;
            }
        }
    }
        
    float diff=roll*2;
    centre=centre;

}