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: Control/ControllerManager.cpp
- Revision:
- 4:650af94bf062
- Parent:
- 3:e3c41153e5fe
- Child:
- 5:9a1ec02229dd
--- a/Control/ControllerManager.cpp Tue Sep 29 16:03:01 2015 +0000 +++ b/Control/ControllerManager.cpp Tue Sep 29 18:23:29 2015 +0000 @@ -4,8 +4,11 @@ #include "Joystick.h" #include "Trim.h" +/* + *このクラスでは、AnalogInで受け取った[0,1]の値をジョイスティックのニュートラル補正した上で + *(ニュートラルが0.5からずれているかもしれない)、サーボの角度に変換してglobalに値をセットする + */ -//係数変更でパイロットに合わせるたぶん使わん ControllerManager::ControllerManager(PinName b, PinName h, PinName v) : controller(b, h, v){ maxpitch = Global::getmaxpitch();// @@ -14,12 +17,12 @@ minyaw = Global::getminyaw();// - maxpitchdegree=1.0; - neutralpitchdegree=0.5; - minpitchdegree=0.0; - maxyawdegree=1.0; - neutralyawdegree=0.5; - minyawdegree=0.0; + maxpitchdegree=Global::getmaxpitchdegree(); + neutralpitchdegree=Global::getneutralpitchdegree(); + minpitchdegree=Global::getminpitchdegree(); + maxyawdegree=Global::getmaxyawdegree(); + neutralyawdegree=Global::getneutralyawdegree(); + minyawdegree=Global::getminyawdegree(); } @@ -36,7 +39,7 @@ - +/* void ControllerManager::initialize(){ if(!Global::initializeswitch){ @@ -150,11 +153,11 @@ } printf("endcontollerinitialize\r\n"); wait(1.0); -} +}*/ void ControllerManager::update(){ - Global::setpitch(getpitch() + Global::gettrimpitch()); - Global::setyaw(getyaw() + Global::gettrimyaw()); + Global::setpitch(getpitch()); + Global::setyaw(getyaw()); // printf("%f %f\n", getpitch(), getyaw()); } @@ -168,7 +171,7 @@ //設定した最大、最小値を超えない値を返す -static float clamp(float value, float min, float max) { +static float clamp(double value, double min, double max) { if(value < min) { return min; } else if(value > max) {