RobocupSSLのメイン基板白mbedのプログラム

Dependencies:   mbed

Rootsロボット mainプログラム

~ Robocup SSL(小型車輪リーグ)ロボット ~


Robocup SSLとは


●試合構成
Robocup小型ロボットリーグ(Small Size League)は,直径180[mm],高さ150[mm]以内のサイズのロボット6台が1チームとなり,オレンジ色のゴルフボールを使ってサッカー競技を行う自立型ロボットコンテストである. フィールドの上には2台のWebカメラが設置され,フィールド上のロボットとボールを撮影する.Visionサーバは,フィールドの画像データよりロボットとボールの座標データを算出し,LANを用い各チームのAI用PCに送信する.Webカメラの撮影速度は,60[fps]である.レフリーボックスは,ファウルやフリーキック,スローインなどの審判の判定を入力し,LANを通じて各チームのAI用PCに送信する.それぞれのチームのAI用PCは,ロボットとボールの座標,審判の判定を元にロボットの移動,キックなどの作戦を決定し,無線によってロボットに指令を送信する. 700


ロボット機能紹介


●オムニホイールによる方向転換不要の全方位移動

オムニホイールは,自由に回転可能なローラをホイールの外周上に配置した車輪である.ローラの回転により,車輪の回転と垂直の方向に駆動力を発することはできないが移動は可能となる.各車輪の角速度を調整することによって全方向への移動を可能にする.
400

●ドリブルバーのバックスピンによるボール保持

●電磁力を利用したキッカー

●キッカーの電磁力エネルギーを充電する充電回路

●ロボット情報が一目でわかるLCD

Committer:
alt0710
Date:
Tue May 30 13:56:15 2017 +0000
Revision:
21:d18c2dfaaba4
Parent:
20:354ed2681d0a
Child:
22:653b40db5a60
CHIP??????????????

Who changed what in which revision?

