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: userTask.cpp
- Revision:
- 29:eb3d72dd94aa
- Parent:
- 28:fdb3b144e342
- Child:
- 30:13ada1a24c59
--- a/userTask.cpp Sat Dec 15 14:20:04 2018 +0000
+++ b/userTask.cpp Mon Dec 17 13:25:00 2018 +0000
@@ -98,16 +98,24 @@
}
}
if(gf_StopMot){
- setStateF(MOT_STOP);
- hb.getCurMotVal();
+ //setStateF(MOT_STOP);
+ //hb.getCurMotVal();
+ for(int i = 0; i < 4; ++i){
+ gf_MtReq[i].bf.req = true;
+ gf_MtReq[i].bf.val = 0;
+ gf_MtReqOfs[i].bf.req = true;
+ gf_MtReqOfs[i].bf.val = 0;
+ }
gf_StopMot = false;
}
+
//▼①状態読み出し系
hb.getAttitude(); //現在角度読み出し
hb.controlEngine(); //エンジン回転数読み出し
hb.getUserCommand(); //操作ボタン状態読み出し
+
//▼②ステート遷移
switch(gf_State){
case SLEEP:
@@ -168,26 +176,34 @@
// hb.calAtt();
// setState(TAKE_OFF);
//}
+ //if(hb.chkSWUserOpeRE(HbUserOpe::F_L)){
if(hb.chkSWUserOpe(HbUserOpe::F_L)){
// Front Left
- hb.addMotOfs(HbUserOpe::F_L);
+ //hb.addMotOfs(HbUserOpe::F_L);
+ gf_MtReqOP[0].req=true; gf_MtReqOP[0].add_end=false; gf_MtReqOP[0].counter = 0; gf_MtReqOP[0].num = 20;
+ gf_MtReqOP[0].addVal = 0;
}
+ //if(hb.chkSWUserOpeRE(HbUserOpe::F_R)){
if(hb.chkSWUserOpe(HbUserOpe::F_R)){
// Front Right
- hb.addMotOfs(HbUserOpe::F_R);
+ //hb.addMotOfs(HbUserOpe::F_R);
+ gf_MtReqOP[1].req=true; gf_MtReqOP[1].add_end=false; gf_MtReqOP[1].counter = 0; gf_MtReqOP[1].num = 20;
+ gf_MtReqOP[1].addVal = 0;
}
if(hb.chkSWUserOpe(HbUserOpe::R_L)){
// Rear Left
- hb.addMotOfs(HbUserOpe::R_L);
+ //hb.addMotOfs(HbUserOpe::R_L);
}
if(hb.chkSWUserOpe(HbUserOpe::R_R)){
// Rear Right
- hb.addMotOfs(HbUserOpe::R_R);
+ //hb.addMotOfs(HbUserOpe::R_R);
}
if(hb.chkSWUserOpeRE(HbUserOpe::EMG_STOP)){
// EMG STOP だが、テスト用のため、モーターのオフセットを0にして回転を止める
//sp.printf("RisingEdge!\r\n");
for(int i = 0; i < 4; ++i){
+ gf_MtReq[i].bf.req = true;
+ gf_MtReq[i].bf.val = 0;
gf_MtReqOfs[i].bf.req = true;
gf_MtReqOfs[i].bf.val = 0;
}