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.
Dependencies: mbed
Fork of circle_war_ver_A_NUCLEO_ by
Diff: step.h
- Revision:
- 12:2450012ce888
- Child:
- 14:3403ce49a37a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/step.h Mon Apr 04 09:25:57 2016 +0000 @@ -0,0 +1,123 @@ +// 各作業段階の動作を定義 + + + +void expand_gf(){ //1つ目の幹を取得し、持ち上げる + valve(1); + pid(TARGET1,count,gear1); + if(HMIN<=devi&&devi<=HMAX){ + arm=1; + if(!c0){ + bole_checker.attach(bole_check,0.2); + c0=1; + } + } +} + +void expand_ff(){ //2段に重ねて、持ち上げる + if(!c1){ + valve(0); + while(1){ + pid(TARGET2,count,gear1); + if(HMIN<=devi&&devi<=HMAX){ + valve(1); + break; + } + } + while(1){ + pid(TARGET1,count,gear1); + if(HMIN<=devi&&devi<=HMAX){ + bole_checker.attach(bole_check,0.2); + arm=2; + c1=1; + break; + } + } + }else{ + pid(TARGET1,count,gear1); + } +} + +void expand_sf(){ //3段に重ねて、持ち上げる + if(!c2){ + valve(0); + while(1){ + pid(TARGET2,count,gear1); + if(HMIN<=devi&&devi<=HMAX){ + valve(1); + break; + } + } + while(1){ + pid(TARGET3,count,gear1); + if(HMIN<=devi&&devi<=HMAX){ + arm=3; + c2=1; + break; + } + } + }else{ + pid(TARGET3,count,gear1); + } +} + +void set_bole(){ //雑木林・花見場に幹を置く + if(!c3){ //雑木林 + while(1){ + pid(TARGET1,count,gear1); + if(devi<=PUT){ + valve(0); + break; + } + } + wait(1); + valve(1); + while(1){ + pid(TARGET3,count,gear1); + if(HMIN<=devi&&devi<=HMAX){ + arm=4; + c3=1; + break; + } + } + }else{ //花見場 + pid(TARGET2,count,gear1); + if(devi<=PUT){ + valve(0); + } + } +} + + +void blossom(){ //桜を掴み、持ち上げる + sw_check.attach(&state_check,0.2); + while(1){ + catch1_f=CLOSE; + catch1_b=0; + catch2_f=0; + catch2_b=CLOSE; + + if(sw_state){ //タッチセンサにより検知 + catch1_f=0; + catch1_b=0; + catch2_f=0; + catch2_b=0; + sw_check.detach(); + break; + } + } + + while(1){ + pid(TARGET4,count2,gear2,1); + if(HMIN<=devi&&devi<=HMAX){ + arm=5; + } +/* if(){ //花見場 + bloss1_f=0; + bloss1_b=OPEN; + bloss1_f=OPEN; + bloss1_b=0; + } +*/ + } +}