RobocupSSLのメイン基板白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は,ロボットとボールの座標,審判の判定を元にロボットの移動,キックなどの作戦を決定し,無線によってロボットに指令を送信する.
ロボット機能紹介
●オムニホイールによる方向転換不要の全方位移動
オムニホイールは,自由に回転可能なローラをホイールの外周上に配置した車輪である.ローラの回転により,車輪の回転と垂直の方向に駆動力を発することはできないが移動は可能となる.各車輪の角速度を調整することによって全方向への移動を可能にする.
●ドリブルバーのバックスピンによるボール保持
●電磁力を利用したキッカー
●キッカーの電磁力エネルギーを充電する充電回路
●ロボット情報が一目でわかるLCD
mode/normal_routine/normal_routine.cpp@12:b7d7523733cd, 2017-05-03 (annotated)
- Committer:
- alt0710
- Date:
- Wed May 03 03:35:32 2017 +0000
- Revision:
- 12:b7d7523733cd
- Parent:
- 11:7f5259ad738c
- Child:
- 13:759615b6df1c
- Child:
- 14:f6cc949a8046
dribbler????; I2C?CAN???????ver.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
alt0710 | 6:21b3fbe57b88 | 1 | |
alt0710 | 6:21b3fbe57b88 | 2 | #include "mbed.h" |
alt0710 | 6:21b3fbe57b88 | 3 | #include "comm.h" |
alt0710 | 6:21b3fbe57b88 | 4 | #include "mode.h" |
alt0710 | 6:21b3fbe57b88 | 5 | #include "interface_manager.h" |
alt0710 | 6:21b3fbe57b88 | 6 | #include "status_manager.h" |
alt0710 | 6:21b3fbe57b88 | 7 | #include "parameter_manager.h" |
alt0710 | 6:21b3fbe57b88 | 8 | #include "normal_routine.h" |
alt0710 | 6:21b3fbe57b88 | 9 | |
alt0710 | 6:21b3fbe57b88 | 10 | /* **mbedクラス** */ |
alt0710 | 6:21b3fbe57b88 | 11 | #ifdef LPC4088 |
alt0710 | 6:21b3fbe57b88 | 12 | |
alt0710 | 6:21b3fbe57b88 | 13 | #elif STM32 |
alt0710 | 6:21b3fbe57b88 | 14 | |
alt0710 | 6:21b3fbe57b88 | 15 | #endif |
alt0710 | 6:21b3fbe57b88 | 16 | |
alt0710 | 6:21b3fbe57b88 | 17 | /* **ローカル関数定義** */ |
alt0710 | 6:21b3fbe57b88 | 18 | |
alt0710 | 6:21b3fbe57b88 | 19 | /* **ローカル関数** */ |
alt0710 | 6:21b3fbe57b88 | 20 | |
alt0710 | 6:21b3fbe57b88 | 21 | /* **グルーバル関数** */ |
alt0710 | 6:21b3fbe57b88 | 22 | |
alt0710 | 6:21b3fbe57b88 | 23 | /* **クラス** */ |
alt0710 | 6:21b3fbe57b88 | 24 | class InterfaceManager; |
alt0710 | 7:1f1bdb4e4f33 | 25 | class StatusManager; |
alt0710 | 7:1f1bdb4e4f33 | 26 | class ParameterManager; |
alt0710 | 7:1f1bdb4e4f33 | 27 | |
alt0710 | 6:21b3fbe57b88 | 28 | //メンバ変数の初期化は、定義順(Warningになる) |
alt0710 | 6:21b3fbe57b88 | 29 | NormalRoutine::NormalRoutine() |
alt0710 | 6:21b3fbe57b88 | 30 | { |
alt0710 | 6:21b3fbe57b88 | 31 | } |
alt0710 | 6:21b3fbe57b88 | 32 | |
alt0710 | 6:21b3fbe57b88 | 33 | void NormalRoutine::run(void) |
alt0710 | 6:21b3fbe57b88 | 34 | { |
alt0710 | 7:1f1bdb4e4f33 | 35 | packet.splitPacket(); |
alt0710 | 7:1f1bdb4e4f33 | 36 | |
alt0710 | 7:1f1bdb4e4f33 | 37 | //Kick |
alt0710 | 7:1f1bdb4e4f33 | 38 | kicker.setCharge(ParameterManager::machine_data.charge_flag); |
alt0710 | 7:1f1bdb4e4f33 | 39 | kicker.setKick(ParameterManager::machine_data.kick_flag,ParameterManager::machine_data.kick_type,ParameterManager::machine_data.kickers_power); |
alt0710 | 10:9cd22f673968 | 40 | kicker.forceFireKick(); |
alt0710 | 7:1f1bdb4e4f33 | 41 | |
alt0710 | 7:1f1bdb4e4f33 | 42 | //Wheel |
alt0710 | 12:b7d7523733cd | 43 | //wheel.setVelocity(ParameterManager::machine_data.v_mm_per_sec,ParameterManager::machine_data.angle_degree,ParameterManager::machine_data.vw_mrad_per_sec); |
alt0710 | 12:b7d7523733cd | 44 | wheel.setVelocity(5000,0,0); |
alt0710 | 11:7f5259ad738c | 45 | //Drible |
alt0710 | 12:b7d7523733cd | 46 | dribble.setdribble(1, 2); |
alt0710 | 11:7f5259ad738c | 47 | //dribble.setdribble(ParameterManager::machine_data.dribble_flag, ParameterManager::machine_data.dribbler_power); |
alt0710 | 7:1f1bdb4e4f33 | 48 | |
alt0710 | 12:b7d7523733cd | 49 | //sprintf(str,"V:%d",wheelorder.Mot0Order.Vel_short); |
alt0710 | 7:1f1bdb4e4f33 | 50 | createLcdData(); |
alt0710 | 6:21b3fbe57b88 | 51 | InterfaceManager::i2c.setLCDMsg(str,sizeof(str)); |
alt0710 | 6:21b3fbe57b88 | 52 | |
alt0710 | 6:21b3fbe57b88 | 53 | } |
alt0710 | 6:21b3fbe57b88 | 54 | |
alt0710 | 7:1f1bdb4e4f33 | 55 | void NormalRoutine::createLcdData(void) |
alt0710 | 7:1f1bdb4e4f33 | 56 | { |
alt0710 | 7:1f1bdb4e4f33 | 57 | |
alt0710 | 7:1f1bdb4e4f33 | 58 | /* |
alt0710 | 7:1f1bdb4e4f33 | 59 | |
alt0710 | 7:1f1bdb4e4f33 | 60 | * 0 : 正常終了 |
alt0710 | 7:1f1bdb4e4f33 | 61 | |
alt0710 | 7:1f1bdb4e4f33 | 62 | * -1 : タイムアウト |
alt0710 | 7:1f1bdb4e4f33 | 63 | |
alt0710 | 7:1f1bdb4e4f33 | 64 | * -2 : オーバーランエラー |
alt0710 | 7:1f1bdb4e4f33 | 65 | |
alt0710 | 7:1f1bdb4e4f33 | 66 | * -3 : フレーミングエラー |
alt0710 | 7:1f1bdb4e4f33 | 67 | |
alt0710 | 7:1f1bdb4e4f33 | 68 | * 1 : 受信中 |
alt0710 | 7:1f1bdb4e4f33 | 69 | |
alt0710 | 7:1f1bdb4e4f33 | 70 | * 2 : フレームリーダー1まで受信 |
alt0710 | 7:1f1bdb4e4f33 | 71 | |
alt0710 | 7:1f1bdb4e4f33 | 72 | * 3 : フレームリーダー2まで受信 |
alt0710 | 7:1f1bdb4e4f33 | 73 | |
alt0710 | 7:1f1bdb4e4f33 | 74 | * 4 : マシンIDまで受信 |
alt0710 | 7:1f1bdb4e4f33 | 75 | |
alt0710 | 7:1f1bdb4e4f33 | 76 | */ |
alt0710 | 7:1f1bdb4e4f33 | 77 | switch(StatusManager::uart){ |
alt0710 | 7:1f1bdb4e4f33 | 78 | case 0: |
alt0710 | 8:8bd8d008fe86 | 79 | sprintf(str,"ID%d EN:\nComplete",ParameterManager::machine_id); |
alt0710 | 7:1f1bdb4e4f33 | 80 | sprintf(str_uart,"Complete"); |
alt0710 | 7:1f1bdb4e4f33 | 81 | break; |
alt0710 | 7:1f1bdb4e4f33 | 82 | |
alt0710 | 7:1f1bdb4e4f33 | 83 | case 1: |
alt0710 | 7:1f1bdb4e4f33 | 84 | break; |
alt0710 | 7:1f1bdb4e4f33 | 85 | |
alt0710 | 7:1f1bdb4e4f33 | 86 | case 2: |
alt0710 | 8:8bd8d008fe86 | 87 | sprintf(str,"ID%d EN:\nHeader1",ParameterManager::machine_id); |
alt0710 | 7:1f1bdb4e4f33 | 88 | sprintf(str_uart,"Header1"); |
alt0710 | 7:1f1bdb4e4f33 | 89 | break; |
alt0710 | 6:21b3fbe57b88 | 90 | |
alt0710 | 7:1f1bdb4e4f33 | 91 | case 3: |
alt0710 | 8:8bd8d008fe86 | 92 | sprintf(str,"ID%d EN:\nHeader2",ParameterManager::machine_id); |
alt0710 | 7:1f1bdb4e4f33 | 93 | sprintf(str_uart,"Header2"); |
alt0710 | 7:1f1bdb4e4f33 | 94 | break; |
alt0710 | 7:1f1bdb4e4f33 | 95 | |
alt0710 | 7:1f1bdb4e4f33 | 96 | case 4: |
alt0710 | 9:41d5c728aa78 | 97 | sprintf(str,"ID%d EN:\nCheckER1",ParameterManager::machine_id); |
alt0710 | 7:1f1bdb4e4f33 | 98 | sprintf(str_uart,"CheckERR"); |
alt0710 | 7:1f1bdb4e4f33 | 99 | break; |
alt0710 | 7:1f1bdb4e4f33 | 100 | |
alt0710 | 7:1f1bdb4e4f33 | 101 | case 5: |
alt0710 | 9:41d5c728aa78 | 102 | sprintf(str,"ID%d EN:\nCheckER2",ParameterManager::machine_id); |
alt0710 | 7:1f1bdb4e4f33 | 103 | sprintf(str_uart,"CheckERR"); |
alt0710 | 7:1f1bdb4e4f33 | 104 | break; |
alt0710 | 7:1f1bdb4e4f33 | 105 | |
alt0710 | 7:1f1bdb4e4f33 | 106 | case -1: |
alt0710 | 8:8bd8d008fe86 | 107 | sprintf(str,"ID%d EN:\nTimeOut",ParameterManager::machine_id); |
alt0710 | 7:1f1bdb4e4f33 | 108 | sprintf(str_uart,"TimeOut"); |
alt0710 | 7:1f1bdb4e4f33 | 109 | break; |
alt0710 | 7:1f1bdb4e4f33 | 110 | |
alt0710 | 7:1f1bdb4e4f33 | 111 | case -2: |
alt0710 | 8:8bd8d008fe86 | 112 | sprintf(str,"ID%d EN:\nOERR",ParameterManager::machine_id); |
alt0710 | 7:1f1bdb4e4f33 | 113 | sprintf(str_uart,"OERR"); |
alt0710 | 7:1f1bdb4e4f33 | 114 | break; |
alt0710 | 7:1f1bdb4e4f33 | 115 | |
alt0710 | 7:1f1bdb4e4f33 | 116 | case -3: |
alt0710 | 8:8bd8d008fe86 | 117 | sprintf(str,"ID%d EN:\nFERR",ParameterManager::machine_id); |
alt0710 | 7:1f1bdb4e4f33 | 118 | sprintf(str_uart,"FERR"); |
alt0710 | 7:1f1bdb4e4f33 | 119 | break; |
alt0710 | 7:1f1bdb4e4f33 | 120 | |
alt0710 | 7:1f1bdb4e4f33 | 121 | default: |
alt0710 | 7:1f1bdb4e4f33 | 122 | sprintf(str,"ID%d EN: \n %d",ParameterManager::machine_id, StatusManager::uart); |
alt0710 | 7:1f1bdb4e4f33 | 123 | break; |
alt0710 | 7:1f1bdb4e4f33 | 124 | } |
alt0710 | 7:1f1bdb4e4f33 | 125 | |
alt0710 | 7:1f1bdb4e4f33 | 126 | |
alt0710 | 7:1f1bdb4e4f33 | 127 | //sprintf(str,"ID%d EN: \n %s",ParameterManager::machine_id ,str_uart); |
alt0710 | 7:1f1bdb4e4f33 | 128 | } |