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.
HbManager.h@67:ad35921e3cdc, 2019-03-11 (annotated)
- Committer:
- YutakaTakagi
- Date:
- Mon Mar 11 06:36:33 2019 +0000
- Revision:
- 67:ad35921e3cdc
- Parent:
- 59:6b4dcd964d0f
- Child:
- 68:1d5471344acf
add reset att value function. if set PID ON, reset att value
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
takeru0x1103 | 16:05b9e44889f1 | 1 | #ifndef __HBMANAGER_H__ |
takeru0x1103 | 16:05b9e44889f1 | 2 | #define __HBMANAGER_H__ |
takeru0x1103 | 0:ecd925601fc6 | 3 | ///////////////////////////////////////////////////////////////////// |
takeru0x1103 | 17:f9610f3cfa1b | 4 | #include "typedef.h" |
takeru0x1103 | 17:f9610f3cfa1b | 5 | #include "HbEngine.h" |
takeru0x1103 | 18:5aa48aec9cae | 6 | #include "HbAttitude.h" |
takeru0x1103 | 18:5aa48aec9cae | 7 | #include "HbMotor.h" |
takeru0x1103 | 18:5aa48aec9cae | 8 | #include "Imu.h" |
MasashiNomura | 22:24c9c2dedca9 | 9 | #include "HbUserOpe.h" |
takeru0x1103 | 17:f9610f3cfa1b | 10 | |
takeru0x1103 | 0:ecd925601fc6 | 11 | |
takeru0x1103 | 19:4b0fe9a5ec38 | 12 | |
takeru0x1103 | 19:4b0fe9a5ec38 | 13 | |
takeru0x1103 | 17:f9610f3cfa1b | 14 | ///////////////////////////////////////////////// |
takeru0x1103 | 17:f9610f3cfa1b | 15 | class HbManager{ |
takeru0x1103 | 17:f9610f3cfa1b | 16 | private: |
MasashiNomura | 53:b09c062cc31c | 17 | INT16 en_srv_step[2]; //!< エンジンスロットルを変化させる際のステップ値 |
MasashiNomura | 53:b09c062cc31c | 18 | INT16 en_srv_adj_step[2]; //!< エンジンを浮上中にドライバーが調整する際のステップ値 |
MasashiNomura | 50:76413e8e073d | 19 | INT16 motorOfsVal[4] ;//!< 姿勢制御用のオフセット |
MasashiNomura | 56:f363a6877c6a | 20 | INT16 mot_brk; //!< MotorブレーキのRPM値 |
takeru0x1103 | 18:5aa48aec9cae | 21 | UINT16 accelVal[2] ;// |
YutakaTakagi | 67:ad35921e3cdc | 22 | float ang_rate_brk; //!< ブレーキボタンON時の目標角度[deg]変化率 |
MasashiNomura | 36:2cc739c7e4cb | 23 | float nowTrgtAng; //目標ヨー角 |
takeru0x1103 | 19:4b0fe9a5ec38 | 24 | float nowAngle ;//現在ヨー角 |
takeru0x1103 | 19:4b0fe9a5ec38 | 25 | float nowRate ;//現在加速度 |
MasashiNomura | 22:24c9c2dedca9 | 26 | typUserSw usrSW ;//ユーザー操作SW |
takeru0x1103 | 19:4b0fe9a5ec38 | 27 | //メンバクラス |
takeru0x1103 | 18:5aa48aec9cae | 28 | HbEngine *eng[2] ;//エンジン制御クラス |
takeru0x1103 | 18:5aa48aec9cae | 29 | HbAttitude *att ;//姿勢制御クラス |
MasashiNomura | 28:fdb3b144e342 | 30 | //HbMotor *mot[4] ;//モーター制御クラス |
MasashiNomura | 28:fdb3b144e342 | 31 | HbSubProp *subProp[4] ;//モーター制御クラス |
takeru0x1103 | 18:5aa48aec9cae | 32 | Imu *imu ;//慣性計測装置 |
MasashiNomura | 22:24c9c2dedca9 | 33 | |
MasashiNomura | 22:24c9c2dedca9 | 34 | HbUserOpe *ope ;//ユーザー操作 |
MasashiNomura | 22:24c9c2dedca9 | 35 | |
MasashiNomura | 24:c5945aaae777 | 36 | //INT16 motVal; // モーターチェック用モーター値 |
MasashiNomura | 24:c5945aaae777 | 37 | //short motNum; // モーターチェック用モーター番号 |
MasashiNomura | 24:c5945aaae777 | 38 | |
takeru0x1103 | 17:f9610f3cfa1b | 39 | public: |
takeru0x1103 | 17:f9610f3cfa1b | 40 | HbManager(); |
MasashiNomura | 39:1b76f7df8804 | 41 | // TestSPIRead Task生存証明用アクセスProof of survival |
MasashiNomura | 39:1b76f7df8804 | 42 | UINT16 proofOfSurvival(); |
MasashiNomura | 38:24ee50452755 | 43 | // Attitude |
takeru0x1103 | 18:5aa48aec9cae | 44 | void getAttitude(); |
MasashiNomura | 25:f3a6e7eec9c3 | 45 | void calAtt(); |
takeru0x1103 | 18:5aa48aec9cae | 46 | void controlAttitude(); |
MasashiNomura | 24:c5945aaae777 | 47 | void controlAttitude(float cmdAngle); |
MasashiNomura | 24:c5945aaae777 | 48 | void setAttPara(typPidPara para); |
MasashiNomura | 38:24ee50452755 | 49 | // Motor |
takeru0x1103 | 18:5aa48aec9cae | 50 | void controlMotor(); |
MasashiNomura | 29:eb3d72dd94aa | 51 | void addMotVal(eMotPos pos, INT16 add); |
MasashiNomura | 29:eb3d72dd94aa | 52 | void subMotVal(eMotPos pos, INT16 add); |
MasashiNomura | 30:13ada1a24c59 | 53 | INT16 getCurMotVal(eMotPos pos); |
MasashiNomura | 30:13ada1a24c59 | 54 | void setMotVal(eMotPos pos, INT16 val); |
MasashiNomura | 46:5074781a28dd | 55 | void setMotValOfs(eMotPos pos, INT16 val); |
MasashiNomura | 56:f363a6877c6a | 56 | void setMotValAtt(eMotPos pos, INT16 val); |
MasashiNomura | 40:debe99e228d3 | 57 | void setFpgaMot(eMotPos pos,eMotType type, INT16 val); |
MasashiNomura | 36:2cc739c7e4cb | 58 | //void setMotFPGA(UCHAR num, INT16 val); |
MasashiNomura | 27:ff63c23bc689 | 59 | |
MasashiNomura | 38:24ee50452755 | 60 | // Engine |
MasashiNomura | 39:1b76f7df8804 | 61 | void getEngine(); |
takeru0x1103 | 17:f9610f3cfa1b | 62 | void controlEngine(); |
MasashiNomura | 46:5074781a28dd | 63 | void controlEngine(enmHbState stat); |
MasashiNomura | 46:5074781a28dd | 64 | |
MasashiNomura | 36:2cc739c7e4cb | 65 | void clearHvAxl(); |
MasashiNomura | 36:2cc739c7e4cb | 66 | bool chkSetHvAxl(eEgPos pos); |
MasashiNomura | 36:2cc739c7e4cb | 67 | void setHvAxl(eEgPos pos, INT16 val); |
MasashiNomura | 38:24ee50452755 | 68 | INT16 getHvAxl(eEgPos pos); |
MasashiNomura | 36:2cc739c7e4cb | 69 | void setAccelVal(eEgPos pos, INT16 val); |
MasashiNomura | 39:1b76f7df8804 | 70 | INT16 getAccelVal(eEgPos pos); |
MasashiNomura | 36:2cc739c7e4cb | 71 | |
takeru0x1103 | 17:f9610f3cfa1b | 72 | void getUserCommand(); |
MasashiNomura | 33:eb260dbfc22a | 73 | INT16 getUserMotAxl(); |
MasashiNomura | 36:2cc739c7e4cb | 74 | INT16 getUserEngTrottle(); |
MasashiNomura | 38:24ee50452755 | 75 | float getUserMotAxlRaw(); |
MasashiNomura | 38:24ee50452755 | 76 | float getUserEngTrottleRaw(); |
MasashiNomura | 33:eb260dbfc22a | 77 | |
MasashiNomura | 23:79e20be4bc5b | 78 | bool chkOverIDLE(); |
MasashiNomura | 23:79e20be4bc5b | 79 | bool chkInRangeIDLE(); |
MasashiNomura | 31:56c554c560c1 | 80 | void chkSW(enmHbState stat); |
MasashiNomura | 23:79e20be4bc5b | 81 | bool chkSWUserOpe(HbUserOpe::SW_TYPE stype); |
MasashiNomura | 30:13ada1a24c59 | 82 | bool chkSWUserOpeRE(HbUserOpe::SW_TYPE stype);//立ち上がり検出 |
MasashiNomura | 23:79e20be4bc5b | 83 | bool chkSWUserOpeAny(); |
MasashiNomura | 36:2cc739c7e4cb | 84 | bool chkSWUserOpeBoth(HbUserOpe::SW_TYPE stype1, HbUserOpe::SW_TYPE stype2); |
MasashiNomura | 36:2cc739c7e4cb | 85 | |
MasashiNomura | 23:79e20be4bc5b | 86 | typUserSw getUserSw(); |
takeru0x1103 | 17:f9610f3cfa1b | 87 | }; |
takeru0x1103 | 0:ecd925601fc6 | 88 | |
takeru0x1103 | 0:ecd925601fc6 | 89 | ///////////////////////////////////////////////////////////////////// |
takeru0x1103 | 16:05b9e44889f1 | 90 | #endif |