Revision 0:458d6472bd2d, committed 2019-04-11
- Comitter:
- JamB
- Date:
- Thu Apr 11 22:17:16 2019 +0000
- Commit message:
- project;
Changed in this revision
PidCombine.cpp | Show annotated file Show diff for this revision Revisions of this file |
PidCombine.h | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PidCombine.cpp Thu Apr 11 22:17:16 2019 +0000 @@ -0,0 +1,39 @@ +#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; + +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PidCombine.h Thu Apr 11 22:17:16 2019 +0000 @@ -0,0 +1,6 @@ +#include "mbed.h" + +void pidcombine(float rolls, float pitchs); + +float left_servo(); +float right_servo(); \ No newline at end of file