kubtss / Mbed 2 deprecated BIRD2017

Dependencies:   mbed-rtos mbed

Committer:
shimogamo
Date:
Tue Sep 29 16:03:01 2015 +0000
Revision:
3:e3c41153e5fe
Parent:
1:3f857674a290
Child:
4:650af94bf062
servo??????

Who changed what in which revision?

UserRevisionLine numberNew contents of line
shimogamo 0:2a15bd367891 1 #include "mbed.h"
shimogamo 0:2a15bd367891 2 #include "Global.h"
shimogamo 3:e3c41153e5fe 3
shimogamo 3:e3c41153e5fe 4 //トリムはGlobalで足したほうがいいかも
shimogamo 3:e3c41153e5fe 5
shimogamo 3:e3c41153e5fe 6
shimogamo 3:e3c41153e5fe 7 //----------------普段は変動しない変数(定数)------------------------------------------------------
shimogamo 3:e3c41153e5fe 8 //この値を尾翼の可動角にするとデバッグがしやすくなる
shimogamo 3:e3c41153e5fe 9 int Global::maxpitch = 10;
shimogamo 3:e3c41153e5fe 10 int Global::minpitch = -10;
shimogamo 3:e3c41153e5fe 11 int Global::maxyaw = 10;
shimogamo 3:e3c41153e5fe 12 int Global::minyaw = -10;
shimogamo 3:e3c41153e5fe 13 //サーボの可動角調整
shimogamo 3:e3c41153e5fe 14 float Global::maxrudderangle = 30.0;
shimogamo 0:2a15bd367891 15 float Global::minrudderangle = -maxrudderangle;//別の値を入れたら非対称にしたりもできる
shimogamo 3:e3c41153e5fe 16 float Global::maxelevatorangle = 5.0;
shimogamo 0:2a15bd367891 17 float Global::minelevatorangle = -maxelevatorangle;//別の値を入れたら非対称にしたりもできる
shimogamo 3:e3c41153e5fe 18 double Global::neutralrudderangle;
shimogamo 3:e3c41153e5fe 19 double Global::neutralelevatorangle;
shimogamo 3:e3c41153e5fe 20 //ジョイスティックのパラメータ
shimogamo 0:2a15bd367891 21 double Global::neutralpitchdegree;
shimogamo 0:2a15bd367891 22 double Global::neutralyawdegree;
shimogamo 0:2a15bd367891 23 double Global::maxpitchdegree;
shimogamo 0:2a15bd367891 24 double Global::minpitchdegree;
shimogamo 0:2a15bd367891 25 double Global::maxyawdegree;
shimogamo 0:2a15bd367891 26 double Global::minyawdegree;
shimogamo 3:e3c41153e5fe 27
shimogamo 3:e3c41153e5fe 28 //----------------周期的に変動する変数------------------------------------------------------
shimogamo 0:2a15bd367891 29 double Global::trimpitch;
shimogamo 0:2a15bd367891 30 double Global::trimyaw;
shimogamo 0:2a15bd367891 31 double Global::inttrimpitch;
shimogamo 0:2a15bd367891 32 double Global::inttrimyaw;
shimogamo 1:3f857674a290 33 double Global::pitch;
shimogamo 1:3f857674a290 34 double Global::yaw;
shimogamo 1:3f857674a290 35 double Global::airspeed;
shimogamo 1:3f857674a290 36 double Global::cadence;
shimogamo 1:3f857674a290 37 double Global::altitude;
shimogamo 0:2a15bd367891 38
shimogamo 0:2a15bd367891 39
shimogamo 0:2a15bd367891 40 Timer Global::timer;
shimogamo 0:2a15bd367891 41 DigitalIn Global::initializeswitch(p23,PullUp);//否定で押しているとき
shimogamo 0:2a15bd367891 42 DigitalOut Global::led1(LED1);
shimogamo 0:2a15bd367891 43 DigitalOut Global::led2(LED2);
shimogamo 0:2a15bd367891 44 DigitalOut Global::led3(LED3);
shimogamo 0:2a15bd367891 45 DigitalOut Global::led4(LED4);
shimogamo 0:2a15bd367891 46
shimogamo 1:3f857674a290 47
shimogamo 0:2a15bd367891 48 //固定定数
shimogamo 0:2a15bd367891 49 int Global::getmaxpitch(){return maxpitch;}
shimogamo 0:2a15bd367891 50 int Global::getminpitch(){return minpitch;}
shimogamo 0:2a15bd367891 51 int Global::getmaxyaw(){return maxyaw;}
shimogamo 0:2a15bd367891 52 int Global::getminyaw(){return minyaw;}
shimogamo 0:2a15bd367891 53 float Global::getmaxrudderangle(){return maxrudderangle;}
shimogamo 0:2a15bd367891 54 float Global::getminrudderangle(){return minrudderangle;}
shimogamo 0:2a15bd367891 55 float Global::getmaxelevatorangle(){return maxelevatorangle;}
shimogamo 0:2a15bd367891 56 float Global::getminelevatorangle(){return minelevatorangle;}
shimogamo 0:2a15bd367891 57 //初期化される定数
shimogamo 0:2a15bd367891 58 void Global::setmaxpitchdegree(double _maxpitchdegree){maxpitchdegree=_maxpitchdegree;}
shimogamo 0:2a15bd367891 59 void Global::setneutralpitchdegree(double _neutralpitchdegree){neutralpitchdegree=_neutralpitchdegree;}
shimogamo 0:2a15bd367891 60 void Global::setminpitchdegree(double _minpitchdegree){minpitchdegree=_minpitchdegree;}
shimogamo 0:2a15bd367891 61 void Global::setmaxyawdegree(double _maxyawdegree){maxyawdegree=_maxyawdegree;}
shimogamo 0:2a15bd367891 62 void Global::setneutralyawdegree(double _neutralyawdegree){neutralyawdegree=_neutralyawdegree;}
shimogamo 0:2a15bd367891 63 void Global::setminyawdegree(double _minyawdegree){minyawdegree=_minyawdegree;}
shimogamo 0:2a15bd367891 64 void Global::setneutralrudderangle(double _neutralrudderangle){neutralrudderangle=_neutralrudderangle;}
shimogamo 0:2a15bd367891 65 void Global::setneutralelevatorangle(double _neutralelevatorangle){neutralelevatorangle=_neutralelevatorangle;}
shimogamo 1:3f857674a290 66
shimogamo 1:3f857674a290 67
shimogamo 1:3f857674a290 68
shimogamo 0:2a15bd367891 69 //変数
shimogamo 1:3f857674a290 70 double Global::getpitch(){return pitch;}
shimogamo 1:3f857674a290 71 double Global::gettrimpitch(){return trimpitch;}
shimogamo 1:3f857674a290 72 double Global::getinttrimpitch(){return inttrimpitch;}
shimogamo 1:3f857674a290 73 double Global::getyaw(){return yaw;}
shimogamo 1:3f857674a290 74 double Global::gettrimyaw(){return trimyaw;}
shimogamo 1:3f857674a290 75 double Global::getinttrimyaw(){return inttrimyaw;}
shimogamo 1:3f857674a290 76 double Global::getairspeed(){return airspeed;}
shimogamo 1:3f857674a290 77 double Global::getcadence(){return cadence;}
shimogamo 1:3f857674a290 78 double Global::getaltitude(){return altitude;}
shimogamo 0:2a15bd367891 79
shimogamo 1:3f857674a290 80 void Global::setpitch(double _pitch){pitch = _pitch;}
shimogamo 1:3f857674a290 81 void Global::settrimpitch(double _trimpitch){trimpitch = _trimpitch;}
shimogamo 1:3f857674a290 82 void Global::setinttrimpitch(double _inttrimpitch){inttrimpitch = _inttrimpitch;}
shimogamo 1:3f857674a290 83 void Global::setyaw(double _yaw){yaw = _yaw;}
shimogamo 1:3f857674a290 84 void Global::settrimyaw(double _trimyaw){trimyaw = _trimyaw;}
shimogamo 1:3f857674a290 85 void Global::setinttrimyaw(double _inttrimyaw){inttrimyaw = _inttrimyaw;}
shimogamo 1:3f857674a290 86 void Global::setairspeed(double _airspeed){airspeed = _airspeed;}
shimogamo 1:3f857674a290 87 void Global::setcadence(double _cadence){cadence = _cadence;}
shimogamo 1:3f857674a290 88 void Global::setaltitude(double _altitude){altitude = _altitude;}