Bteam tactics plan A _ move table ver
Dependencies: HCSR04 PID QEI mbed
Fork of UNKO_FINAL by
Revision 12:1a22b9797004, committed 2018-10-10
- Comitter:
- yuron
- Date:
- Wed Oct 10 12:33:40 2018 +0000
- Parent:
- 11:5a0d6f69e751
- Child:
- 13:93321c73df60
- Commit message:
- ???????????????3
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Oct 10 11:27:09 2018 +0000 +++ b/main.cpp Wed Oct 10 12:33:40 2018 +0000 @@ -1510,46 +1510,23 @@ if(distance >= firing_minimum_distamce && distance <= firing_maximum_distance && distance != 0) { //ライントレースの停止 trace_flag = 0; - //タイマスタート timer.start(); - /* - if(timer.read() < 1.0f) { - cylinder_data[0] = 0x80; - i2c.write(0x40, cylinder_data, 1); - } else { - line_state_pettern = stop; - cylinder_data[0] = 0x0F; - i2c.write(0x40, cylinder_data, 1); - mouted_bottles++; - } - - */ //発射距離に到達して1秒待って発射 if(timer.read() > 1.0f && timer.read() <= 2.5f) { cylinder_data[0] = 5; i2c.write(0x40, cylinder_data, 1); mouted_bottles++; } - /* - if(timer.read() > 1.0f && timer.read() <= 9.0f) { - cylinder_data[0] = 4; - i2c.write(0x40, cylinder_data, 1); - //2段下段撃ったよ- - //high_grade_fire_flag = 1; - mouted_bottles++; - } - */ else if(timer.read() > 12.5f && timer.read() <= 15.0f) { cylinder_data[0] = 0x80; i2c.write(0x40, cylinder_data, 1); - //line_state_pettern = right_super_slow; } else if(timer.read() > 15.0f && timer.read() <= 15.5f) { line_state_pettern = right_slow; } - else if(timer.read() > 15.5f && timer.read() <= 18.0f) { + else if(timer.read() > 15.5f && timer.read() <= 17.5f) { line_state_pettern = stop; cylinder_data[0] = 5; i2c.write(0x40, cylinder_data, 1); @@ -1572,12 +1549,12 @@ else if(timer.read() > 33.0f && timer.read() <= 43.0f) { line_state_pettern = stop; } - else if(timer.read() > 43.0f && timer.read() <= 43.5f) { + else if(timer.read() > 43.0f && timer.read() <= 45.0f) { line_state_pettern = back_trace; //ライントレースの復帰 - trace_flag = 1; + //trace_flag = 1; //トレース方向の反転 - trace_direction = 1; + //trace_direction = 1; cylinder_data[0] = 0x80; i2c.write(0x40, cylinder_data, 1); } @@ -1590,17 +1567,6 @@ cylinder_data[0] = 0x80; i2c.write(0x40, cylinder_data, 1); - - /* - //発射して0.5秒たったら後進開始 - else if(timer.read() > 15.0f) { - //トレース方向の反転 - trace_direction = 1; - - line_state_pettern = back_trace; - cylinder_data[0] = 0x80; - i2c.write(0x40, cylinder_data, 1); - */ } else { line_state_pettern = stop; cylinder_data[0] = 0x80; @@ -1761,6 +1727,8 @@ } //リミットがONの時(1回目) if(lateral_frag == 1) { + //ライントレース有効果 + trace_flag = 1; //ローラー回転移動中 table_fire = low_table; firing_minimum_distamce = low_table_minimum_distance; @@ -1789,11 +1757,35 @@ } //リミットがONの時(2回目) else if(lateral_frag == 3) { + + //ローラー回転停止 + table_fire = 0; + + //スタートゾーンに近づいたら減速 + if(abs(measure_pulse) < 1200) { + if(side == blue) { + line_state_pettern = left_super_slow; + } + else if(side == red) { + line_state_pettern = right_super_slow; + } + } + else if(abs(measure_pulse) < 500) { + line_state_pettern = stop; + } else { + if(side == blue) { + line_state_pettern = left_fast; + } + else if(side == red) { + line_state_pettern = right_fast; + } + } + /* //ローラー回転移動中 table_fire = medium_table; firing_minimum_distamce = medium_table_minimum_distance; firing_maximum_distance = medium_table_maximum_distance; - + trace_direction = 0; back_timer2.start(); if(back_timer2.read() <= 0.8f && back_timer2.read() != 0.0f) { @@ -1807,8 +1799,9 @@ else if(back_timer2.read() > 0.8f) { back_timer2.reset(); lateral_frag = 4; - } + }*/ } + /* else if(lateral_frag == 4) { if(limit.read() == 0) { //上でback_timer3を使用しているためここでリセットをかける @@ -1867,7 +1860,7 @@ line_state_pettern = right_fast; } } - } + }*/ } //テーブルごとに目標値を変えてローラー回転