ジャパンオープン用のメインプログラム
Dependencies: mbed AQM1602 HMC6352 PID
main_processing/strategy/LineProcess.cpp@28:f246a5fbf6a5, 2016-03-22 (annotated)
- Committer:
- lilac0112_1
- Date:
- Tue Mar 22 03:58:38 2016 +0000
- Revision:
- 28:f246a5fbf6a5
- Parent:
- 27:825c6835e3db
- Child:
- 29:e8bafe48aa90
LineSeries2 has been released
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lilac0112_1 | 25:a7460e23e02e | 1 | #include "mbed.h" |
lilac0112_1 | 25:a7460e23e02e | 2 | #include "extern.h" |
lilac0112_1 | 25:a7460e23e02e | 3 | |
lilac0112_1 | 25:a7460e23e02e | 4 | void LineJudgeSlow(double pow_x, double pow_y, double *x, double *y){ |
lilac0112_1 | 25:a7460e23e02e | 5 | uint8_t LineState; |
lilac0112_1 | 25:a7460e23e02e | 6 | uint8_t LineSum; |
lilac0112_1 | 25:a7460e23e02e | 7 | |
lilac0112_1 | 25:a7460e23e02e | 8 | //line |
lilac0112_1 | 25:a7460e23e02e | 9 | LineState = 0; |
lilac0112_1 | 25:a7460e23e02e | 10 | |
lilac0112_1 | 25:a7460e23e02e | 11 | LineSum = ((data.lnHold>>2)&0x1)+((data.lnHold>>1)&0x1)+((data.lnHold>>0)&0x1); |
lilac0112_1 | 25:a7460e23e02e | 12 | if((LineSum==3)||(data.FieldSpot==LINE_OUTSIDE)){ |
lilac0112_1 | 25:a7460e23e02e | 13 | LineState = 3; |
lilac0112_1 | 25:a7460e23e02e | 14 | } |
lilac0112_1 | 25:a7460e23e02e | 15 | else if(LineSum==2){ |
lilac0112_1 | 25:a7460e23e02e | 16 | LineState = 2; |
lilac0112_1 | 25:a7460e23e02e | 17 | } |
lilac0112_1 | 25:a7460e23e02e | 18 | else if(LineSum==1){ |
lilac0112_1 | 25:a7460e23e02e | 19 | LineState = 1; |
lilac0112_1 | 25:a7460e23e02e | 20 | } |
lilac0112_1 | 25:a7460e23e02e | 21 | else if(LineSum==0){ |
lilac0112_1 | 25:a7460e23e02e | 22 | LineState = 0; |
lilac0112_1 | 25:a7460e23e02e | 23 | } |
lilac0112_1 | 25:a7460e23e02e | 24 | |
lilac0112_1 | 25:a7460e23e02e | 25 | |
lilac0112_1 | 25:a7460e23e02e | 26 | if(pow_x>=0){ |
lilac0112_1 | 25:a7460e23e02e | 27 | if(data.ping[R_PING]<WhiteToWall[X_PING]) (*x)=LineDecline[LineState]; |
lilac0112_1 | 25:a7460e23e02e | 28 | else *x=1; |
lilac0112_1 | 25:a7460e23e02e | 29 | } |
lilac0112_1 | 25:a7460e23e02e | 30 | else{ |
lilac0112_1 | 25:a7460e23e02e | 31 | if(data.ping[L_PING]<WhiteToWall[X_PING]) (*x)=LineDecline[LineState]; |
lilac0112_1 | 25:a7460e23e02e | 32 | else *x=1; |
lilac0112_1 | 25:a7460e23e02e | 33 | } |
lilac0112_1 | 25:a7460e23e02e | 34 | |
lilac0112_1 | 25:a7460e23e02e | 35 | if(pow_y>=0){ |
lilac0112_1 | 25:a7460e23e02e | 36 | if(data.ping[F_PING]<WhiteToWall[Y_PING]) (*y)=LineDecline[LineState]; |
lilac0112_1 | 25:a7460e23e02e | 37 | else *y=1; |
lilac0112_1 | 25:a7460e23e02e | 38 | } |
lilac0112_1 | 25:a7460e23e02e | 39 | else{ |
lilac0112_1 | 25:a7460e23e02e | 40 | if(data.ping[B_PING]<WhiteToWall[Y_PING]) (*y)=LineDecline[LineState]; |
lilac0112_1 | 25:a7460e23e02e | 41 | else *y=1; |
lilac0112_1 | 25:a7460e23e02e | 42 | } |
lilac0112_1 | 25:a7460e23e02e | 43 | } |
lilac0112_1 | 27:825c6835e3db | 44 | void LineJudgeSlow2(double pow_x, double pow_y, double *x, double *y, uint8_t *px, uint8_t *py){ |
lilac0112_1 | 27:825c6835e3db | 45 | uint8_t LineState; |
lilac0112_1 | 27:825c6835e3db | 46 | uint8_t LineSum; |
lilac0112_1 | 27:825c6835e3db | 47 | |
lilac0112_1 | 27:825c6835e3db | 48 | //line |
lilac0112_1 | 27:825c6835e3db | 49 | LineState = 0; |
lilac0112_1 | 27:825c6835e3db | 50 | |
lilac0112_1 | 27:825c6835e3db | 51 | LineSum = (data.lnRawOrder[0]!=LINE_EMPTY)+(data.lnRawOrder[1]!=LINE_EMPTY)+(data.lnRawOrder[2]!=LINE_EMPTY); |
lilac0112_1 | 27:825c6835e3db | 52 | if(LineSum==3){ |
lilac0112_1 | 27:825c6835e3db | 53 | LineState = 3; |
lilac0112_1 | 27:825c6835e3db | 54 | } |
lilac0112_1 | 27:825c6835e3db | 55 | else if(LineSum==2){ |
lilac0112_1 | 27:825c6835e3db | 56 | LineState = 2; |
lilac0112_1 | 27:825c6835e3db | 57 | } |
lilac0112_1 | 27:825c6835e3db | 58 | else if(LineSum==1){ |
lilac0112_1 | 27:825c6835e3db | 59 | LineState = 1; |
lilac0112_1 | 27:825c6835e3db | 60 | } |
lilac0112_1 | 27:825c6835e3db | 61 | else if(LineSum==0){ |
lilac0112_1 | 27:825c6835e3db | 62 | LineState = 0; |
lilac0112_1 | 27:825c6835e3db | 63 | } |
lilac0112_1 | 27:825c6835e3db | 64 | |
lilac0112_1 | 27:825c6835e3db | 65 | if(LineSum>0){ |
lilac0112_1 | 27:825c6835e3db | 66 | if(pow_x>=0){ |
lilac0112_1 | 27:825c6835e3db | 67 | if((data.ping[R_PING]<WhiteToWall[X_PING])&&((*px)>LineDecrease[LineState])) (*px)=LineDecrease[LineState]; |
lilac0112_1 | 27:825c6835e3db | 68 | } |
lilac0112_1 | 27:825c6835e3db | 69 | else{ |
lilac0112_1 | 27:825c6835e3db | 70 | if((data.ping[L_PING]<WhiteToWall[X_PING])&&((*px)>LineDecrease[LineState])) (*px)=LineDecrease[LineState]; |
lilac0112_1 | 27:825c6835e3db | 71 | } |
lilac0112_1 | 27:825c6835e3db | 72 | |
lilac0112_1 | 27:825c6835e3db | 73 | if(pow_y>=0){ |
lilac0112_1 | 27:825c6835e3db | 74 | if((data.ping[F_PING]<WhiteToWall[Y_PING])&&((*py)>LineDecrease[LineState])) (*py)=LineDecrease[LineState]; |
lilac0112_1 | 27:825c6835e3db | 75 | } |
lilac0112_1 | 27:825c6835e3db | 76 | else{ |
lilac0112_1 | 27:825c6835e3db | 77 | if((data.ping[B_PING]<WhiteToWall[Y_PING])&&((*py)>LineDecrease[LineState])) (*py)=LineDecrease[LineState]; |
lilac0112_1 | 27:825c6835e3db | 78 | } |
lilac0112_1 | 27:825c6835e3db | 79 | } |
lilac0112_1 | 27:825c6835e3db | 80 | else if(LineSum==0){ |
lilac0112_1 | 27:825c6835e3db | 81 | if(pow_x>=0){ |
lilac0112_1 | 27:825c6835e3db | 82 | if((data.ping[R_PING]<GoalEdgeToWall[X_PING])&&((*px)>LineDecrease[LineState])) (*px)=LineDecrease[LineState]; |
lilac0112_1 | 27:825c6835e3db | 83 | } |
lilac0112_1 | 27:825c6835e3db | 84 | else{ |
lilac0112_1 | 27:825c6835e3db | 85 | if((data.ping[L_PING]<GoalEdgeToWall[X_PING])&&((*px)>LineDecrease[LineState])) (*px)=LineDecrease[LineState]; |
lilac0112_1 | 27:825c6835e3db | 86 | } |
lilac0112_1 | 27:825c6835e3db | 87 | } |
lilac0112_1 | 27:825c6835e3db | 88 | |
lilac0112_1 | 27:825c6835e3db | 89 | *x=1; |
lilac0112_1 | 27:825c6835e3db | 90 | *y=1; |
lilac0112_1 | 27:825c6835e3db | 91 | } |
lilac0112_1 | 25:a7460e23e02e | 92 | void LineJudgeReturn(double pow_x, double pow_y, double *x, double *y){ |
lilac0112_1 | 25:a7460e23e02e | 93 | const int8_t static LineReturn[5] = {0, 0, 0, 0, 20}; |
lilac0112_1 | 25:a7460e23e02e | 94 | uint8_t LinePingState[4]; |
lilac0112_1 | 25:a7460e23e02e | 95 | //◎ボールを追う力とラインから離れる力の向きが違うならばラインから離れる力が優先される. |
lilac0112_1 | 25:a7460e23e02e | 96 | //◎ボールを追う力とラインから離れる力の向きが同じならばボールを追う力が優先される. |
lilac0112_1 | 25:a7460e23e02e | 97 | //◎ラインセンサ全てが場外になるまではボールを追う力は作用しない.ボールを追う力は場内に出るまで作用する. |
lilac0112_1 | 25:a7460e23e02e | 98 | //×ラインのほぼ場外では常時ラインから離れる力が優先される. |
lilac0112_1 | 25:a7460e23e02e | 99 | //※場外判定を行うには再び場内に戻る必要がある. |
lilac0112_1 | 25:a7460e23e02e | 100 | |
lilac0112_1 | 25:a7460e23e02e | 101 | if(data.FieldSpot==LINE_OUTSIDE){ |
lilac0112_1 | 25:a7460e23e02e | 102 | |
lilac0112_1 | 25:a7460e23e02e | 103 | LinePingState[L_PING]=(data.ping[L_PING]<WhiteToWall[X_PING]); |
lilac0112_1 | 25:a7460e23e02e | 104 | LinePingState[R_PING]=(data.ping[R_PING]<WhiteToWall[X_PING]); |
lilac0112_1 | 25:a7460e23e02e | 105 | LinePingState[F_PING]=(data.ping[F_PING]<WhiteToWall[Y_PING]); |
lilac0112_1 | 25:a7460e23e02e | 106 | LinePingState[B_PING]=(data.ping[B_PING]<WhiteToWall[Y_PING]); |
lilac0112_1 | 25:a7460e23e02e | 107 | |
lilac0112_1 | 25:a7460e23e02e | 108 | //line間際の復帰力以外の力を作用させるか否か |
lilac0112_1 | 25:a7460e23e02e | 109 | data.lnStop[X_LINE]=1; |
lilac0112_1 | 25:a7460e23e02e | 110 | data.lnStop[Y_LINE]=1; |
lilac0112_1 | 25:a7460e23e02e | 111 | |
lilac0112_1 | 25:a7460e23e02e | 112 | data.ReturnDir[X_LINE]=LINE_EMPTY; |
lilac0112_1 | 25:a7460e23e02e | 113 | data.ReturnDir[Y_LINE]=LINE_EMPTY; |
lilac0112_1 | 25:a7460e23e02e | 114 | |
lilac0112_1 | 25:a7460e23e02e | 115 | //x |
lilac0112_1 | 25:a7460e23e02e | 116 | if(data.ReturnDir[X_LINE]==L_LINE){ |
lilac0112_1 | 25:a7460e23e02e | 117 | if(pow_x<0){ |
lilac0112_1 | 25:a7460e23e02e | 118 | *x = 0; |
lilac0112_1 | 25:a7460e23e02e | 119 | data.lnStop[X_LINE]=1; |
lilac0112_1 | 25:a7460e23e02e | 120 | } |
lilac0112_1 | 25:a7460e23e02e | 121 | else{ |
lilac0112_1 | 25:a7460e23e02e | 122 | *x = -LineReturn[4]; |
lilac0112_1 | 25:a7460e23e02e | 123 | data.lnStop[X_LINE]=0; |
lilac0112_1 | 25:a7460e23e02e | 124 | } |
lilac0112_1 | 25:a7460e23e02e | 125 | } |
lilac0112_1 | 25:a7460e23e02e | 126 | else if(data.ReturnDir[X_LINE]==R_LINE){ |
lilac0112_1 | 25:a7460e23e02e | 127 | if(pow_x>0){ |
lilac0112_1 | 25:a7460e23e02e | 128 | *x = 0; |
lilac0112_1 | 25:a7460e23e02e | 129 | data.lnStop[X_LINE]=1; |
lilac0112_1 | 25:a7460e23e02e | 130 | } |
lilac0112_1 | 25:a7460e23e02e | 131 | else{ |
lilac0112_1 | 25:a7460e23e02e | 132 | *x = LineReturn[4]; |
lilac0112_1 | 25:a7460e23e02e | 133 | data.lnStop[X_LINE]=0; |
lilac0112_1 | 25:a7460e23e02e | 134 | } |
lilac0112_1 | 25:a7460e23e02e | 135 | } |
lilac0112_1 | 25:a7460e23e02e | 136 | else if(data.ReturnDir[X_LINE]==LINE_EMPTY){ |
lilac0112_1 | 25:a7460e23e02e | 137 | if((LinePingState[L_PING]==0)&&(LinePingState[R_PING]==0)){ |
lilac0112_1 | 25:a7460e23e02e | 138 | /*if(pow_x>0){ |
lilac0112_1 | 25:a7460e23e02e | 139 | *x = -pow_x*(1-0.75); |
lilac0112_1 | 25:a7460e23e02e | 140 | } |
lilac0112_1 | 25:a7460e23e02e | 141 | else{ |
lilac0112_1 | 25:a7460e23e02e | 142 | *x = pow_x*(1-0.75); |
lilac0112_1 | 25:a7460e23e02e | 143 | }*/ |
lilac0112_1 | 25:a7460e23e02e | 144 | data.lnStop[X_LINE]=1; |
lilac0112_1 | 25:a7460e23e02e | 145 | } |
lilac0112_1 | 25:a7460e23e02e | 146 | if((LinePingState[L_PING]==0)&&(LinePingState[R_PING]==1)){ |
lilac0112_1 | 25:a7460e23e02e | 147 | |
lilac0112_1 | 25:a7460e23e02e | 148 | data.ReturnDir[X_LINE]=L_LINE; |
lilac0112_1 | 25:a7460e23e02e | 149 | |
lilac0112_1 | 25:a7460e23e02e | 150 | /*if(pow_x<0){ |
lilac0112_1 | 25:a7460e23e02e | 151 | *x = 0; |
lilac0112_1 | 25:a7460e23e02e | 152 | data.lnStop[X_LINE]=1; |
lilac0112_1 | 25:a7460e23e02e | 153 | } |
lilac0112_1 | 25:a7460e23e02e | 154 | else{ |
lilac0112_1 | 25:a7460e23e02e | 155 | *x = -LineReturn[4]; |
lilac0112_1 | 25:a7460e23e02e | 156 | data.lnStop[X_LINE]=0; |
lilac0112_1 | 25:a7460e23e02e | 157 | }*/ |
lilac0112_1 | 25:a7460e23e02e | 158 | *x = -LineReturn[4]; |
lilac0112_1 | 25:a7460e23e02e | 159 | data.lnStop[X_LINE]=0; |
lilac0112_1 | 25:a7460e23e02e | 160 | } |
lilac0112_1 | 25:a7460e23e02e | 161 | if((LinePingState[L_PING]==1)&&(LinePingState[R_PING]==0)){ |
lilac0112_1 | 25:a7460e23e02e | 162 | |
lilac0112_1 | 25:a7460e23e02e | 163 | data.ReturnDir[X_LINE]=R_LINE; |
lilac0112_1 | 25:a7460e23e02e | 164 | |
lilac0112_1 | 25:a7460e23e02e | 165 | /*if(pow_x>0){ |
lilac0112_1 | 25:a7460e23e02e | 166 | *x = 0; |
lilac0112_1 | 25:a7460e23e02e | 167 | data.lnStop[X_LINE]=1; |
lilac0112_1 | 25:a7460e23e02e | 168 | } |
lilac0112_1 | 25:a7460e23e02e | 169 | else{ |
lilac0112_1 | 25:a7460e23e02e | 170 | *x = LineReturn[4]; |
lilac0112_1 | 25:a7460e23e02e | 171 | data.lnStop[X_LINE]=0; |
lilac0112_1 | 25:a7460e23e02e | 172 | }*/ |
lilac0112_1 | 25:a7460e23e02e | 173 | *x = LineReturn[4]; |
lilac0112_1 | 25:a7460e23e02e | 174 | data.lnStop[X_LINE]=0; |
lilac0112_1 | 25:a7460e23e02e | 175 | } |
lilac0112_1 | 25:a7460e23e02e | 176 | if((LinePingState[L_PING]==1)&&(LinePingState[R_PING]==1)){ |
lilac0112_1 | 25:a7460e23e02e | 177 | |
lilac0112_1 | 25:a7460e23e02e | 178 | if( |
lilac0112_1 | 25:a7460e23e02e | 179 | (data.lnOrder[0]==A_SPOT)&&(data.lnOrder[1]==C_SPOT)&&(data.lnOrder[2]==B_SPOT) |
lilac0112_1 | 25:a7460e23e02e | 180 | ){ |
lilac0112_1 | 25:a7460e23e02e | 181 | *x = -LineReturn[4]; |
lilac0112_1 | 25:a7460e23e02e | 182 | data.lnStop[X_LINE]=0; |
lilac0112_1 | 25:a7460e23e02e | 183 | } |
lilac0112_1 | 25:a7460e23e02e | 184 | else if( |
lilac0112_1 | 25:a7460e23e02e | 185 | (data.lnOrder[0]==B_SPOT)&&(data.lnOrder[1]==C_SPOT)&&(data.lnOrder[2]==A_SPOT) |
lilac0112_1 | 25:a7460e23e02e | 186 | ){ |
lilac0112_1 | 25:a7460e23e02e | 187 | *x = LineReturn[4]; |
lilac0112_1 | 25:a7460e23e02e | 188 | data.lnStop[X_LINE]=0; |
lilac0112_1 | 25:a7460e23e02e | 189 | } |
lilac0112_1 | 25:a7460e23e02e | 190 | else{ |
lilac0112_1 | 25:a7460e23e02e | 191 | *x = 0; |
lilac0112_1 | 25:a7460e23e02e | 192 | data.lnStop[X_LINE]=0; |
lilac0112_1 | 25:a7460e23e02e | 193 | } |
lilac0112_1 | 25:a7460e23e02e | 194 | } |
lilac0112_1 | 25:a7460e23e02e | 195 | } |
lilac0112_1 | 25:a7460e23e02e | 196 | //y |
lilac0112_1 | 25:a7460e23e02e | 197 | if(data.ReturnDir[Y_LINE]==F_LINE){ |
lilac0112_1 | 25:a7460e23e02e | 198 | if(pow_y>0){ |
lilac0112_1 | 25:a7460e23e02e | 199 | *y = 0; |
lilac0112_1 | 25:a7460e23e02e | 200 | data.lnStop[Y_LINE]=1; |
lilac0112_1 | 25:a7460e23e02e | 201 | } |
lilac0112_1 | 25:a7460e23e02e | 202 | else{ |
lilac0112_1 | 25:a7460e23e02e | 203 | *y = LineReturn[4]; |
lilac0112_1 | 25:a7460e23e02e | 204 | data.lnStop[Y_LINE]=0; |
lilac0112_1 | 25:a7460e23e02e | 205 | } |
lilac0112_1 | 25:a7460e23e02e | 206 | } |
lilac0112_1 | 25:a7460e23e02e | 207 | else if(data.ReturnDir[Y_LINE]==B_LINE){ |
lilac0112_1 | 25:a7460e23e02e | 208 | if(pow_y<0){ |
lilac0112_1 | 25:a7460e23e02e | 209 | *y = 0; |
lilac0112_1 | 25:a7460e23e02e | 210 | data.lnStop[Y_LINE]=1; |
lilac0112_1 | 25:a7460e23e02e | 211 | } |
lilac0112_1 | 25:a7460e23e02e | 212 | else{ |
lilac0112_1 | 25:a7460e23e02e | 213 | *y = -LineReturn[4]; |
lilac0112_1 | 25:a7460e23e02e | 214 | data.lnStop[Y_LINE]=0; |
lilac0112_1 | 25:a7460e23e02e | 215 | } |
lilac0112_1 | 25:a7460e23e02e | 216 | } |
lilac0112_1 | 25:a7460e23e02e | 217 | else if(data.ReturnDir[Y_LINE]==LINE_EMPTY){ |
lilac0112_1 | 25:a7460e23e02e | 218 | if((LinePingState[B_PING]==0)&&(LinePingState[F_PING]==0)){ |
lilac0112_1 | 25:a7460e23e02e | 219 | /*if(pow_y>0){ |
lilac0112_1 | 25:a7460e23e02e | 220 | *y = -pow_y*(1-0.75); |
lilac0112_1 | 25:a7460e23e02e | 221 | } |
lilac0112_1 | 25:a7460e23e02e | 222 | else{ |
lilac0112_1 | 25:a7460e23e02e | 223 | *y = pow_y*(1-0.75); |
lilac0112_1 | 25:a7460e23e02e | 224 | }*/ |
lilac0112_1 | 25:a7460e23e02e | 225 | data.lnStop[Y_LINE]=1; |
lilac0112_1 | 25:a7460e23e02e | 226 | } |
lilac0112_1 | 25:a7460e23e02e | 227 | if((LinePingState[B_PING]==0)&&(LinePingState[F_PING]==1)){ |
lilac0112_1 | 25:a7460e23e02e | 228 | |
lilac0112_1 | 25:a7460e23e02e | 229 | data.ReturnDir[Y_LINE]=B_LINE; |
lilac0112_1 | 25:a7460e23e02e | 230 | |
lilac0112_1 | 25:a7460e23e02e | 231 | if(pow_y<0){ |
lilac0112_1 | 25:a7460e23e02e | 232 | *y = 0; |
lilac0112_1 | 25:a7460e23e02e | 233 | data.lnStop[Y_LINE]=1; |
lilac0112_1 | 25:a7460e23e02e | 234 | } |
lilac0112_1 | 25:a7460e23e02e | 235 | else{ |
lilac0112_1 | 25:a7460e23e02e | 236 | *y = -LineReturn[4]; |
lilac0112_1 | 25:a7460e23e02e | 237 | data.lnStop[Y_LINE]=0; |
lilac0112_1 | 25:a7460e23e02e | 238 | } |
lilac0112_1 | 25:a7460e23e02e | 239 | } |
lilac0112_1 | 25:a7460e23e02e | 240 | if((LinePingState[B_PING]==1)&&(LinePingState[F_PING]==0)){ |
lilac0112_1 | 25:a7460e23e02e | 241 | |
lilac0112_1 | 25:a7460e23e02e | 242 | data.ReturnDir[Y_LINE]=F_LINE; |
lilac0112_1 | 25:a7460e23e02e | 243 | |
lilac0112_1 | 25:a7460e23e02e | 244 | if(pow_y>0){ |
lilac0112_1 | 25:a7460e23e02e | 245 | *y = 0; |
lilac0112_1 | 25:a7460e23e02e | 246 | data.lnStop[Y_LINE]=1; |
lilac0112_1 | 25:a7460e23e02e | 247 | } |
lilac0112_1 | 25:a7460e23e02e | 248 | else{ |
lilac0112_1 | 25:a7460e23e02e | 249 | *y = LineReturn[4]; |
lilac0112_1 | 25:a7460e23e02e | 250 | data.lnStop[Y_LINE]=0; |
lilac0112_1 | 25:a7460e23e02e | 251 | } |
lilac0112_1 | 25:a7460e23e02e | 252 | } |
lilac0112_1 | 25:a7460e23e02e | 253 | if((LinePingState[B_PING]==1)&&(LinePingState[F_PING]==1)){ |
lilac0112_1 | 25:a7460e23e02e | 254 | if( |
lilac0112_1 | 25:a7460e23e02e | 255 | (data.lnOrder[0]==C_SPOT)&&(data.lnOrder[1]==A_SPOT)&&(data.lnOrder[2]==B_SPOT)|| |
lilac0112_1 | 25:a7460e23e02e | 256 | (data.lnOrder[0]==C_SPOT)&&(data.lnOrder[1]==B_SPOT)&&(data.lnOrder[2]==A_SPOT) |
lilac0112_1 | 25:a7460e23e02e | 257 | ){ |
lilac0112_1 | 25:a7460e23e02e | 258 | *y = LineReturn[4]; |
lilac0112_1 | 25:a7460e23e02e | 259 | data.lnStop[Y_LINE]=0; |
lilac0112_1 | 25:a7460e23e02e | 260 | } |
lilac0112_1 | 25:a7460e23e02e | 261 | else if( |
lilac0112_1 | 25:a7460e23e02e | 262 | (data.lnOrder[0]==A_SPOT)&&(data.lnOrder[1]==B_SPOT)&&(data.lnOrder[2]==C_SPOT)|| |
lilac0112_1 | 25:a7460e23e02e | 263 | (data.lnOrder[0]==B_SPOT)&&(data.lnOrder[1]==A_SPOT)&&(data.lnOrder[2]==C_SPOT) |
lilac0112_1 | 25:a7460e23e02e | 264 | ){ |
lilac0112_1 | 25:a7460e23e02e | 265 | *y = -LineReturn[4]; |
lilac0112_1 | 25:a7460e23e02e | 266 | data.lnStop[Y_LINE]=0; |
lilac0112_1 | 25:a7460e23e02e | 267 | } |
lilac0112_1 | 25:a7460e23e02e | 268 | else{ |
lilac0112_1 | 25:a7460e23e02e | 269 | *y = 0; |
lilac0112_1 | 25:a7460e23e02e | 270 | data.lnStop[Y_LINE]=0; |
lilac0112_1 | 25:a7460e23e02e | 271 | } |
lilac0112_1 | 25:a7460e23e02e | 272 | } |
lilac0112_1 | 25:a7460e23e02e | 273 | } |
lilac0112_1 | 25:a7460e23e02e | 274 | //none |
lilac0112_1 | 25:a7460e23e02e | 275 | if((LinePingState[L_PING]==1)&&(LinePingState[R_PING]==1)&&(LinePingState[F_PING]==1)&&(LinePingState[B_PING]==1)){ |
lilac0112_1 | 25:a7460e23e02e | 276 | //turn! |
lilac0112_1 | 25:a7460e23e02e | 277 | } |
lilac0112_1 | 25:a7460e23e02e | 278 | |
lilac0112_1 | 25:a7460e23e02e | 279 | } |
lilac0112_1 | 25:a7460e23e02e | 280 | else{//data.FieldSpot==LINE_INSIDE |
lilac0112_1 | 25:a7460e23e02e | 281 | |
lilac0112_1 | 25:a7460e23e02e | 282 | data.ReturnDir[X_LINE]=LINE_EMPTY; |
lilac0112_1 | 25:a7460e23e02e | 283 | data.ReturnDir[Y_LINE]=LINE_EMPTY; |
lilac0112_1 | 25:a7460e23e02e | 284 | |
lilac0112_1 | 25:a7460e23e02e | 285 | *x = 0; |
lilac0112_1 | 25:a7460e23e02e | 286 | *y = 0; |
lilac0112_1 | 25:a7460e23e02e | 287 | |
lilac0112_1 | 25:a7460e23e02e | 288 | //line間際の復帰力以外の力を作用させるか否か |
lilac0112_1 | 25:a7460e23e02e | 289 | data.lnStop[X_LINE]=1; |
lilac0112_1 | 25:a7460e23e02e | 290 | data.lnStop[Y_LINE]=1; |
lilac0112_1 | 27:825c6835e3db | 291 | /* |
lilac0112_1 | 27:825c6835e3db | 292 | if( |
lilac0112_1 | 27:825c6835e3db | 293 | (data.lnRawMemory[A_SPOT]==1)&& |
lilac0112_1 | 27:825c6835e3db | 294 | (data.lnRawMemory[B_SPOT]==1)&& |
lilac0112_1 | 27:825c6835e3db | 295 | (data.lnRawMemory[C_SPOT]==0) |
lilac0112_1 | 27:825c6835e3db | 296 | ){ |
lilac0112_1 | 27:825c6835e3db | 297 | data.lnStop[Y_LINE]=0; |
lilac0112_1 | 27:825c6835e3db | 298 | *y = -LineReturn[4]; |
lilac0112_1 | 27:825c6835e3db | 299 | } |
lilac0112_1 | 27:825c6835e3db | 300 | else if( |
lilac0112_1 | 27:825c6835e3db | 301 | (data.lnRawMemory[A_SPOT]==0)&& |
lilac0112_1 | 27:825c6835e3db | 302 | (data.lnRawMemory[B_SPOT]==0)&& |
lilac0112_1 | 27:825c6835e3db | 303 | (data.lnRawMemory[C_SPOT]==1) |
lilac0112_1 | 27:825c6835e3db | 304 | ){ |
lilac0112_1 | 27:825c6835e3db | 305 | data.lnStop[Y_LINE]=0; |
lilac0112_1 | 27:825c6835e3db | 306 | *y = LineReturn[4]; |
lilac0112_1 | 27:825c6835e3db | 307 | }*/ |
lilac0112_1 | 27:825c6835e3db | 308 | } |
lilac0112_1 | 27:825c6835e3db | 309 | } |
lilac0112_1 | 27:825c6835e3db | 310 | void LineJudgeReturn2(double pow_x, double pow_y, double *x, double *y){ |
lilac0112_1 | 27:825c6835e3db | 311 | const int8_t static LineReturn[5] = {0, 0, 0, 0, 20}; |
lilac0112_1 | 27:825c6835e3db | 312 | uint8_t LinePingState[4]; |
lilac0112_1 | 27:825c6835e3db | 313 | //◎ボールを追う力とラインから離れる力の向きが違うならばラインから離れる力が優先される. |
lilac0112_1 | 27:825c6835e3db | 314 | //◎ボールを追う力とラインから離れる力の向きが同じならばボールを追う力が優先される. |
lilac0112_1 | 27:825c6835e3db | 315 | //◎ラインセンサ全てが場外になるまではボールを追う力は作用しない.ボールを追う力は場内に出るまで作用する. |
lilac0112_1 | 27:825c6835e3db | 316 | //×ラインのほぼ場外では常時ラインから離れる力が優先される. |
lilac0112_1 | 27:825c6835e3db | 317 | //※場外判定を行うには再び場内に戻る必要がある. |
lilac0112_1 | 27:825c6835e3db | 318 | |
lilac0112_1 | 27:825c6835e3db | 319 | data.FieldSpot=LINE_INSIDE; |
lilac0112_1 | 27:825c6835e3db | 320 | |
lilac0112_1 | 27:825c6835e3db | 321 | if(data.FieldSpot==LINE_OUTSIDE){ |
lilac0112_1 | 27:825c6835e3db | 322 | } |
lilac0112_1 | 27:825c6835e3db | 323 | else{//data.FieldSpot==LINE_INSIDE |
lilac0112_1 | 27:825c6835e3db | 324 | |
lilac0112_1 | 27:825c6835e3db | 325 | data.ReturnDir[X_LINE]=LINE_EMPTY; |
lilac0112_1 | 27:825c6835e3db | 326 | data.ReturnDir[Y_LINE]=LINE_EMPTY; |
lilac0112_1 | 27:825c6835e3db | 327 | |
lilac0112_1 | 27:825c6835e3db | 328 | *x = 0; |
lilac0112_1 | 27:825c6835e3db | 329 | *y = 0; |
lilac0112_1 | 27:825c6835e3db | 330 | |
lilac0112_1 | 27:825c6835e3db | 331 | //line間際の復帰力以外の力を作用させるか否か |
lilac0112_1 | 27:825c6835e3db | 332 | data.lnStop[X_LINE]=1; |
lilac0112_1 | 27:825c6835e3db | 333 | data.lnStop[Y_LINE]=1; |
lilac0112_1 | 27:825c6835e3db | 334 | |
lilac0112_1 | 27:825c6835e3db | 335 | if(//y |
lilac0112_1 | 27:825c6835e3db | 336 | ((data.lnRawOrder[0]==A_SPOT)&&(data.lnRawOrder[1]==B_SPOT)&&(1))|| |
lilac0112_1 | 27:825c6835e3db | 337 | ((data.lnRawOrder[0]==B_SPOT)&&(data.lnRawOrder[1]==A_SPOT)&&(1)) |
lilac0112_1 | 27:825c6835e3db | 338 | ){ |
lilac0112_1 | 27:825c6835e3db | 339 | data.lnStop[Y_LINE]=0; |
lilac0112_1 | 27:825c6835e3db | 340 | *y = -LineReturn[4]; |
lilac0112_1 | 27:825c6835e3db | 341 | } |
lilac0112_1 | 27:825c6835e3db | 342 | else if( |
lilac0112_1 | 27:825c6835e3db | 343 | ((data.lnRawOrder[0]==C_SPOT)&&(1)&&(1)) |
lilac0112_1 | 27:825c6835e3db | 344 | ){ |
lilac0112_1 | 27:825c6835e3db | 345 | data.lnStop[Y_LINE]=0; |
lilac0112_1 | 27:825c6835e3db | 346 | *y = LineReturn[4]; |
lilac0112_1 | 27:825c6835e3db | 347 | } |
lilac0112_1 | 27:825c6835e3db | 348 | else if(//x |
lilac0112_1 | 27:825c6835e3db | 349 | ((data.lnRawOrder[0]==A_SPOT)&&(data.lnRawOrder[1]==C_SPOT)&&(1)) |
lilac0112_1 | 27:825c6835e3db | 350 | ){ |
lilac0112_1 | 27:825c6835e3db | 351 | *x = -LineReturn[4]; |
lilac0112_1 | 27:825c6835e3db | 352 | data.lnStop[X_LINE]=0; |
lilac0112_1 | 27:825c6835e3db | 353 | } |
lilac0112_1 | 27:825c6835e3db | 354 | else if( |
lilac0112_1 | 27:825c6835e3db | 355 | ((data.lnRawOrder[0]==B_SPOT)&&(data.lnRawOrder[1]==C_SPOT)&&(1)) |
lilac0112_1 | 27:825c6835e3db | 356 | ){ |
lilac0112_1 | 27:825c6835e3db | 357 | *x = LineReturn[4]; |
lilac0112_1 | 27:825c6835e3db | 358 | data.lnStop[X_LINE]=0; |
lilac0112_1 | 27:825c6835e3db | 359 | } |
lilac0112_1 | 27:825c6835e3db | 360 | |
lilac0112_1 | 27:825c6835e3db | 361 | if( |
lilac0112_1 | 27:825c6835e3db | 362 | ((*x)!=0)|| |
lilac0112_1 | 27:825c6835e3db | 363 | ((*y)!=0) |
lilac0112_1 | 27:825c6835e3db | 364 | ){ |
lilac0112_1 | 27:825c6835e3db | 365 | |
lilac0112_1 | 27:825c6835e3db | 366 | data.lnRawReturn=1; |
lilac0112_1 | 27:825c6835e3db | 367 | |
lilac0112_1 | 27:825c6835e3db | 368 | LinePingState[L_PING]=(data.ping[L_PING]<WhiteToWallPlus[X_PING]); |
lilac0112_1 | 27:825c6835e3db | 369 | LinePingState[R_PING]=(data.ping[R_PING]<WhiteToWallPlus[X_PING]); |
lilac0112_1 | 27:825c6835e3db | 370 | LinePingState[F_PING]=(data.ping[F_PING]<WhiteToWallPlus[Y_PING]); |
lilac0112_1 | 27:825c6835e3db | 371 | LinePingState[B_PING]=(data.ping[B_PING]<WhiteToWallPlus[Y_PING]); |
lilac0112_1 | 27:825c6835e3db | 372 | //x |
lilac0112_1 | 27:825c6835e3db | 373 | if(data.lnStop[X_LINE]==1){ |
lilac0112_1 | 27:825c6835e3db | 374 | if((LinePingState[L_PING]==0)&&(LinePingState[R_PING]==1)){ |
lilac0112_1 | 27:825c6835e3db | 375 | *x = -LineReturn[4]; |
lilac0112_1 | 27:825c6835e3db | 376 | data.lnStop[X_LINE]=0; |
lilac0112_1 | 27:825c6835e3db | 377 | } |
lilac0112_1 | 27:825c6835e3db | 378 | if((LinePingState[L_PING]==1)&&(LinePingState[R_PING]==0)){ |
lilac0112_1 | 27:825c6835e3db | 379 | *x = LineReturn[4]; |
lilac0112_1 | 27:825c6835e3db | 380 | data.lnStop[X_LINE]=0; |
lilac0112_1 | 27:825c6835e3db | 381 | } |
lilac0112_1 | 27:825c6835e3db | 382 | if((LinePingState[L_PING]==1)&&(LinePingState[R_PING]==1)){ |
lilac0112_1 | 27:825c6835e3db | 383 | *x = 0; |
lilac0112_1 | 27:825c6835e3db | 384 | data.lnStop[X_LINE]=0; |
lilac0112_1 | 27:825c6835e3db | 385 | } |
lilac0112_1 | 27:825c6835e3db | 386 | } |
lilac0112_1 | 27:825c6835e3db | 387 | //y |
lilac0112_1 | 27:825c6835e3db | 388 | if(data.lnStop[Y_LINE]==1){ |
lilac0112_1 | 27:825c6835e3db | 389 | if((LinePingState[B_PING]==0)&&(LinePingState[F_PING]==1)){ |
lilac0112_1 | 27:825c6835e3db | 390 | if(pow_y<0){ |
lilac0112_1 | 27:825c6835e3db | 391 | *y = 0; |
lilac0112_1 | 27:825c6835e3db | 392 | data.lnStop[Y_LINE]=1; |
lilac0112_1 | 27:825c6835e3db | 393 | } |
lilac0112_1 | 27:825c6835e3db | 394 | else{ |
lilac0112_1 | 27:825c6835e3db | 395 | *y = -LineReturn[4]; |
lilac0112_1 | 27:825c6835e3db | 396 | data.lnStop[Y_LINE]=0; |
lilac0112_1 | 27:825c6835e3db | 397 | } |
lilac0112_1 | 27:825c6835e3db | 398 | } |
lilac0112_1 | 27:825c6835e3db | 399 | if((LinePingState[B_PING]==1)&&(LinePingState[F_PING]==0)){ |
lilac0112_1 | 27:825c6835e3db | 400 | if(pow_y>0){ |
lilac0112_1 | 27:825c6835e3db | 401 | *y = 0; |
lilac0112_1 | 27:825c6835e3db | 402 | data.lnStop[Y_LINE]=1; |
lilac0112_1 | 27:825c6835e3db | 403 | } |
lilac0112_1 | 27:825c6835e3db | 404 | else{ |
lilac0112_1 | 27:825c6835e3db | 405 | *y = LineReturn[4]; |
lilac0112_1 | 27:825c6835e3db | 406 | data.lnStop[Y_LINE]=0; |
lilac0112_1 | 27:825c6835e3db | 407 | } |
lilac0112_1 | 27:825c6835e3db | 408 | } |
lilac0112_1 | 27:825c6835e3db | 409 | if((LinePingState[B_PING]==1)&&(LinePingState[F_PING]==1)){ |
lilac0112_1 | 27:825c6835e3db | 410 | *y = 0; |
lilac0112_1 | 27:825c6835e3db | 411 | data.lnStop[Y_LINE]=0; |
lilac0112_1 | 27:825c6835e3db | 412 | } |
lilac0112_1 | 27:825c6835e3db | 413 | } |
lilac0112_1 | 27:825c6835e3db | 414 | } |
lilac0112_1 | 27:825c6835e3db | 415 | else{ |
lilac0112_1 | 27:825c6835e3db | 416 | data.lnRawReturn=0; |
lilac0112_1 | 27:825c6835e3db | 417 | } |
lilac0112_1 | 27:825c6835e3db | 418 | |
lilac0112_1 | 25:a7460e23e02e | 419 | } |
lilac0112_1 | 25:a7460e23e02e | 420 | } |
lilac0112_1 | 25:a7460e23e02e | 421 | void LineJudgeReset(double pow_x, double pow_y, double *x, double *y){ |
lilac0112_1 | 25:a7460e23e02e | 422 | //static uint8_t NewLineCorner[4]={LINE_EMPTY, LINE_EMPTY, LINE_EMPTY, LINE_EMPTY}; |
lilac0112_1 | 25:a7460e23e02e | 423 | //static uint8_t LastLineCorner[4]={LINE_EMPTY, LINE_EMPTY, LINE_EMPTY, LINE_EMPTY}; |
lilac0112_1 | 25:a7460e23e02e | 424 | static uint8_t NewLineCorner[4]={LINE_EMPTY, LINE_EMPTY, LINE_EMPTY, LINE_EMPTY}; |
lilac0112_1 | 25:a7460e23e02e | 425 | static uint8_t LastLineCorner[4]={LINE_EMPTY, LINE_EMPTY, LINE_EMPTY, LINE_EMPTY}; |
lilac0112_1 | 25:a7460e23e02e | 426 | |
lilac0112_1 | 25:a7460e23e02e | 427 | if((/*data.lnRaw==0*/1)&&(data.lnHold==7)){ |
lilac0112_1 | 25:a7460e23e02e | 428 | if(data.FieldSpot==LINE_INSIDE){ |
lilac0112_1 | 25:a7460e23e02e | 429 | |
lilac0112_1 | 25:a7460e23e02e | 430 | data.lnCorner[L_LINE] = (data.ping[L_PING]<OutToWall[X_PING]); |
lilac0112_1 | 25:a7460e23e02e | 431 | data.lnCorner[R_LINE] = (data.ping[R_PING]<OutToWall[X_PING]); |
lilac0112_1 | 25:a7460e23e02e | 432 | data.lnCorner[F_LINE] = (data.ping[F_PING]<OutToWall[Y_PING]); |
lilac0112_1 | 25:a7460e23e02e | 433 | data.lnCorner[B_LINE] = (data.ping[B_PING]<OutToWall[Y_PING]); |
lilac0112_1 | 25:a7460e23e02e | 434 | if( |
lilac0112_1 | 25:a7460e23e02e | 435 | (data.lnCorner[L_LINE])|| |
lilac0112_1 | 25:a7460e23e02e | 436 | (data.lnCorner[R_LINE])|| |
lilac0112_1 | 25:a7460e23e02e | 437 | (data.lnCorner[F_LINE])|| |
lilac0112_1 | 25:a7460e23e02e | 438 | (data.lnCorner[B_LINE]) |
lilac0112_1 | 25:a7460e23e02e | 439 | ){ |
lilac0112_1 | 25:a7460e23e02e | 440 | |
lilac0112_1 | 25:a7460e23e02e | 441 | data.NonWall[L_LINE] = (data.ping[L_PING]>WhiteToWall[X_PING]); |
lilac0112_1 | 25:a7460e23e02e | 442 | data.NonWall[R_LINE] = (data.ping[R_PING]>WhiteToWall[X_PING]); |
lilac0112_1 | 25:a7460e23e02e | 443 | data.NonWall[F_LINE] = (data.ping[F_PING]>WhiteToWall[Y_PING]); |
lilac0112_1 | 25:a7460e23e02e | 444 | data.NonWall[B_LINE] = (data.ping[B_PING]>WhiteToWall[Y_PING]); |
lilac0112_1 | 25:a7460e23e02e | 445 | |
lilac0112_1 | 25:a7460e23e02e | 446 | |
lilac0112_1 | 25:a7460e23e02e | 447 | |
lilac0112_1 | 25:a7460e23e02e | 448 | ///* |
lilac0112_1 | 25:a7460e23e02e | 449 | LastLineCorner[L_LINE]=NewLineCorner[L_LINE]; |
lilac0112_1 | 25:a7460e23e02e | 450 | LastLineCorner[R_LINE]=NewLineCorner[R_LINE]; |
lilac0112_1 | 25:a7460e23e02e | 451 | LastLineCorner[F_LINE]=NewLineCorner[F_LINE]; |
lilac0112_1 | 25:a7460e23e02e | 452 | LastLineCorner[B_LINE]=NewLineCorner[B_LINE]; |
lilac0112_1 | 25:a7460e23e02e | 453 | |
lilac0112_1 | 25:a7460e23e02e | 454 | NewLineCorner[L_LINE]=data.lnCorner[L_LINE]; |
lilac0112_1 | 25:a7460e23e02e | 455 | NewLineCorner[R_LINE]=data.lnCorner[R_LINE]; |
lilac0112_1 | 25:a7460e23e02e | 456 | NewLineCorner[F_LINE]=data.lnCorner[F_LINE]; |
lilac0112_1 | 25:a7460e23e02e | 457 | NewLineCorner[B_LINE]=data.lnCorner[B_LINE]; |
lilac0112_1 | 25:a7460e23e02e | 458 | |
lilac0112_1 | 25:a7460e23e02e | 459 | if( |
lilac0112_1 | 25:a7460e23e02e | 460 | (LastLineCorner[L_LINE]==NewLineCorner[L_LINE])&& |
lilac0112_1 | 25:a7460e23e02e | 461 | (LastLineCorner[R_LINE]==NewLineCorner[R_LINE])&& |
lilac0112_1 | 25:a7460e23e02e | 462 | (LastLineCorner[F_LINE]==NewLineCorner[F_LINE])&& |
lilac0112_1 | 25:a7460e23e02e | 463 | (LastLineCorner[B_LINE]==NewLineCorner[B_LINE]) |
lilac0112_1 | 25:a7460e23e02e | 464 | ){ |
lilac0112_1 | 25:a7460e23e02e | 465 | data.lnRepeat++; |
lilac0112_1 | 25:a7460e23e02e | 466 | } |
lilac0112_1 | 25:a7460e23e02e | 467 | else{ |
lilac0112_1 | 25:a7460e23e02e | 468 | data.lnRepeat=0; |
lilac0112_1 | 25:a7460e23e02e | 469 | } |
lilac0112_1 | 25:a7460e23e02e | 470 | //*/ |
lilac0112_1 | 25:a7460e23e02e | 471 | |
lilac0112_1 | 25:a7460e23e02e | 472 | data.FieldSpot = LINE_OUTSIDE; |
lilac0112_1 | 25:a7460e23e02e | 473 | LineLiberate(); |
lilac0112_1 | 25:a7460e23e02e | 474 | } |
lilac0112_1 | 25:a7460e23e02e | 475 | } |
lilac0112_1 | 25:a7460e23e02e | 476 | else if(data.FieldSpot==LINE_OUTSIDE){ |
lilac0112_1 | 25:a7460e23e02e | 477 | if(data.lnRaw==0){ |
lilac0112_1 | 25:a7460e23e02e | 478 | data.FieldSpot = LINE_INSIDE; |
lilac0112_1 | 25:a7460e23e02e | 479 | data.NonWall[L_LINE] = data.NonWall[R_LINE] = data.NonWall[F_LINE] = data.NonWall[B_LINE] = 0; |
lilac0112_1 | 25:a7460e23e02e | 480 | LineLiberate(); |
lilac0112_1 | 25:a7460e23e02e | 481 | LineRankClear(); |
lilac0112_1 | 25:a7460e23e02e | 482 | } |
lilac0112_1 | 25:a7460e23e02e | 483 | } |
lilac0112_1 | 25:a7460e23e02e | 484 | } |
lilac0112_1 | 25:a7460e23e02e | 485 | if(data.FieldSpot == LINE_OUTSIDE){ |
lilac0112_1 | 25:a7460e23e02e | 486 | if( |
lilac0112_1 | 25:a7460e23e02e | 487 | ( |
lilac0112_1 | 25:a7460e23e02e | 488 | (data.ping[L_PING]>=WhiteToWall[X_PING])|| |
lilac0112_1 | 25:a7460e23e02e | 489 | (data.NonWall[L_LINE]==1)|| |
lilac0112_1 | 25:a7460e23e02e | 490 | ((data.lnOrder[0]==A_SPOT)&&(data.lnOrder[1]==C_SPOT)) |
lilac0112_1 | 25:a7460e23e02e | 491 | //(data.lnOrder[0]==A_SPOT) |
lilac0112_1 | 25:a7460e23e02e | 492 | )&& |
lilac0112_1 | 25:a7460e23e02e | 493 | ( |
lilac0112_1 | 25:a7460e23e02e | 494 | (data.ping[R_PING]>=WhiteToWall[X_PING])|| |
lilac0112_1 | 25:a7460e23e02e | 495 | (data.NonWall[R_LINE]==1)|| |
lilac0112_1 | 25:a7460e23e02e | 496 | ((data.lnOrder[0]==B_SPOT)&&(data.lnOrder[1]==C_SPOT)) |
lilac0112_1 | 25:a7460e23e02e | 497 | //(data.lnOrder[0]==B_SPOT) |
lilac0112_1 | 25:a7460e23e02e | 498 | )&& |
lilac0112_1 | 25:a7460e23e02e | 499 | ( |
lilac0112_1 | 25:a7460e23e02e | 500 | (data.ping[F_PING]>=WhiteToWall[Y_PING])|| |
lilac0112_1 | 25:a7460e23e02e | 501 | (data.NonWall[F_LINE]==1)|| |
lilac0112_1 | 25:a7460e23e02e | 502 | ((data.lnOrder[0]==C_SPOT)&&(data.lnOrder[1]==A_SPOT))|| |
lilac0112_1 | 25:a7460e23e02e | 503 | ((data.lnOrder[0]==C_SPOT)&&(data.lnOrder[1]==B_SPOT)) |
lilac0112_1 | 25:a7460e23e02e | 504 | )&& |
lilac0112_1 | 25:a7460e23e02e | 505 | ((data.ping[B_PING]>=WhiteToWall[Y_PING])|| |
lilac0112_1 | 25:a7460e23e02e | 506 | (data.NonWall[B_LINE]==1)|| |
lilac0112_1 | 25:a7460e23e02e | 507 | ((data.lnOrder[0]==A_SPOT)&&(data.lnOrder[1]==B_SPOT))|| |
lilac0112_1 | 25:a7460e23e02e | 508 | ((data.lnOrder[0]==B_SPOT)&&(data.lnOrder[1]==A_SPOT)) |
lilac0112_1 | 25:a7460e23e02e | 509 | ) |
lilac0112_1 | 25:a7460e23e02e | 510 | ){ |
lilac0112_1 | 25:a7460e23e02e | 511 | data.FieldSpot = LINE_INSIDE; |
lilac0112_1 | 25:a7460e23e02e | 512 | data.NonWall[L_LINE] = data.NonWall[R_LINE] = data.NonWall[F_LINE] = data.NonWall[B_LINE] = 0; |
lilac0112_1 | 25:a7460e23e02e | 513 | LineLiberate(); |
lilac0112_1 | 25:a7460e23e02e | 514 | LineRankClear(); |
lilac0112_1 | 25:a7460e23e02e | 515 | } |
lilac0112_1 | 25:a7460e23e02e | 516 | } |
lilac0112_1 | 25:a7460e23e02e | 517 | if((data.FieldSpot == LINE_INSIDE)&&(0<data.lnHold)&&(data.lnHold<7)&&(data.lnRaw==0)){ |
lilac0112_1 | 25:a7460e23e02e | 518 | if( |
lilac0112_1 | 25:a7460e23e02e | 519 | ( |
lilac0112_1 | 25:a7460e23e02e | 520 | ( |
lilac0112_1 | 25:a7460e23e02e | 521 | (data.ping[L_PING]>=WhiteToWall[X_PING])|| |
lilac0112_1 | 25:a7460e23e02e | 522 | ((data.lnOrder[0]==A_SPOT)&&(data.lnOrder[1]==C_SPOT)) |
lilac0112_1 | 25:a7460e23e02e | 523 | //(data.lnOrder[0]==A_SPOT) |
lilac0112_1 | 25:a7460e23e02e | 524 | )&& |
lilac0112_1 | 25:a7460e23e02e | 525 | ( |
lilac0112_1 | 25:a7460e23e02e | 526 | (data.ping[R_PING]>=WhiteToWall[X_PING])|| |
lilac0112_1 | 25:a7460e23e02e | 527 | ((data.lnOrder[0]==B_SPOT)&&(data.lnOrder[1]==C_SPOT)) |
lilac0112_1 | 25:a7460e23e02e | 528 | //(data.lnOrder[0]==B_SPOT) |
lilac0112_1 | 25:a7460e23e02e | 529 | )&& |
lilac0112_1 | 25:a7460e23e02e | 530 | ( |
lilac0112_1 | 25:a7460e23e02e | 531 | (data.ping[F_PING]>=WhiteToWall[Y_PING])|| |
lilac0112_1 | 25:a7460e23e02e | 532 | ((data.lnOrder[0]==C_SPOT)&&(data.lnOrder[1]==A_SPOT))|| |
lilac0112_1 | 25:a7460e23e02e | 533 | ((data.lnOrder[0]==C_SPOT)&&(data.lnOrder[1]==B_SPOT)) |
lilac0112_1 | 25:a7460e23e02e | 534 | )&& |
lilac0112_1 | 25:a7460e23e02e | 535 | ( |
lilac0112_1 | 25:a7460e23e02e | 536 | (data.ping[B_PING]>=WhiteToWall[Y_PING])|| |
lilac0112_1 | 25:a7460e23e02e | 537 | ((data.lnOrder[0]==A_SPOT)&&(data.lnOrder[1]==B_SPOT))|| |
lilac0112_1 | 25:a7460e23e02e | 538 | ((data.lnOrder[0]==B_SPOT)&&(data.lnOrder[1]==A_SPOT)) |
lilac0112_1 | 25:a7460e23e02e | 539 | ) |
lilac0112_1 | 25:a7460e23e02e | 540 | ) |
lilac0112_1 | 25:a7460e23e02e | 541 | || |
lilac0112_1 | 25:a7460e23e02e | 542 | ( |
lilac0112_1 | 25:a7460e23e02e | 543 | (data.ping[L_PING]>=GoalEdgeToWall[X_PING])&& |
lilac0112_1 | 25:a7460e23e02e | 544 | (data.ping[R_PING]>=GoalEdgeToWall[X_PING]) |
lilac0112_1 | 25:a7460e23e02e | 545 | ) |
lilac0112_1 | 25:a7460e23e02e | 546 | ){ |
lilac0112_1 | 25:a7460e23e02e | 547 | data.NonWall[L_LINE] = data.NonWall[R_LINE] = data.NonWall[F_LINE] = data.NonWall[B_LINE] = 0; |
lilac0112_1 | 25:a7460e23e02e | 548 | LineLiberate(); |
lilac0112_1 | 25:a7460e23e02e | 549 | } |
lilac0112_1 | 25:a7460e23e02e | 550 | } |
lilac0112_1 | 25:a7460e23e02e | 551 | ///* |
lilac0112_1 | 25:a7460e23e02e | 552 | if( |
lilac0112_1 | 25:a7460e23e02e | 553 | (data.irNotice==IR_NONE)|| |
lilac0112_1 | 25:a7460e23e02e | 554 | (data.irNotice==IR_FAR)|| |
lilac0112_1 | 25:a7460e23e02e | 555 | ( |
lilac0112_1 | 25:a7460e23e02e | 556 | (data.ping[L_PING]>=GoalEdgeToWall[X_PING])&& |
lilac0112_1 | 25:a7460e23e02e | 557 | (data.ping[R_PING]>=GoalEdgeToWall[X_PING]) |
lilac0112_1 | 25:a7460e23e02e | 558 | ) |
lilac0112_1 | 25:a7460e23e02e | 559 | ){ |
lilac0112_1 | 25:a7460e23e02e | 560 | data.lnRepeat = 0; |
lilac0112_1 | 25:a7460e23e02e | 561 | |
lilac0112_1 | 25:a7460e23e02e | 562 | NewLineCorner[L_LINE]=LINE_EMPTY; |
lilac0112_1 | 25:a7460e23e02e | 563 | NewLineCorner[R_LINE]=LINE_EMPTY; |
lilac0112_1 | 25:a7460e23e02e | 564 | NewLineCorner[F_LINE]=LINE_EMPTY; |
lilac0112_1 | 25:a7460e23e02e | 565 | NewLineCorner[B_LINE]=LINE_EMPTY; |
lilac0112_1 | 25:a7460e23e02e | 566 | |
lilac0112_1 | 25:a7460e23e02e | 567 | LastLineCorner[L_LINE]=LINE_EMPTY; |
lilac0112_1 | 25:a7460e23e02e | 568 | LastLineCorner[R_LINE]=LINE_EMPTY; |
lilac0112_1 | 25:a7460e23e02e | 569 | LastLineCorner[F_LINE]=LINE_EMPTY; |
lilac0112_1 | 25:a7460e23e02e | 570 | LastLineCorner[B_LINE]=LINE_EMPTY; |
lilac0112_1 | 25:a7460e23e02e | 571 | } |
lilac0112_1 | 25:a7460e23e02e | 572 | //data.lnRepeat=0; |
lilac0112_1 | 25:a7460e23e02e | 573 | if((data.lnRepeat>0)&&(data.FieldSpot == LINE_INSIDE)){ |
lilac0112_1 | 25:a7460e23e02e | 574 | //x |
lilac0112_1 | 25:a7460e23e02e | 575 | if( |
lilac0112_1 | 25:a7460e23e02e | 576 | ((pow_x>=0)&&(NewLineCorner[R_LINE]))|| |
lilac0112_1 | 25:a7460e23e02e | 577 | ((pow_x<0)&&(NewLineCorner[L_LINE])) |
lilac0112_1 | 25:a7460e23e02e | 578 | ){ |
lilac0112_1 | 25:a7460e23e02e | 579 | data.lnStay[X_LINE]=0; |
lilac0112_1 | 25:a7460e23e02e | 580 | } |
lilac0112_1 | 25:a7460e23e02e | 581 | else{ |
lilac0112_1 | 25:a7460e23e02e | 582 | data.lnStay[X_LINE]=1; |
lilac0112_1 | 25:a7460e23e02e | 583 | } |
lilac0112_1 | 25:a7460e23e02e | 584 | //y |
lilac0112_1 | 25:a7460e23e02e | 585 | if( |
lilac0112_1 | 25:a7460e23e02e | 586 | ((pow_y>=0)&&(NewLineCorner[F_LINE]))|| |
lilac0112_1 | 25:a7460e23e02e | 587 | ((pow_y<0)&&(NewLineCorner[B_LINE])) |
lilac0112_1 | 25:a7460e23e02e | 588 | ){ |
lilac0112_1 | 25:a7460e23e02e | 589 | data.lnStay[Y_LINE]=0; |
lilac0112_1 | 25:a7460e23e02e | 590 | } |
lilac0112_1 | 25:a7460e23e02e | 591 | else{ |
lilac0112_1 | 25:a7460e23e02e | 592 | data.lnStay[Y_LINE]=1; |
lilac0112_1 | 25:a7460e23e02e | 593 | } |
lilac0112_1 | 25:a7460e23e02e | 594 | } |
lilac0112_1 | 25:a7460e23e02e | 595 | else{ |
lilac0112_1 | 25:a7460e23e02e | 596 | data.lnStay[X_LINE]=data.lnStay[Y_LINE]=1; |
lilac0112_1 | 25:a7460e23e02e | 597 | } |
lilac0112_1 | 25:a7460e23e02e | 598 | //*/ |
lilac0112_1 | 25:a7460e23e02e | 599 | |
lilac0112_1 | 25:a7460e23e02e | 600 | } |
lilac0112_1 | 27:825c6835e3db | 601 | void LineJudgeReset2(double pow_x, double pow_y, double *x, double *y){ |
lilac0112_1 | 27:825c6835e3db | 602 | if( |
lilac0112_1 | 27:825c6835e3db | 603 | (data.lnRawOrderLog2[0]==data.lnRawOrderLog1[0])&& |
lilac0112_1 | 27:825c6835e3db | 604 | (data.lnRawOrderLog2[1]==data.lnRawOrderLog1[1])&& |
lilac0112_1 | 27:825c6835e3db | 605 | (data.lnRawOrderLog2[2]==data.lnRawOrderLog1[2]) |
lilac0112_1 | 27:825c6835e3db | 606 | ){ |
lilac0112_1 | 27:825c6835e3db | 607 | data.lnRepeat=1; |
lilac0112_1 | 27:825c6835e3db | 608 | } |
lilac0112_1 | 27:825c6835e3db | 609 | else{ |
lilac0112_1 | 27:825c6835e3db | 610 | data.lnRepeat=0; |
lilac0112_1 | 27:825c6835e3db | 611 | } |
lilac0112_1 | 27:825c6835e3db | 612 | |
lilac0112_1 | 27:825c6835e3db | 613 | if( |
lilac0112_1 | 27:825c6835e3db | 614 | (data.irNotice==IR_NONE)|| |
lilac0112_1 | 27:825c6835e3db | 615 | (data.irNotice==IR_FAR)|| |
lilac0112_1 | 27:825c6835e3db | 616 | ( |
lilac0112_1 | 27:825c6835e3db | 617 | (data.ping[L_PING]>=GoalEdgeToWall[X_PING])&& |
lilac0112_1 | 27:825c6835e3db | 618 | (data.ping[R_PING]>=GoalEdgeToWall[X_PING]) |
lilac0112_1 | 27:825c6835e3db | 619 | ) |
lilac0112_1 | 27:825c6835e3db | 620 | ){ |
lilac0112_1 | 27:825c6835e3db | 621 | data.lnRepeat = 0; |
lilac0112_1 | 27:825c6835e3db | 622 | |
lilac0112_1 | 27:825c6835e3db | 623 | LineRawLogReset(); |
lilac0112_1 | 27:825c6835e3db | 624 | } |
lilac0112_1 | 27:825c6835e3db | 625 | //data.lnRepeat=0; |
lilac0112_1 | 28:f246a5fbf6a5 | 626 | //if((data.lnRepeat==1)&&((data.lnRawOrder[0]==LINE_EMPTY)&&(data.lnRawOrder[1]==LINE_EMPTY)&&(data.lnRawOrder[2]==LINE_EMPTY))){ |
lilac0112_1 | 28:f246a5fbf6a5 | 627 | if((data.lnRepeat==1)&&((data.lnRawOrder[0]==LINE_EMPTY))){ |
lilac0112_1 | 27:825c6835e3db | 628 | //y |
lilac0112_1 | 27:825c6835e3db | 629 | if( |
lilac0112_1 | 27:825c6835e3db | 630 | ((pow_y>0)&&((data.lnRawOrderLog1[0]==A_SPOT)&&(data.lnRawOrderLog1[1]==B_SPOT)&&(1)))|| |
lilac0112_1 | 27:825c6835e3db | 631 | ((pow_y>0)&&((data.lnRawOrderLog1[0]==B_SPOT)&&(data.lnRawOrderLog1[1]==A_SPOT)&&(1)))|| |
lilac0112_1 | 27:825c6835e3db | 632 | ((pow_y<0)&&((data.lnRawOrderLog1[0]==C_SPOT)&&(1)&&(1))) |
lilac0112_1 | 27:825c6835e3db | 633 | ){ |
lilac0112_1 | 27:825c6835e3db | 634 | data.lnStay[Y_LINE]=0; |
lilac0112_1 | 27:825c6835e3db | 635 | } |
lilac0112_1 | 27:825c6835e3db | 636 | else{ |
lilac0112_1 | 27:825c6835e3db | 637 | data.lnStay[Y_LINE]=1; |
lilac0112_1 | 27:825c6835e3db | 638 | } |
lilac0112_1 | 27:825c6835e3db | 639 | //x |
lilac0112_1 | 27:825c6835e3db | 640 | if( |
lilac0112_1 | 27:825c6835e3db | 641 | ((pow_x>0)&&((data.lnRawOrderLog1[0]==A_SPOT)&&(data.lnRawOrderLog1[1]==C_SPOT)&&(1)))|| |
lilac0112_1 | 27:825c6835e3db | 642 | ((pow_x<0)&&((data.lnRawOrderLog1[0]==B_SPOT)&&(data.lnRawOrderLog1[1]==C_SPOT)&&(1))) |
lilac0112_1 | 27:825c6835e3db | 643 | ){ |
lilac0112_1 | 27:825c6835e3db | 644 | data.lnStay[X_LINE]=0; |
lilac0112_1 | 27:825c6835e3db | 645 | } |
lilac0112_1 | 27:825c6835e3db | 646 | else{ |
lilac0112_1 | 27:825c6835e3db | 647 | data.lnStay[X_LINE]=1; |
lilac0112_1 | 27:825c6835e3db | 648 | } |
lilac0112_1 | 27:825c6835e3db | 649 | } |
lilac0112_1 | 27:825c6835e3db | 650 | else{ |
lilac0112_1 | 27:825c6835e3db | 651 | data.lnStay[X_LINE]=data.lnStay[Y_LINE]=1; |
lilac0112_1 | 27:825c6835e3db | 652 | } |
lilac0112_1 | 27:825c6835e3db | 653 | |
lilac0112_1 | 27:825c6835e3db | 654 | } |
lilac0112_1 | 27:825c6835e3db | 655 | void LineJudgeReset3(double pow_x, double pow_y, double *x, double *y){ |
lilac0112_1 | 27:825c6835e3db | 656 | //static uint8_t NewLineCorner[4]={LINE_EMPTY, LINE_EMPTY, LINE_EMPTY, LINE_EMPTY}; |
lilac0112_1 | 27:825c6835e3db | 657 | //static uint8_t LastLineCorner[4]={LINE_EMPTY, LINE_EMPTY, LINE_EMPTY, LINE_EMPTY}; |
lilac0112_1 | 27:825c6835e3db | 658 | static uint8_t NewLineCorner[4]={LINE_EMPTY, LINE_EMPTY, LINE_EMPTY, LINE_EMPTY}; |
lilac0112_1 | 27:825c6835e3db | 659 | static uint8_t LastLineCorner[4]={LINE_EMPTY, LINE_EMPTY, LINE_EMPTY, LINE_EMPTY}; |
lilac0112_1 | 27:825c6835e3db | 660 | |
lilac0112_1 | 27:825c6835e3db | 661 | if((/*data.lnRaw==0*/1)&&(data.lnHold>0)){ |
lilac0112_1 | 27:825c6835e3db | 662 | if(data.FieldSpot==LINE_INSIDE){ |
lilac0112_1 | 27:825c6835e3db | 663 | |
lilac0112_1 | 27:825c6835e3db | 664 | data.lnCorner[L_LINE] = (data.ping[L_PING]<OutToWall[X_PING]); |
lilac0112_1 | 27:825c6835e3db | 665 | data.lnCorner[R_LINE] = (data.ping[R_PING]<OutToWall[X_PING]); |
lilac0112_1 | 27:825c6835e3db | 666 | data.lnCorner[F_LINE] = (data.ping[F_PING]<OutToWall[Y_PING]); |
lilac0112_1 | 27:825c6835e3db | 667 | data.lnCorner[B_LINE] = (data.ping[B_PING]<OutToWall[Y_PING]); |
lilac0112_1 | 27:825c6835e3db | 668 | if( |
lilac0112_1 | 27:825c6835e3db | 669 | (data.lnCorner[L_LINE])|| |
lilac0112_1 | 27:825c6835e3db | 670 | (data.lnCorner[R_LINE])|| |
lilac0112_1 | 27:825c6835e3db | 671 | (data.lnCorner[F_LINE])|| |
lilac0112_1 | 27:825c6835e3db | 672 | (data.lnCorner[B_LINE]) |
lilac0112_1 | 27:825c6835e3db | 673 | ){ |
lilac0112_1 | 27:825c6835e3db | 674 | |
lilac0112_1 | 27:825c6835e3db | 675 | data.NonWall[L_LINE] = (data.ping[L_PING]>WhiteToWall[X_PING]); |
lilac0112_1 | 27:825c6835e3db | 676 | data.NonWall[R_LINE] = (data.ping[R_PING]>WhiteToWall[X_PING]); |
lilac0112_1 | 27:825c6835e3db | 677 | data.NonWall[F_LINE] = (data.ping[F_PING]>WhiteToWall[Y_PING]); |
lilac0112_1 | 27:825c6835e3db | 678 | data.NonWall[B_LINE] = (data.ping[B_PING]>WhiteToWall[Y_PING]); |
lilac0112_1 | 27:825c6835e3db | 679 | |
lilac0112_1 | 27:825c6835e3db | 680 | |
lilac0112_1 | 27:825c6835e3db | 681 | |
lilac0112_1 | 27:825c6835e3db | 682 | ///* |
lilac0112_1 | 27:825c6835e3db | 683 | LastLineCorner[L_LINE]=NewLineCorner[L_LINE]; |
lilac0112_1 | 27:825c6835e3db | 684 | LastLineCorner[R_LINE]=NewLineCorner[R_LINE]; |
lilac0112_1 | 27:825c6835e3db | 685 | LastLineCorner[F_LINE]=NewLineCorner[F_LINE]; |
lilac0112_1 | 27:825c6835e3db | 686 | LastLineCorner[B_LINE]=NewLineCorner[B_LINE]; |
lilac0112_1 | 27:825c6835e3db | 687 | |
lilac0112_1 | 27:825c6835e3db | 688 | NewLineCorner[L_LINE]=data.lnCorner[L_LINE]; |
lilac0112_1 | 27:825c6835e3db | 689 | NewLineCorner[R_LINE]=data.lnCorner[R_LINE]; |
lilac0112_1 | 27:825c6835e3db | 690 | NewLineCorner[F_LINE]=data.lnCorner[F_LINE]; |
lilac0112_1 | 27:825c6835e3db | 691 | NewLineCorner[B_LINE]=data.lnCorner[B_LINE]; |
lilac0112_1 | 27:825c6835e3db | 692 | |
lilac0112_1 | 27:825c6835e3db | 693 | if( |
lilac0112_1 | 27:825c6835e3db | 694 | (LastLineCorner[L_LINE]==NewLineCorner[L_LINE])&& |
lilac0112_1 | 27:825c6835e3db | 695 | (LastLineCorner[R_LINE]==NewLineCorner[R_LINE])&& |
lilac0112_1 | 27:825c6835e3db | 696 | (LastLineCorner[F_LINE]==NewLineCorner[F_LINE])&& |
lilac0112_1 | 27:825c6835e3db | 697 | (LastLineCorner[B_LINE]==NewLineCorner[B_LINE]) |
lilac0112_1 | 27:825c6835e3db | 698 | ){ |
lilac0112_1 | 27:825c6835e3db | 699 | data.lnRepeat++; |
lilac0112_1 | 27:825c6835e3db | 700 | } |
lilac0112_1 | 27:825c6835e3db | 701 | else{ |
lilac0112_1 | 27:825c6835e3db | 702 | data.lnRepeat=0; |
lilac0112_1 | 27:825c6835e3db | 703 | } |
lilac0112_1 | 27:825c6835e3db | 704 | //*/ |
lilac0112_1 | 27:825c6835e3db | 705 | |
lilac0112_1 | 27:825c6835e3db | 706 | data.FieldSpot = LINE_OUTSIDE; |
lilac0112_1 | 27:825c6835e3db | 707 | //Line_home.detach(); |
lilac0112_1 | 27:825c6835e3db | 708 | LineLiberate(); |
lilac0112_1 | 27:825c6835e3db | 709 | } |
lilac0112_1 | 27:825c6835e3db | 710 | else{ |
lilac0112_1 | 27:825c6835e3db | 711 | data.FieldSpot = LINE_INSIDE; |
lilac0112_1 | 27:825c6835e3db | 712 | data.NonWall[L_LINE] = data.NonWall[R_LINE] = data.NonWall[F_LINE] = data.NonWall[B_LINE] = 0; |
lilac0112_1 | 27:825c6835e3db | 713 | //Line_home.detach(); |
lilac0112_1 | 27:825c6835e3db | 714 | LineLiberate(); |
lilac0112_1 | 27:825c6835e3db | 715 | LineRankClear(); |
lilac0112_1 | 27:825c6835e3db | 716 | } |
lilac0112_1 | 27:825c6835e3db | 717 | } |
lilac0112_1 | 27:825c6835e3db | 718 | /*else if(data.FieldSpot==LINE_OUTSIDE){ |
lilac0112_1 | 27:825c6835e3db | 719 | if(data.lnRaw==0){ |
lilac0112_1 | 27:825c6835e3db | 720 | data.FieldSpot = LINE_INSIDE; |
lilac0112_1 | 27:825c6835e3db | 721 | data.NonWall[L_LINE] = data.NonWall[R_LINE] = data.NonWall[F_LINE] = data.NonWall[B_LINE] = 0; |
lilac0112_1 | 27:825c6835e3db | 722 | LineLiberate(); |
lilac0112_1 | 27:825c6835e3db | 723 | LineRankClear(); |
lilac0112_1 | 27:825c6835e3db | 724 | } |
lilac0112_1 | 27:825c6835e3db | 725 | }*/ |
lilac0112_1 | 27:825c6835e3db | 726 | } |
lilac0112_1 | 27:825c6835e3db | 727 | if(data.FieldSpot == LINE_OUTSIDE){ |
lilac0112_1 | 27:825c6835e3db | 728 | //Line_home.attach(&JudgeInSide, 2.0); |
lilac0112_1 | 27:825c6835e3db | 729 | if( |
lilac0112_1 | 27:825c6835e3db | 730 | ( |
lilac0112_1 | 27:825c6835e3db | 731 | data.lnRaw==0 |
lilac0112_1 | 27:825c6835e3db | 732 | )&& |
lilac0112_1 | 27:825c6835e3db | 733 | ( |
lilac0112_1 | 27:825c6835e3db | 734 | (data.ping[L_PING]>=WhiteToWall[X_PING])|| |
lilac0112_1 | 27:825c6835e3db | 735 | (data.NonWall[L_LINE]==1)|| |
lilac0112_1 | 27:825c6835e3db | 736 | ((data.lnOrder[0]==A_SPOT)&&(data.lnOrder[1]==C_SPOT))|| |
lilac0112_1 | 27:825c6835e3db | 737 | ((data.lnOrder[0]==A_SPOT)&&(data.NonWall[F_LINE]==1)&&(data.NonWall[B_LINE]==1))|| |
lilac0112_1 | 27:825c6835e3db | 738 | ((data.lnOrder[0]==A_SPOT)&&(data.ping[F_PING]>WhiteToWall[Y_PING])&&(data.ping[B_PING]>WhiteToWall[Y_PING])) |
lilac0112_1 | 27:825c6835e3db | 739 | )&& |
lilac0112_1 | 27:825c6835e3db | 740 | ( |
lilac0112_1 | 27:825c6835e3db | 741 | (data.ping[R_PING]>=WhiteToWall[X_PING])|| |
lilac0112_1 | 27:825c6835e3db | 742 | (data.NonWall[R_LINE]==1)|| |
lilac0112_1 | 27:825c6835e3db | 743 | ((data.lnOrder[0]==B_SPOT)&&(data.lnOrder[1]==C_SPOT))|| |
lilac0112_1 | 27:825c6835e3db | 744 | ((data.lnOrder[0]==B_SPOT)&&(data.NonWall[F_LINE]==1)&&(data.NonWall[B_LINE]==1))|| |
lilac0112_1 | 27:825c6835e3db | 745 | ((data.lnOrder[0]==B_SPOT)&&(data.ping[F_PING]>WhiteToWall[Y_PING])&&(data.ping[B_PING]>WhiteToWall[Y_PING])) |
lilac0112_1 | 27:825c6835e3db | 746 | )&& |
lilac0112_1 | 27:825c6835e3db | 747 | ( |
lilac0112_1 | 27:825c6835e3db | 748 | (data.ping[F_PING]>=WhiteToWall[Y_PING])|| |
lilac0112_1 | 27:825c6835e3db | 749 | (data.NonWall[F_LINE]==1)|| |
lilac0112_1 | 27:825c6835e3db | 750 | ((data.lnOrder[0]==C_SPOT)&&(data.lnOrder[1]==A_SPOT))|| |
lilac0112_1 | 27:825c6835e3db | 751 | ((data.lnOrder[0]==C_SPOT)&&(data.lnOrder[1]==B_SPOT))|| |
lilac0112_1 | 27:825c6835e3db | 752 | ((data.lnOrder[0]==C_SPOT)&&(data.lnOrder[1]==LINE_EMPTY)) |
lilac0112_1 | 27:825c6835e3db | 753 | )&& |
lilac0112_1 | 27:825c6835e3db | 754 | ((data.ping[B_PING]>=WhiteToWall[Y_PING])|| |
lilac0112_1 | 27:825c6835e3db | 755 | (data.NonWall[B_LINE]==1)|| |
lilac0112_1 | 27:825c6835e3db | 756 | ((data.lnOrder[0]==A_SPOT)&&(data.lnOrder[1]==B_SPOT))|| |
lilac0112_1 | 27:825c6835e3db | 757 | ((data.lnOrder[0]==B_SPOT)&&(data.lnOrder[1]==A_SPOT)) |
lilac0112_1 | 27:825c6835e3db | 758 | ) |
lilac0112_1 | 27:825c6835e3db | 759 | ){ |
lilac0112_1 | 27:825c6835e3db | 760 | data.FieldSpot = LINE_INSIDE; |
lilac0112_1 | 27:825c6835e3db | 761 | data.NonWall[L_LINE] = data.NonWall[R_LINE] = data.NonWall[F_LINE] = data.NonWall[B_LINE] = 0; |
lilac0112_1 | 27:825c6835e3db | 762 | //Line_home.detach(); |
lilac0112_1 | 27:825c6835e3db | 763 | LineLiberate(); |
lilac0112_1 | 27:825c6835e3db | 764 | LineRankClear(); |
lilac0112_1 | 27:825c6835e3db | 765 | } |
lilac0112_1 | 27:825c6835e3db | 766 | } |
lilac0112_1 | 27:825c6835e3db | 767 | /*if((data.FieldSpot == LINE_INSIDE)&&(0<data.lnHold)&&(data.lnHold<7)&&(data.lnRaw==0)){ |
lilac0112_1 | 27:825c6835e3db | 768 | if( |
lilac0112_1 | 27:825c6835e3db | 769 | ( |
lilac0112_1 | 27:825c6835e3db | 770 | ( |
lilac0112_1 | 27:825c6835e3db | 771 | (data.ping[L_PING]>=WhiteToWall[X_PING])|| |
lilac0112_1 | 27:825c6835e3db | 772 | ((data.lnOrder[0]==A_SPOT)&&(data.lnOrder[1]==C_SPOT)) |
lilac0112_1 | 27:825c6835e3db | 773 | //(data.lnOrder[0]==A_SPOT) |
lilac0112_1 | 27:825c6835e3db | 774 | )&& |
lilac0112_1 | 27:825c6835e3db | 775 | ( |
lilac0112_1 | 27:825c6835e3db | 776 | (data.ping[R_PING]>=WhiteToWall[X_PING])|| |
lilac0112_1 | 27:825c6835e3db | 777 | ((data.lnOrder[0]==B_SPOT)&&(data.lnOrder[1]==C_SPOT)) |
lilac0112_1 | 27:825c6835e3db | 778 | //(data.lnOrder[0]==B_SPOT) |
lilac0112_1 | 27:825c6835e3db | 779 | )&& |
lilac0112_1 | 27:825c6835e3db | 780 | ( |
lilac0112_1 | 27:825c6835e3db | 781 | (data.ping[F_PING]>=WhiteToWall[Y_PING])|| |
lilac0112_1 | 27:825c6835e3db | 782 | ((data.lnOrder[0]==C_SPOT)&&(data.lnOrder[1]==A_SPOT))|| |
lilac0112_1 | 27:825c6835e3db | 783 | ((data.lnOrder[0]==C_SPOT)&&(data.lnOrder[1]==B_SPOT)) |
lilac0112_1 | 27:825c6835e3db | 784 | )&& |
lilac0112_1 | 27:825c6835e3db | 785 | ( |
lilac0112_1 | 27:825c6835e3db | 786 | (data.ping[B_PING]>=WhiteToWall[Y_PING])|| |
lilac0112_1 | 27:825c6835e3db | 787 | ((data.lnOrder[0]==A_SPOT)&&(data.lnOrder[1]==B_SPOT))|| |
lilac0112_1 | 27:825c6835e3db | 788 | ((data.lnOrder[0]==B_SPOT)&&(data.lnOrder[1]==A_SPOT)) |
lilac0112_1 | 27:825c6835e3db | 789 | ) |
lilac0112_1 | 27:825c6835e3db | 790 | ) |
lilac0112_1 | 27:825c6835e3db | 791 | || |
lilac0112_1 | 27:825c6835e3db | 792 | ( |
lilac0112_1 | 27:825c6835e3db | 793 | (data.ping[L_PING]>=GoalEdgeToWall[X_PING])&& |
lilac0112_1 | 27:825c6835e3db | 794 | (data.ping[R_PING]>=GoalEdgeToWall[X_PING]) |
lilac0112_1 | 27:825c6835e3db | 795 | ) |
lilac0112_1 | 27:825c6835e3db | 796 | ){ |
lilac0112_1 | 27:825c6835e3db | 797 | data.NonWall[L_LINE] = data.NonWall[R_LINE] = data.NonWall[F_LINE] = data.NonWall[B_LINE] = 0; |
lilac0112_1 | 27:825c6835e3db | 798 | LineLiberate(); |
lilac0112_1 | 27:825c6835e3db | 799 | } |
lilac0112_1 | 27:825c6835e3db | 800 | }*/ |
lilac0112_1 | 27:825c6835e3db | 801 | ///* |
lilac0112_1 | 27:825c6835e3db | 802 | if( |
lilac0112_1 | 27:825c6835e3db | 803 | (data.irNotice==IR_NONE)|| |
lilac0112_1 | 27:825c6835e3db | 804 | (data.irNotice==IR_FAR)|| |
lilac0112_1 | 27:825c6835e3db | 805 | ( |
lilac0112_1 | 27:825c6835e3db | 806 | (data.ping[L_PING]>=GoalEdgeToWall[X_PING])&& |
lilac0112_1 | 27:825c6835e3db | 807 | (data.ping[R_PING]>=GoalEdgeToWall[X_PING]) |
lilac0112_1 | 27:825c6835e3db | 808 | ) |
lilac0112_1 | 27:825c6835e3db | 809 | ){ |
lilac0112_1 | 27:825c6835e3db | 810 | data.lnRepeat = 0; |
lilac0112_1 | 27:825c6835e3db | 811 | |
lilac0112_1 | 27:825c6835e3db | 812 | NewLineCorner[L_LINE]=LINE_EMPTY; |
lilac0112_1 | 27:825c6835e3db | 813 | NewLineCorner[R_LINE]=LINE_EMPTY; |
lilac0112_1 | 27:825c6835e3db | 814 | NewLineCorner[F_LINE]=LINE_EMPTY; |
lilac0112_1 | 27:825c6835e3db | 815 | NewLineCorner[B_LINE]=LINE_EMPTY; |
lilac0112_1 | 27:825c6835e3db | 816 | |
lilac0112_1 | 27:825c6835e3db | 817 | LastLineCorner[L_LINE]=LINE_EMPTY; |
lilac0112_1 | 27:825c6835e3db | 818 | LastLineCorner[R_LINE]=LINE_EMPTY; |
lilac0112_1 | 27:825c6835e3db | 819 | LastLineCorner[F_LINE]=LINE_EMPTY; |
lilac0112_1 | 27:825c6835e3db | 820 | LastLineCorner[B_LINE]=LINE_EMPTY; |
lilac0112_1 | 27:825c6835e3db | 821 | } |
lilac0112_1 | 27:825c6835e3db | 822 | //data.lnRepeat=0; |
lilac0112_1 | 27:825c6835e3db | 823 | if((data.lnRepeat>0)&&(data.FieldSpot == LINE_INSIDE)){ |
lilac0112_1 | 27:825c6835e3db | 824 | //x |
lilac0112_1 | 27:825c6835e3db | 825 | if( |
lilac0112_1 | 27:825c6835e3db | 826 | ((pow_x>=0)&&(NewLineCorner[R_LINE]))|| |
lilac0112_1 | 27:825c6835e3db | 827 | ((pow_x<0)&&(NewLineCorner[L_LINE])) |
lilac0112_1 | 27:825c6835e3db | 828 | ){ |
lilac0112_1 | 27:825c6835e3db | 829 | data.lnStay[X_LINE]=0; |
lilac0112_1 | 27:825c6835e3db | 830 | } |
lilac0112_1 | 27:825c6835e3db | 831 | else{ |
lilac0112_1 | 27:825c6835e3db | 832 | data.lnStay[X_LINE]=1; |
lilac0112_1 | 27:825c6835e3db | 833 | } |
lilac0112_1 | 27:825c6835e3db | 834 | //y |
lilac0112_1 | 27:825c6835e3db | 835 | if( |
lilac0112_1 | 27:825c6835e3db | 836 | ((pow_y>=0)&&(NewLineCorner[F_LINE]))|| |
lilac0112_1 | 27:825c6835e3db | 837 | ((pow_y<0)&&(NewLineCorner[B_LINE])) |
lilac0112_1 | 27:825c6835e3db | 838 | ){ |
lilac0112_1 | 27:825c6835e3db | 839 | data.lnStay[Y_LINE]=0; |
lilac0112_1 | 27:825c6835e3db | 840 | } |
lilac0112_1 | 27:825c6835e3db | 841 | else{ |
lilac0112_1 | 27:825c6835e3db | 842 | data.lnStay[Y_LINE]=1; |
lilac0112_1 | 27:825c6835e3db | 843 | } |
lilac0112_1 | 27:825c6835e3db | 844 | } |
lilac0112_1 | 27:825c6835e3db | 845 | else{ |
lilac0112_1 | 27:825c6835e3db | 846 | data.lnStay[X_LINE]=data.lnStay[Y_LINE]=1; |
lilac0112_1 | 27:825c6835e3db | 847 | } |
lilac0112_1 | 27:825c6835e3db | 848 | //*/ |
lilac0112_1 | 27:825c6835e3db | 849 | |
lilac0112_1 | 27:825c6835e3db | 850 | } |
lilac0112_1 | 27:825c6835e3db | 851 | void JudgeInSide(void){ |
lilac0112_1 | 27:825c6835e3db | 852 | data.FieldSpot = LINE_INSIDE; |
lilac0112_1 | 27:825c6835e3db | 853 | data.NonWall[L_LINE] = data.NonWall[R_LINE] = data.NonWall[F_LINE] = data.NonWall[B_LINE] = 0; |
lilac0112_1 | 27:825c6835e3db | 854 | LineLiberate(); |
lilac0112_1 | 27:825c6835e3db | 855 | LineRankClear(); |
lilac0112_1 | 27:825c6835e3db | 856 | //Line_home.detach(); |
lilac0112_1 | 27:825c6835e3db | 857 | } |