Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: Global.cpp
- Revision:
- 1:3f857674a290
- Parent:
- 0:2a15bd367891
- Child:
- 3:e3c41153e5fe
diff -r 2a15bd367891 -r 3f857674a290 Global.cpp --- a/Global.cpp Mon Sep 07 01:19:55 2015 +0000 +++ b/Global.cpp Mon Sep 07 21:56:25 2015 +0000 @@ -20,16 +20,12 @@ double Global::trimyaw; double Global::inttrimpitch; double Global::inttrimyaw; -std::vector<double> Global::_pitch; -std::vector<double> Global::_yaw; -std::vector<double> Global::_airspeed; -std::vector<double> Global::_cadence; -std::vector<double> Global::_altitude; -//double Global::_pitch; -//double Global::_yaw; +double Global::pitch; +double Global::yaw; +double Global::airspeed; +double Global::cadence; +double Global::altitude; -void Global::initialize(){ -} Timer Global::timer; DigitalIn Global::initializeswitch(p23,PullUp);//否定で押しているとき @@ -38,6 +34,7 @@ DigitalOut Global::led3(LED3); DigitalOut Global::led4(LED4); + //固定定数 int Global::getmaxpitch(){return maxpitch;} int Global::getminpitch(){return minpitch;} @@ -47,10 +44,6 @@ float Global::getminrudderangle(){return minrudderangle;} float Global::getmaxelevatorangle(){return maxelevatorangle;} float Global::getminelevatorangle(){return minelevatorangle;} -double Global::gettrimpitch(){return trimpitch;} -double Global::gettrimyaw(){return trimyaw;} -double Global::getinttrimpitch(){return inttrimpitch;} -double Global::getinttrimyaw(){return inttrimyaw;} //初期化される定数 void Global::setmaxpitchdegree(double _maxpitchdegree){maxpitchdegree=_maxpitchdegree;} void Global::setneutralpitchdegree(double _neutralpitchdegree){neutralpitchdegree=_neutralpitchdegree;} @@ -60,63 +53,26 @@ void Global::setminyawdegree(double _minyawdegree){minyawdegree=_minyawdegree;} void Global::setneutralrudderangle(double _neutralrudderangle){neutralrudderangle=_neutralrudderangle;} void Global::setneutralelevatorangle(double _neutralelevatorangle){neutralelevatorangle=_neutralelevatorangle;} -void Global::settrimpitch(double _trimpitch){trimpitch = _trimpitch;} -void Global::settrimyaw(double _trimyaw){trimyaw = _trimyaw;} -void Global::setinttrimpitch(double _inttrimpitch){inttrimpitch = _inttrimpitch;} -void Global::setinttrimyaw(double _inttrimyaw){inttrimyaw = _inttrimyaw;} + + + //変数 -void Global::setpitch(double pitch){ - if(_pitch.size()>100)_pitch.clear(); - _pitch.push_back(pitch); -} -void Global::setyaw(double yaw){ - if(_yaw.size()>100)_yaw.clear(); - _yaw.push_back(yaw); -} -void Global::setairspeed(double airspeed){ - if(_airspeed.size()>100)_airspeed.clear(); - _airspeed.push_back(airspeed); -} -void Global::setcadence(double cadence){ - if(_cadence.size()>100)_cadence.clear(); - _cadence.push_back(cadence); -} -void Global::setaltitude(double altitude){ - if(_altitude.size()>100)_altitude.clear(); - _altitude.push_back(altitude); -} -double Global::getpitch(){ -// writeonpc("pitch=%f\t",_pitch.back()); - return _pitch.back(); -} -double Global::getyaw(){ -// writeonpc("yaw=%f\r\n",_yaw.back()); - return _yaw.back(); -} -double Global::getairspeed(){ -// writeonpc("airspeed=%f\r\n",_airspeed.back()); - return _airspeed.back(); -} -double Global::getcadence(){ -// writeonpc("cadence=%f\r\n",_cadence.back()); - return _cadence.back(); -} -double Global::getaltitude(){ -// writeonpc("altitude=%f\r\n",_altitude.back()); - return _altitude.back(); -} +double Global::getpitch(){return pitch;} +double Global::gettrimpitch(){return trimpitch;} +double Global::getinttrimpitch(){return inttrimpitch;} +double Global::getyaw(){return yaw;} +double Global::gettrimyaw(){return trimyaw;} +double Global::getinttrimyaw(){return inttrimyaw;} +double Global::getairspeed(){return airspeed;} +double Global::getcadence(){return cadence;} +double Global::getaltitude(){return altitude;} -void Global::store(std::vector<double> &pitch, std::vector<double> &yaw, - std::vector<double> &airspeed, std::vector<double> &cadence, std::vector<double> &altitude){ - copy(_pitch.begin(), _pitch.end(), back_inserter(pitch)); - copy(_yaw.begin(), _yaw.end(), back_inserter(yaw)); - copy(_airspeed.begin(), _airspeed.end(), back_inserter(airspeed)); - copy(_cadence.begin(), _cadence.end(), back_inserter(cadence)); - copy(_altitude.begin(), _altitude.end(), back_inserter(altitude)); - - _pitch.clear(); - _yaw.clear(); - _airspeed.clear(); - _cadence.clear(); - _altitude.clear(); -} +void Global::setpitch(double _pitch){pitch = _pitch;} +void Global::settrimpitch(double _trimpitch){trimpitch = _trimpitch;} +void Global::setinttrimpitch(double _inttrimpitch){inttrimpitch = _inttrimpitch;} +void Global::setyaw(double _yaw){yaw = _yaw;} +void Global::settrimyaw(double _trimyaw){trimyaw = _trimyaw;} +void Global::setinttrimyaw(double _inttrimyaw){inttrimyaw = _inttrimyaw;} +void Global::setairspeed(double _airspeed){airspeed = _airspeed;} +void Global::setcadence(double _cadence){cadence = _cadence;} +void Global::setaltitude(double _altitude){altitude = _altitude;}