UserRevisionLine numberNew contents of line
alt0710 14:f6cc949a8046 1
alt0710 14:f6cc949a8046 2 #include "mbed.h"
alt0710 14:f6cc949a8046 3 #include "comm.h"
alt0710 14:f6cc949a8046 4 #include "mode.h"
alt0710 14:f6cc949a8046 5 #include "interface_manager.h"
alt0710 14:f6cc949a8046 6 #include "status_manager.h"
alt0710 14:f6cc949a8046 7 #include "parameter_manager.h"
alt0710 14:f6cc949a8046 8 #include "operation_check.h"
alt0710 14:f6cc949a8046 9
alt0710 14:f6cc949a8046 10 /* **mbedクラス** */
alt0710 14:f6cc949a8046 11 #ifdef LPC4088
alt0710 14:f6cc949a8046 12
alt0710 14:f6cc949a8046 13 #elif STM32
alt0710 14:f6cc949a8046 14
alt0710 14:f6cc949a8046 15 #endif
alt0710 14:f6cc949a8046 16
alt0710 14:f6cc949a8046 17 /* **ローカル関数定義** */
alt0710 14:f6cc949a8046 18
alt0710 14:f6cc949a8046 19 /* **ローカル関数** */
alt0710 14:f6cc949a8046 20
alt0710 14:f6cc949a8046 21 /* **グルーバル関数** */
alt0710 14:f6cc949a8046 22
alt0710 14:f6cc949a8046 23 /* **クラス** */
alt0710 14:f6cc949a8046 24 class InterfaceManager;
alt0710 14:f6cc949a8046 25 class StatusManager;
alt0710 14:f6cc949a8046 26 class ParameterManager;
alt0710 14:f6cc949a8046 27
alt0710 14:f6cc949a8046 28
alt0710 14:f6cc949a8046 29 //メンバ変数の初期化は、定義順(Warningになる)
alt0710 14:f6cc949a8046 30 OperationCheck::OperationCheck()
alt0710 20:354ed2681d0a 31 :checkMode(SELECT),
alt0710 20:354ed2681d0a 32 button_count(0),
alt0710 20:354ed2681d0a 33 sideSW_num(0),
alt0710 15:2bf8eafacef8 34 charge_flag(0),
alt0710 15:2bf8eafacef8 35 kick_flag(0),
alt0710 19:0bbd90be9aa3 36 power(0),
alt0710 21:d18c2dfaaba4 37 ball(0),
alt0710 21:d18c2dfaaba4 38 vel_value(0),
alt0710 21:d18c2dfaaba4 39 vel_angle(0)
alt0710 14:f6cc949a8046 40 {
alt0710 14:f6cc949a8046 41 }
alt0710 14:f6cc949a8046 42
alt0710 14:f6cc949a8046 43 void OperationCheck::run(void)
alt0710 14:f6cc949a8046 44 {
alt0710 20:354ed2681d0a 45 switch(checkMode)
alt0710 15:2bf8eafacef8 46 {
alt0710 20:354ed2681d0a 47 case SELECT:
alt0710 20:354ed2681d0a 48 selectCheckMode();
alt0710 20:354ed2681d0a 49 viewSelect();
alt0710 21:d18c2dfaaba4 50 resetValue();
alt0710 20:354ed2681d0a 51 break;
alt0710 20:354ed2681d0a 52
alt0710 20:354ed2681d0a 53 case WHEEL:
alt0710 21:d18c2dfaaba4 54 //sprintf(str,"WHEEL");
alt0710 21:d18c2dfaaba4 55 checkWheel();
alt0710 20:354ed2681d0a 56 checkBack();
alt0710 20:354ed2681d0a 57 break;
alt0710 20:354ed2681d0a 58
alt0710 20:354ed2681d0a 59 case DRIBBLE:
alt0710 20:354ed2681d0a 60 sprintf(str,"DRIBBLE");
alt0710 21:d18c2dfaaba4 61 checkDribble();
alt0710 20:354ed2681d0a 62 checkBack();
alt0710 20:354ed2681d0a 63 break;
alt0710 20:354ed2681d0a 64
alt0710 20:354ed2681d0a 65 case STR_KICK:
alt0710 20:354ed2681d0a 66 sprintf(str,"STR_KICK");
alt0710 21:d18c2dfaaba4 67 checkStrKick();
alt0710 20:354ed2681d0a 68 checkBack();
alt0710 20:354ed2681d0a 69 break;
alt0710 20:354ed2681d0a 70
alt0710 20:354ed2681d0a 71 case CHIP_KICK:
alt0710 20:354ed2681d0a 72 sprintf(str,"CHO_KICK");
alt0710 21:d18c2dfaaba4 73 checkChpKick();
alt0710 20:354ed2681d0a 74 checkBack();
alt0710 20:354ed2681d0a 75 break;
alt0710 20:354ed2681d0a 76
alt0710 20:354ed2681d0a 77 default:
alt0710 20:354ed2681d0a 78 sprintf(str,"ERROR");
alt0710 20:354ed2681d0a 79 break;
alt0710 15:2bf8eafacef8 80 }
alt0710 21:d18c2dfaaba4 81
alt0710 21:d18c2dfaaba4 82 if(InterfaceManager::ball_sensor == 0)
alt0710 21:d18c2dfaaba4 83 {
alt0710 21:d18c2dfaaba4 84 InterfaceManager::LED = 0;
alt0710 21:d18c2dfaaba4 85 }
alt0710 21:d18c2dfaaba4 86 else if(InterfaceManager::ball_sensor == 1)
alt0710 21:d18c2dfaaba4 87 {
alt0710 21:d18c2dfaaba4 88 InterfaceManager::LED = 1;
alt0710 21:d18c2dfaaba4 89 }
alt0710 20:354ed2681d0a 90 // //充電:左
alt0710 20:354ed2681d0a 91 // //強制放電:下
alt0710 20:354ed2681d0a 92 // //キック:上
alt0710 20:354ed2681d0a 93 // /* ***************** 充電 ******************************* */
alt0710 20:354ed2681d0a 94 // if(InterfaceManager::button.getButtonStatus(CROSS_LEFT))
alt0710 20:354ed2681d0a 95 // {
alt0710 20:354ed2681d0a 96 // charge_flag = 1;
alt0710 20:354ed2681d0a 97 // }
alt0710 20:354ed2681d0a 98 // if(StatusManager::is_kicking == 1)
alt0710 20:354ed2681d0a 99 // {
alt0710 20:354ed2681d0a 100 // charge_flag = 0;
alt0710 20:354ed2681d0a 101 // kick_flag = 0;
alt0710 20:354ed2681d0a 102 // }
alt0710 20:354ed2681d0a 103 //
alt0710 20:354ed2681d0a 104 // /* ***************** キック ******************************* */
alt0710 20:354ed2681d0a 105 // if(InterfaceManager::button.getButtonStatus(CROSS_UP))
alt0710 20:354ed2681d0a 106 // {
alt0710 20:354ed2681d0a 107 // kick_flag = 1;
alt0710 20:354ed2681d0a 108 // }
alt0710 20:354ed2681d0a 109 //
alt0710 20:354ed2681d0a 110 // /* ***************** 威力 ******************************* */
alt0710 20:354ed2681d0a 111 // if(InterfaceManager::button.getButtonStatus(CROSS_RIGHT))
alt0710 20:354ed2681d0a 112 // {
alt0710 20:354ed2681d0a 113 // power++;
alt0710 20:354ed2681d0a 114 // if(power > 15)
alt0710 20:354ed2681d0a 115 // {
alt0710 20:354ed2681d0a 116 // power = 0;
alt0710 20:354ed2681d0a 117 // }
alt0710 20:354ed2681d0a 118 // }
alt0710 20:354ed2681d0a 119 //
alt0710 20:354ed2681d0a 120 // if(InterfaceManager::button.getButtonStatus(CROSS_DOWN))
alt0710 20:354ed2681d0a 121 // {
alt0710 20:354ed2681d0a 122 // dribble.setdribble(1, power);
alt0710 20:354ed2681d0a 123 // }
alt0710 20:354ed2681d0a 124 // else
alt0710 20:354ed2681d0a 125 // {
alt0710 20:354ed2681d0a 126 // dribble.setdribble(0, 0);
alt0710 20:354ed2681d0a 127 // }
alt0710 20:354ed2681d0a 128 //
alt0710 20:354ed2681d0a 129 // if(InterfaceManager::ball_sensor)
alt0710 20:354ed2681d0a 130 // {
alt0710 20:354ed2681d0a 131 // ball = 1;
alt0710 20:354ed2681d0a 132 // }
alt0710 20:354ed2681d0a 133 // else
alt0710 20:354ed2681d0a 134 // {
alt0710 20:354ed2681d0a 135 // ball = 0;
alt0710 20:354ed2681d0a 136 // }
alt0710 20:354ed2681d0a 137 // /* ***************** 強制放電 ***************************** */
alt0710 20:354ed2681d0a 138 //// kicker.setCharge(charge_flag);
alt0710 20:354ed2681d0a 139 //// kicker.setKick(kick_flag, STRAIGHT, power);
alt0710 20:354ed2681d0a 140 //// kicker.forceFireKick();
alt0710 20:354ed2681d0a 141 //
alt0710 20:354ed2681d0a 142 // //createLcdData();
alt0710 20:354ed2681d0a 143 // sprintf(str,"F:%dP:%d\nB:%dK:%d",charge_flag,power,ball,kick_flag);
alt0710 20:354ed2681d0a 144 // //sprintf(str,"Hello");
alt0710 20:354ed2681d0a 145 InterfaceManager::i2c.setLCDMsg(str,sizeof(str));
alt0710 20:354ed2681d0a 146
alt0710 20:354ed2681d0a 147 }
alt0710 20:354ed2681d0a 148
alt0710 20:354ed2681d0a 149 void OperationCheck::selectCheckMode(void)
alt0710 20:354ed2681d0a 150 {
alt0710 20:354ed2681d0a 151 if(InterfaceManager::button.getButtonStatus(CROSS_RIGHT))
alt0710 15:2bf8eafacef8 152 {
alt0710 20:354ed2681d0a 153 button_count++;
alt0710 15:2bf8eafacef8 154 }
alt0710 14:f6cc949a8046 155
alt0710 20:354ed2681d0a 156 if(InterfaceManager::button.getButtonStatus(CROSS_LEFT))
alt0710 15:2bf8eafacef8 157 {
alt0710 20:354ed2681d0a 158 button_count--;
alt0710 20:354ed2681d0a 159 }
alt0710 20:354ed2681d0a 160
alt0710 20:354ed2681d0a 161 if(button_count > 3)
alt0710 20:354ed2681d0a 162 {
alt0710 20:354ed2681d0a 163 button_count = 0;
alt0710 20:354ed2681d0a 164 }
alt0710 20:354ed2681d0a 165 if(button_count < 0)
alt0710 20:354ed2681d0a 166 {
alt0710 20:354ed2681d0a 167 button_count = 3;
alt0710 15:2bf8eafacef8 168 }
alt0710 15:2bf8eafacef8 169
alt0710 20:354ed2681d0a 170 if(InterfaceManager::button.getButtonStatus(CROSS_UP))
alt0710 15:2bf8eafacef8 171 {
alt0710 20:354ed2681d0a 172 switch(button_count)
alt0710 15:2bf8eafacef8 173 {
alt0710 20:354ed2681d0a 174 case 0:
alt0710 20:354ed2681d0a 175 checkMode = WHEEL;
alt0710 20:354ed2681d0a 176 break;
alt0710 20:354ed2681d0a 177
alt0710 20:354ed2681d0a 178 case 1:
alt0710 20:354ed2681d0a 179 checkMode = DRIBBLE;
alt0710 20:354ed2681d0a 180 break;
alt0710 20:354ed2681d0a 181
alt0710 20:354ed2681d0a 182 case 2:
alt0710 20:354ed2681d0a 183 checkMode = STR_KICK;
alt0710 20:354ed2681d0a 184 break;
alt0710 20:354ed2681d0a 185
alt0710 20:354ed2681d0a 186 case 3:
alt0710 20:354ed2681d0a 187 checkMode = CHIP_KICK;
alt0710 20:354ed2681d0a 188 break;
alt0710 20:354ed2681d0a 189
alt0710 20:354ed2681d0a 190 default:
alt0710 20:354ed2681d0a 191 checkMode = SELECT;
alt0710 20:354ed2681d0a 192 break;
alt0710 15:2bf8eafacef8 193 }
alt0710 15:2bf8eafacef8 194 }
alt0710 20:354ed2681d0a 195
alt0710 20:354ed2681d0a 196 }
alt0710 19:0bbd90be9aa3 197
alt0710 20:354ed2681d0a 198 void OperationCheck::viewSelect(void)
alt0710 20:354ed2681d0a 199 {
alt0710 20:354ed2681d0a 200 switch(button_count)
alt0710 19:0bbd90be9aa3 201 {
alt0710 20:354ed2681d0a 202 case 0:
alt0710 20:354ed2681d0a 203 sprintf(str,"CHECK\nWHEEL");
alt0710 20:354ed2681d0a 204 break;
alt0710 20:354ed2681d0a 205
alt0710 20:354ed2681d0a 206 case 1:
alt0710 20:354ed2681d0a 207 sprintf(str,"CHECK\nDRIBBLE");
alt0710 20:354ed2681d0a 208 break;
alt0710 20:354ed2681d0a 209
alt0710 20:354ed2681d0a 210 case 2:
alt0710 20:354ed2681d0a 211 sprintf(str,"CHECK\nSTR_KICK");
alt0710 20:354ed2681d0a 212 break;
alt0710 20:354ed2681d0a 213
alt0710 20:354ed2681d0a 214 case 3:
alt0710 20:354ed2681d0a 215 sprintf(str,"CHECK\nCHP_KICK");
alt0710 20:354ed2681d0a 216 break;
alt0710 20:354ed2681d0a 217
alt0710 20:354ed2681d0a 218 default:
alt0710 20:354ed2681d0a 219 sprintf(str,"ERROR");
alt0710 20:354ed2681d0a 220 break;
alt0710 20:354ed2681d0a 221 }
alt0710 20:354ed2681d0a 222 }
alt0710 20:354ed2681d0a 223
alt0710 20:354ed2681d0a 224 void OperationCheck::checkBack(void)
alt0710 20:354ed2681d0a 225 {
alt0710 20:354ed2681d0a 226 if(InterfaceManager::button.getButtonStatus(CROSS_UP))
alt0710 20:354ed2681d0a 227 {
alt0710 20:354ed2681d0a 228 checkMode = SELECT;
alt0710 19:0bbd90be9aa3 229 }
alt0710 15:2bf8eafacef8 230
alt0710 14:f6cc949a8046 231 }
alt0710 14:f6cc949a8046 232
alt0710 14:f6cc949a8046 233 void OperationCheck::createLcdData(void)
alt0710 14:f6cc949a8046 234 {
alt0710 14:f6cc949a8046 235
alt0710 14:f6cc949a8046 236 /*
alt0710 14:f6cc949a8046 237
alt0710 14:f6cc949a8046 238 * 0 : 正常終了
alt0710 14:f6cc949a8046 239
alt0710 14:f6cc949a8046 240 * -1 : タイムアウト
alt0710 14:f6cc949a8046 241
alt0710 14:f6cc949a8046 242 * -2 : オーバーランエラー
alt0710 14:f6cc949a8046 243
alt0710 14:f6cc949a8046 244 * -3 : フレーミングエラー
alt0710 14:f6cc949a8046 245
alt0710 14:f6cc949a8046 246 * 1 : 受信中
alt0710 14:f6cc949a8046 247
alt0710 14:f6cc949a8046 248 * 2 : フレームリーダー1まで受信
alt0710 14:f6cc949a8046 249
alt0710 14:f6cc949a8046 250 * 3 : フレームリーダー2まで受信
alt0710 14:f6cc949a8046 251
alt0710 14:f6cc949a8046 252 * 4 : マシンIDまで受信
alt0710 14:f6cc949a8046 253
alt0710 14:f6cc949a8046 254 */
alt0710 14:f6cc949a8046 255 switch(StatusManager::uart){
alt0710 14:f6cc949a8046 256 case 0:
alt0710 14:f6cc949a8046 257 sprintf(str,"ID%d EN:\nComplete",ParameterManager::machine_id);
alt0710 14:f6cc949a8046 258
alt0710 14:f6cc949a8046 259 break;
alt0710 14:f6cc949a8046 260
alt0710 14:f6cc949a8046 261 case 1:
alt0710 14:f6cc949a8046 262 break;
alt0710 14:f6cc949a8046 263
alt0710 14:f6cc949a8046 264 case 2:
alt0710 14:f6cc949a8046 265 sprintf(str,"ID%d EN:\nHeader1",ParameterManager::machine_id);
alt0710 14:f6cc949a8046 266
alt0710 14:f6cc949a8046 267 break;
alt0710 14:f6cc949a8046 268
alt0710 14:f6cc949a8046 269 case 3:
alt0710 14:f6cc949a8046 270 sprintf(str,"ID%d EN:\nHeader2",ParameterManager::machine_id);
alt0710 14:f6cc949a8046 271
alt0710 14:f6cc949a8046 272 break;
alt0710 14:f6cc949a8046 273
alt0710 14:f6cc949a8046 274 case 4:
alt0710 14:f6cc949a8046 275 sprintf(str,"ID%d EN:\nCheckER1",ParameterManager::machine_id);
alt0710 14:f6cc949a8046 276
alt0710 14:f6cc949a8046 277 break;
alt0710 14:f6cc949a8046 278
alt0710 14:f6cc949a8046 279 case 5:
alt0710 14:f6cc949a8046 280 sprintf(str,"ID%d EN:\nCheckER2",ParameterManager::machine_id);
alt0710 14:f6cc949a8046 281
alt0710 14:f6cc949a8046 282 break;
alt0710 14:f6cc949a8046 283
alt0710 14:f6cc949a8046 284 case -1:
alt0710 14:f6cc949a8046 285 sprintf(str,"ID%d EN:\nTimeOut",ParameterManager::machine_id);
alt0710 14:f6cc949a8046 286
alt0710 14:f6cc949a8046 287 break;
alt0710 14:f6cc949a8046 288
alt0710 14:f6cc949a8046 289 case -2:
alt0710 14:f6cc949a8046 290 sprintf(str,"ID%d EN:\nOERR",ParameterManager::machine_id);
alt0710 14:f6cc949a8046 291
alt0710 14:f6cc949a8046 292 break;
alt0710 14:f6cc949a8046 293
alt0710 14:f6cc949a8046 294 case -3:
alt0710 14:f6cc949a8046 295 sprintf(str,"ID%d EN:\nFERR",ParameterManager::machine_id);
alt0710 14:f6cc949a8046 296
alt0710 14:f6cc949a8046 297 break;
alt0710 14:f6cc949a8046 298
alt0710 14:f6cc949a8046 299 default:
alt0710 14:f6cc949a8046 300 sprintf(str,"ID%d EN: \n %d",ParameterManager::machine_id, StatusManager::uart);
alt0710 14:f6cc949a8046 301 break;
alt0710 14:f6cc949a8046 302 }
alt0710 14:f6cc949a8046 303
alt0710 14:f6cc949a8046 304 }
alt0710 21:d18c2dfaaba4 305
alt0710 21:d18c2dfaaba4 306 void OperationCheck::checkWheel(void)
alt0710 21:d18c2dfaaba4 307 {
alt0710 21:d18c2dfaaba4 308 switch(InterfaceManager::button.getButtonStatus(CROSS_RIGHT))
alt0710 21:d18c2dfaaba4 309 {
alt0710 21:d18c2dfaaba4 310 case SINGLE_CLICK:
alt0710 21:d18c2dfaaba4 311 vel_angle += 10;
alt0710 21:d18c2dfaaba4 312 break;
alt0710 21:d18c2dfaaba4 313
alt0710 21:d18c2dfaaba4 314 case DOUBLE_CLICK:
alt0710 21:d18c2dfaaba4 315 vel_angle -= 10;
alt0710 21:d18c2dfaaba4 316 break;
alt0710 21:d18c2dfaaba4 317 default:
alt0710 21:d18c2dfaaba4 318
alt0710 21:d18c2dfaaba4 319 break;
alt0710 21:d18c2dfaaba4 320 }
alt0710 21:d18c2dfaaba4 321
alt0710 21:d18c2dfaaba4 322 if(vel_angle < 0)
alt0710 21:d18c2dfaaba4 323 {
alt0710 21:d18c2dfaaba4 324 vel_angle = 360;
alt0710 21:d18c2dfaaba4 325 }
alt0710 21:d18c2dfaaba4 326 if(vel_angle > 360)
alt0710 21:d18c2dfaaba4 327 {
alt0710 21:d18c2dfaaba4 328 vel_angle = 0;
alt0710 21:d18c2dfaaba4 329 }
alt0710 21:d18c2dfaaba4 330
alt0710 21:d18c2dfaaba4 331 switch(InterfaceManager::button.getButtonStatus(CROSS_LEFT))
alt0710 21:d18c2dfaaba4 332 {
alt0710 21:d18c2dfaaba4 333 case SINGLE_CLICK:
alt0710 21:d18c2dfaaba4 334 vel_value += 10;
alt0710 21:d18c2dfaaba4 335 break;
alt0710 21:d18c2dfaaba4 336
alt0710 21:d18c2dfaaba4 337 case DOUBLE_CLICK:
alt0710 21:d18c2dfaaba4 338 vel_value -= 10;
alt0710 21:d18c2dfaaba4 339 break;
alt0710 21:d18c2dfaaba4 340 default:
alt0710 21:d18c2dfaaba4 341
alt0710 21:d18c2dfaaba4 342 break;
alt0710 21:d18c2dfaaba4 343 }
alt0710 21:d18c2dfaaba4 344
alt0710 21:d18c2dfaaba4 345 if(vel_angle < -100)
alt0710 21:d18c2dfaaba4 346 {
alt0710 21:d18c2dfaaba4 347 vel_angle = 0;
alt0710 21:d18c2dfaaba4 348 }
alt0710 21:d18c2dfaaba4 349 if(vel_angle > 100)
alt0710 21:d18c2dfaaba4 350 {
alt0710 21:d18c2dfaaba4 351 vel_angle = 0;
alt0710 21:d18c2dfaaba4 352 }
alt0710 21:d18c2dfaaba4 353
alt0710 21:d18c2dfaaba4 354 if(InterfaceManager::button.getButtonStatus(CROSS_DOWN))
alt0710 21:d18c2dfaaba4 355 {
alt0710 21:d18c2dfaaba4 356 wheel.setVelocity(vel_value,vel_angle,0);
alt0710 21:d18c2dfaaba4 357 }
alt0710 21:d18c2dfaaba4 358 else
alt0710 21:d18c2dfaaba4 359 {
alt0710 21:d18c2dfaaba4 360 wheel.setVelocity(0,0,0);
alt0710 21:d18c2dfaaba4 361 }
alt0710 21:d18c2dfaaba4 362
alt0710 21:d18c2dfaaba4 363 sprintf(str,"V:%d\nA:%d",vel_value,vel_angle);
alt0710 21:d18c2dfaaba4 364
alt0710 21:d18c2dfaaba4 365
alt0710 21:d18c2dfaaba4 366 }
alt0710 21:d18c2dfaaba4 367 void OperationCheck::checkDribble(void)
alt0710 21:d18c2dfaaba4 368 {
alt0710 21:d18c2dfaaba4 369 switch(InterfaceManager::button.getButtonStatus(CROSS_RIGHT))
alt0710 21:d18c2dfaaba4 370 {
alt0710 21:d18c2dfaaba4 371 case SINGLE_CLICK:
alt0710 21:d18c2dfaaba4 372 power += 1;
alt0710 21:d18c2dfaaba4 373 break;
alt0710 21:d18c2dfaaba4 374
alt0710 21:d18c2dfaaba4 375 case DOUBLE_CLICK:
alt0710 21:d18c2dfaaba4 376 power -= 1;
alt0710 21:d18c2dfaaba4 377 break;
alt0710 21:d18c2dfaaba4 378 default:
alt0710 21:d18c2dfaaba4 379
alt0710 21:d18c2dfaaba4 380 break;
alt0710 21:d18c2dfaaba4 381 }
alt0710 21:d18c2dfaaba4 382
alt0710 21:d18c2dfaaba4 383 if(power < 0)
alt0710 21:d18c2dfaaba4 384 {
alt0710 21:d18c2dfaaba4 385 power = 15;
alt0710 21:d18c2dfaaba4 386 }
alt0710 21:d18c2dfaaba4 387 if(power > 15)
alt0710 21:d18c2dfaaba4 388 {
alt0710 21:d18c2dfaaba4 389 power = 0;
alt0710 21:d18c2dfaaba4 390 }
alt0710 21:d18c2dfaaba4 391
alt0710 21:d18c2dfaaba4 392 if(InterfaceManager::button.getButtonStatus(CROSS_DOWN))
alt0710 21:d18c2dfaaba4 393 {
alt0710 21:d18c2dfaaba4 394 dribble.setdribble(1,power);
alt0710 21:d18c2dfaaba4 395 }
alt0710 21:d18c2dfaaba4 396 else
alt0710 21:d18c2dfaaba4 397 {
alt0710 21:d18c2dfaaba4 398 dribble.setdribble(0,0);
alt0710 21:d18c2dfaaba4 399 }
alt0710 21:d18c2dfaaba4 400
alt0710 21:d18c2dfaaba4 401
alt0710 21:d18c2dfaaba4 402
alt0710 21:d18c2dfaaba4 403 sprintf(str,"DRIBBLE\nPOWER:%d",power);
alt0710 21:d18c2dfaaba4 404
alt0710 21:d18c2dfaaba4 405 }
alt0710 21:d18c2dfaaba4 406 void OperationCheck::checkStrKick(void)
alt0710 21:d18c2dfaaba4 407 {
alt0710 21:d18c2dfaaba4 408 switch(InterfaceManager::button.getButtonStatus(CROSS_RIGHT))
alt0710 21:d18c2dfaaba4 409 {
alt0710 21:d18c2dfaaba4 410 case SINGLE_CLICK:
alt0710 21:d18c2dfaaba4 411 power += 1;
alt0710 21:d18c2dfaaba4 412 break;
alt0710 21:d18c2dfaaba4 413
alt0710 21:d18c2dfaaba4 414 case DOUBLE_CLICK:
alt0710 21:d18c2dfaaba4 415 power -= 1;
alt0710 21:d18c2dfaaba4 416 break;
alt0710 21:d18c2dfaaba4 417 default:
alt0710 21:d18c2dfaaba4 418
alt0710 21:d18c2dfaaba4 419 break;
alt0710 21:d18c2dfaaba4 420 }
alt0710 21:d18c2dfaaba4 421
alt0710 21:d18c2dfaaba4 422 if(power < 0)
alt0710 21:d18c2dfaaba4 423 {
alt0710 21:d18c2dfaaba4 424 power = 15;
alt0710 21:d18c2dfaaba4 425 }
alt0710 21:d18c2dfaaba4 426 if(power > 15)
alt0710 21:d18c2dfaaba4 427 {
alt0710 21:d18c2dfaaba4 428 power = 0;
alt0710 21:d18c2dfaaba4 429 }
alt0710 21:d18c2dfaaba4 430
alt0710 21:d18c2dfaaba4 431 switch(InterfaceManager::button.getButtonStatus(CROSS_LEFT))
alt0710 21:d18c2dfaaba4 432 {
alt0710 21:d18c2dfaaba4 433 case SINGLE_CLICK:
alt0710 21:d18c2dfaaba4 434 charge_flag = 1;
alt0710 21:d18c2dfaaba4 435 break;
alt0710 21:d18c2dfaaba4 436
alt0710 21:d18c2dfaaba4 437 case DOUBLE_CLICK:
alt0710 21:d18c2dfaaba4 438 charge_flag = 0;
alt0710 21:d18c2dfaaba4 439 break;
alt0710 21:d18c2dfaaba4 440 default:
alt0710 21:d18c2dfaaba4 441
alt0710 21:d18c2dfaaba4 442 break;
alt0710 21:d18c2dfaaba4 443 }
alt0710 21:d18c2dfaaba4 444
alt0710 21:d18c2dfaaba4 445 if(StatusManager::is_kicking == 1)
alt0710 21:d18c2dfaaba4 446 {
alt0710 21:d18c2dfaaba4 447 charge_flag = 0;
alt0710 21:d18c2dfaaba4 448 kick_flag = 0;
alt0710 21:d18c2dfaaba4 449 }
alt0710 21:d18c2dfaaba4 450 kicker.setCharge(charge_flag);
alt0710 21:d18c2dfaaba4 451
alt0710 21:d18c2dfaaba4 452 if(InterfaceManager::button.getButtonStatus(CROSS_DOWN))
alt0710 21:d18c2dfaaba4 453 {
alt0710 21:d18c2dfaaba4 454 kick_flag = 1;
alt0710 21:d18c2dfaaba4 455 }
alt0710 21:d18c2dfaaba4 456 else
alt0710 21:d18c2dfaaba4 457 {
alt0710 21:d18c2dfaaba4 458 kick_flag = 0;
alt0710 21:d18c2dfaaba4 459 }
alt0710 21:d18c2dfaaba4 460 kicker.setKick(kick_flag,0,power);
alt0710 21:d18c2dfaaba4 461 kicker.forceFireKick();
alt0710 21:d18c2dfaaba4 462
alt0710 21:d18c2dfaaba4 463 sprintf(str,"C:%dF:%d\nPOWER:%d",charge_flag,StatusManager::charge_end,power);
alt0710 21:d18c2dfaaba4 464 }
alt0710 21:d18c2dfaaba4 465 void OperationCheck::checkChpKick(void)
alt0710 21:d18c2dfaaba4 466 {
alt0710 21:d18c2dfaaba4 467
alt0710 21:d18c2dfaaba4 468 }
alt0710 21:d18c2dfaaba4 469
alt0710 21:d18c2dfaaba4 470 void OperationCheck::resetValue(void)
alt0710 21:d18c2dfaaba4 471 {
alt0710 21:d18c2dfaaba4 472 vel_value = 0;
alt0710 21:d18c2dfaaba4 473 vel_angle = 0;
alt0710 21:d18c2dfaaba4 474 power = 0;
alt0710 21:d18c2dfaaba4 475 charge_flag = 0;
alt0710 21:d18c2dfaaba4 476 kick_flag = 0;
alt0710 21:d18c2dfaaba4 477 }