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
comm/parameter/kick_power/kick_power.cpp@25:15f75825fc36, 2018-04-29 (annotated)
- Committer:
- alt0710
- Date:
- Sun Apr 29 08:51:32 2018 +0000
- Revision:
- 25:15f75825fc36
- Parent:
- 10:9cd22f673968
????????;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
alt0710 | 3:6f87cbec2ae8 | 1 | |
alt0710 | 3:6f87cbec2ae8 | 2 | #include "mbed.h" |
alt0710 | 3:6f87cbec2ae8 | 3 | #include "comm.h" |
alt0710 | 3:6f87cbec2ae8 | 4 | #include "interface_manager.h" |
alt0710 | 3:6f87cbec2ae8 | 5 | #include "parameter_manager.h" |
alt0710 | 3:6f87cbec2ae8 | 6 | #include "kick_power.h" |
alt0710 | 3:6f87cbec2ae8 | 7 | |
alt0710 | 3:6f87cbec2ae8 | 8 | /* **mbedクラス** */ |
alt0710 | 3:6f87cbec2ae8 | 9 | #ifdef LPC4088 |
alt0710 | 3:6f87cbec2ae8 | 10 | |
alt0710 | 3:6f87cbec2ae8 | 11 | #elif STM32 |
alt0710 | 3:6f87cbec2ae8 | 12 | |
alt0710 | 3:6f87cbec2ae8 | 13 | #endif |
alt0710 | 3:6f87cbec2ae8 | 14 | |
alt0710 | 3:6f87cbec2ae8 | 15 | /* **ローカル関数定義** */ |
alt0710 | 3:6f87cbec2ae8 | 16 | |
alt0710 | 3:6f87cbec2ae8 | 17 | /* **ローカル関数** */ |
alt0710 | 3:6f87cbec2ae8 | 18 | |
alt0710 | 3:6f87cbec2ae8 | 19 | /* **グルーバル関数** */ |
alt0710 | 3:6f87cbec2ae8 | 20 | |
alt0710 | 3:6f87cbec2ae8 | 21 | /* **クラス** */ |
alt0710 | 3:6f87cbec2ae8 | 22 | //メンバ変数の初期化は、定義順(Warningになる) |
alt0710 | 3:6f87cbec2ae8 | 23 | Kick_Power::Kick_Power() |
alt0710 | 25:15f75825fc36 | 24 | :ZERO_POINT_FIVE_METER_PAR_SEC_(0.0005), |
alt0710 | 25:15f75825fc36 | 25 | ONE_METER_PAR_SEC_(0.001), |
alt0710 | 25:15f75825fc36 | 26 | ONE_POINT_FIVE_METER_PAR_SEC_(0.002), |
alt0710 | 25:15f75825fc36 | 27 | TWO_METER_PAR_SEC_(0.003), |
alt0710 | 25:15f75825fc36 | 28 | TWO_POINT_FIVE_METER_PAR_SEC_(0.004), |
alt0710 | 25:15f75825fc36 | 29 | THREE_METER_PAR_SEC_(0.005), |
alt0710 | 25:15f75825fc36 | 30 | THREE_POINT_FIVE_METER_PAR_SEC_(0.006), |
alt0710 | 25:15f75825fc36 | 31 | FOUR_METER_PAR_SEC_(0.007), |
alt0710 | 25:15f75825fc36 | 32 | FOUR_POINT_FIVE_METER_PAR_SEC_(0.008), |
alt0710 | 25:15f75825fc36 | 33 | FIVE_METER_PAR_SEC_(0.009), |
alt0710 | 25:15f75825fc36 | 34 | FIVE_POINT_FIVE_METER_PAR_SEC_(0.010), |
alt0710 | 25:15f75825fc36 | 35 | SIX_METER_PAR_SEC_(0.011), |
alt0710 | 25:15f75825fc36 | 36 | SIX_POINT_FIVE_METER_PAR_SEC_(0.012), |
alt0710 | 25:15f75825fc36 | 37 | SEVEN_METER_PAR_SEC_(0.013), |
alt0710 | 25:15f75825fc36 | 38 | SEVEN_POINT_FIVE_METER_PAR_SEC_(0.014), |
alt0710 | 25:15f75825fc36 | 39 | EIGHT_METER_PAR_SEC_(0.015), |
alt0710 | 25:15f75825fc36 | 40 | ZERO_POINT_FIVE_METER_(0.0005), |
alt0710 | 25:15f75825fc36 | 41 | ONE_METER_(0.001), |
alt0710 | 25:15f75825fc36 | 42 | ONE_POINT_FIVE_METER_(0.002), |
alt0710 | 25:15f75825fc36 | 43 | TWO_METER_(0.003), |
alt0710 | 25:15f75825fc36 | 44 | TWO_POINT_FIVE_METER_(0.004), |
alt0710 | 25:15f75825fc36 | 45 | THREE_METER_(0.005), |
alt0710 | 25:15f75825fc36 | 46 | THREE_POINT_FIVE_METER_(0.006), |
alt0710 | 25:15f75825fc36 | 47 | FOUR_METER_(0.007), |
alt0710 | 25:15f75825fc36 | 48 | FOUR_POINT_FIVE_METER_(0.008), |
alt0710 | 25:15f75825fc36 | 49 | FIVE_METER_(0.009), |
alt0710 | 25:15f75825fc36 | 50 | FIVE_POINT_FIVE_METER_(0.010), |
alt0710 | 25:15f75825fc36 | 51 | SIX_METER_(0.011), |
alt0710 | 25:15f75825fc36 | 52 | SIX_POINT_FIVE_METER_(0.012), |
alt0710 | 25:15f75825fc36 | 53 | SEVEN_METER_(0.013), |
alt0710 | 25:15f75825fc36 | 54 | SEVEN_POINT_FIVE_METER_(0.014), |
alt0710 | 25:15f75825fc36 | 55 | EIGHT_METER_(0.015), |
alt0710 | 25:15f75825fc36 | 56 | PERIOD_OF_FORCE_FIRE_(0.005) |
alt0710 | 3:6f87cbec2ae8 | 57 | { |
alt0710 | 3:6f87cbec2ae8 | 58 | } |
alt0710 | 3:6f87cbec2ae8 | 59 | |
alt0710 | 3:6f87cbec2ae8 | 60 | |
alt0710 | 3:6f87cbec2ae8 | 61 | double Kick_Power::getStraightPowerTime(char power) |
alt0710 | 3:6f87cbec2ae8 | 62 | { |
alt0710 | 3:6f87cbec2ae8 | 63 | switch(power){ |
alt0710 | 3:6f87cbec2ae8 | 64 | case 0: |
alt0710 | 3:6f87cbec2ae8 | 65 | return ZERO_POINT_FIVE_METER_PAR_SEC_; |
alt0710 | 3:6f87cbec2ae8 | 66 | |
alt0710 | 3:6f87cbec2ae8 | 67 | |
alt0710 | 3:6f87cbec2ae8 | 68 | case 1: |
alt0710 | 3:6f87cbec2ae8 | 69 | return ONE_METER_PAR_SEC_; |
alt0710 | 3:6f87cbec2ae8 | 70 | |
alt0710 | 3:6f87cbec2ae8 | 71 | |
alt0710 | 3:6f87cbec2ae8 | 72 | case 2: |
alt0710 | 3:6f87cbec2ae8 | 73 | return ONE_POINT_FIVE_METER_PAR_SEC_; |
alt0710 | 3:6f87cbec2ae8 | 74 | |
alt0710 | 3:6f87cbec2ae8 | 75 | |
alt0710 | 3:6f87cbec2ae8 | 76 | case 3: |
alt0710 | 3:6f87cbec2ae8 | 77 | return TWO_METER_PAR_SEC_; |
alt0710 | 3:6f87cbec2ae8 | 78 | |
alt0710 | 3:6f87cbec2ae8 | 79 | |
alt0710 | 3:6f87cbec2ae8 | 80 | case 4: |
alt0710 | 3:6f87cbec2ae8 | 81 | return TWO_POINT_FIVE_METER_PAR_SEC_; |
alt0710 | 3:6f87cbec2ae8 | 82 | |
alt0710 | 3:6f87cbec2ae8 | 83 | |
alt0710 | 3:6f87cbec2ae8 | 84 | case 5: |
alt0710 | 3:6f87cbec2ae8 | 85 | return THREE_METER_PAR_SEC_; |
alt0710 | 3:6f87cbec2ae8 | 86 | |
alt0710 | 3:6f87cbec2ae8 | 87 | |
alt0710 | 3:6f87cbec2ae8 | 88 | case 6: |
alt0710 | 3:6f87cbec2ae8 | 89 | return THREE_POINT_FIVE_METER_PAR_SEC_; |
alt0710 | 3:6f87cbec2ae8 | 90 | |
alt0710 | 3:6f87cbec2ae8 | 91 | |
alt0710 | 3:6f87cbec2ae8 | 92 | case 7: |
alt0710 | 3:6f87cbec2ae8 | 93 | return FOUR_METER_PAR_SEC_; |
alt0710 | 3:6f87cbec2ae8 | 94 | |
alt0710 | 3:6f87cbec2ae8 | 95 | |
alt0710 | 3:6f87cbec2ae8 | 96 | case 8: |
alt0710 | 3:6f87cbec2ae8 | 97 | return FOUR_POINT_FIVE_METER_PAR_SEC_; |
alt0710 | 3:6f87cbec2ae8 | 98 | |
alt0710 | 3:6f87cbec2ae8 | 99 | |
alt0710 | 3:6f87cbec2ae8 | 100 | case 9: |
alt0710 | 3:6f87cbec2ae8 | 101 | return FIVE_METER_PAR_SEC_; |
alt0710 | 3:6f87cbec2ae8 | 102 | |
alt0710 | 3:6f87cbec2ae8 | 103 | |
alt0710 | 3:6f87cbec2ae8 | 104 | case 10: |
alt0710 | 3:6f87cbec2ae8 | 105 | return FIVE_POINT_FIVE_METER_PAR_SEC_; |
alt0710 | 3:6f87cbec2ae8 | 106 | |
alt0710 | 3:6f87cbec2ae8 | 107 | |
alt0710 | 3:6f87cbec2ae8 | 108 | case 11: |
alt0710 | 3:6f87cbec2ae8 | 109 | return SIX_METER_PAR_SEC_; |
alt0710 | 3:6f87cbec2ae8 | 110 | |
alt0710 | 3:6f87cbec2ae8 | 111 | |
alt0710 | 3:6f87cbec2ae8 | 112 | case 12: |
alt0710 | 3:6f87cbec2ae8 | 113 | return SIX_POINT_FIVE_METER_PAR_SEC_; |
alt0710 | 3:6f87cbec2ae8 | 114 | |
alt0710 | 3:6f87cbec2ae8 | 115 | |
alt0710 | 3:6f87cbec2ae8 | 116 | case 13: |
alt0710 | 3:6f87cbec2ae8 | 117 | return SEVEN_METER_PAR_SEC_; |
alt0710 | 3:6f87cbec2ae8 | 118 | |
alt0710 | 3:6f87cbec2ae8 | 119 | |
alt0710 | 3:6f87cbec2ae8 | 120 | case 14: |
alt0710 | 3:6f87cbec2ae8 | 121 | return SEVEN_POINT_FIVE_METER_PAR_SEC_; |
alt0710 | 3:6f87cbec2ae8 | 122 | |
alt0710 | 3:6f87cbec2ae8 | 123 | |
alt0710 | 3:6f87cbec2ae8 | 124 | case 15: |
alt0710 | 3:6f87cbec2ae8 | 125 | return EIGHT_METER_PAR_SEC_; |
alt0710 | 3:6f87cbec2ae8 | 126 | |
alt0710 | 3:6f87cbec2ae8 | 127 | |
alt0710 | 3:6f87cbec2ae8 | 128 | default: |
alt0710 | 3:6f87cbec2ae8 | 129 | return PERIOD_OF_FORCE_FIRE_; |
alt0710 | 3:6f87cbec2ae8 | 130 | |
alt0710 | 3:6f87cbec2ae8 | 131 | } |
alt0710 | 3:6f87cbec2ae8 | 132 | |
alt0710 | 3:6f87cbec2ae8 | 133 | } |
alt0710 | 3:6f87cbec2ae8 | 134 | double Kick_Power::getChipPowerTime(char power) |
alt0710 | 3:6f87cbec2ae8 | 135 | { |
alt0710 | 3:6f87cbec2ae8 | 136 | switch(power){ |
alt0710 | 3:6f87cbec2ae8 | 137 | case 0: |
alt0710 | 3:6f87cbec2ae8 | 138 | return ZERO_POINT_FIVE_METER_PAR_SEC_; |
alt0710 | 3:6f87cbec2ae8 | 139 | |
alt0710 | 3:6f87cbec2ae8 | 140 | |
alt0710 | 3:6f87cbec2ae8 | 141 | case 1: |
alt0710 | 3:6f87cbec2ae8 | 142 | return ONE_METER_PAR_SEC_; |
alt0710 | 3:6f87cbec2ae8 | 143 | |
alt0710 | 3:6f87cbec2ae8 | 144 | |
alt0710 | 3:6f87cbec2ae8 | 145 | case 2: |
alt0710 | 3:6f87cbec2ae8 | 146 | return ONE_POINT_FIVE_METER_PAR_SEC_; |
alt0710 | 3:6f87cbec2ae8 | 147 | |
alt0710 | 3:6f87cbec2ae8 | 148 | |
alt0710 | 3:6f87cbec2ae8 | 149 | case 3: |
alt0710 | 3:6f87cbec2ae8 | 150 | return TWO_METER_PAR_SEC_; |
alt0710 | 3:6f87cbec2ae8 | 151 | |
alt0710 | 3:6f87cbec2ae8 | 152 | |
alt0710 | 3:6f87cbec2ae8 | 153 | case 4: |
alt0710 | 3:6f87cbec2ae8 | 154 | return TWO_POINT_FIVE_METER_PAR_SEC_; |
alt0710 | 3:6f87cbec2ae8 | 155 | |
alt0710 | 3:6f87cbec2ae8 | 156 | |
alt0710 | 3:6f87cbec2ae8 | 157 | case 5: |
alt0710 | 3:6f87cbec2ae8 | 158 | return THREE_METER_PAR_SEC_; |
alt0710 | 3:6f87cbec2ae8 | 159 | |
alt0710 | 3:6f87cbec2ae8 | 160 | |
alt0710 | 3:6f87cbec2ae8 | 161 | case 6: |
alt0710 | 3:6f87cbec2ae8 | 162 | return THREE_POINT_FIVE_METER_PAR_SEC_; |
alt0710 | 3:6f87cbec2ae8 | 163 | |
alt0710 | 3:6f87cbec2ae8 | 164 | |
alt0710 | 3:6f87cbec2ae8 | 165 | case 7: |
alt0710 | 3:6f87cbec2ae8 | 166 | return FOUR_METER_PAR_SEC_; |
alt0710 | 3:6f87cbec2ae8 | 167 | |
alt0710 | 3:6f87cbec2ae8 | 168 | |
alt0710 | 3:6f87cbec2ae8 | 169 | case 8: |
alt0710 | 3:6f87cbec2ae8 | 170 | return FOUR_POINT_FIVE_METER_PAR_SEC_; |
alt0710 | 3:6f87cbec2ae8 | 171 | |
alt0710 | 3:6f87cbec2ae8 | 172 | |
alt0710 | 3:6f87cbec2ae8 | 173 | case 9: |
alt0710 | 3:6f87cbec2ae8 | 174 | return FIVE_METER_PAR_SEC_; |
alt0710 | 3:6f87cbec2ae8 | 175 | |
alt0710 | 3:6f87cbec2ae8 | 176 | |
alt0710 | 3:6f87cbec2ae8 | 177 | case 10: |
alt0710 | 3:6f87cbec2ae8 | 178 | return FIVE_POINT_FIVE_METER_PAR_SEC_; |
alt0710 | 3:6f87cbec2ae8 | 179 | |
alt0710 | 3:6f87cbec2ae8 | 180 | |
alt0710 | 3:6f87cbec2ae8 | 181 | case 11: |
alt0710 | 3:6f87cbec2ae8 | 182 | return SIX_METER_PAR_SEC_; |
alt0710 | 3:6f87cbec2ae8 | 183 | |
alt0710 | 3:6f87cbec2ae8 | 184 | |
alt0710 | 3:6f87cbec2ae8 | 185 | case 12: |
alt0710 | 3:6f87cbec2ae8 | 186 | return SIX_POINT_FIVE_METER_PAR_SEC_; |
alt0710 | 3:6f87cbec2ae8 | 187 | |
alt0710 | 3:6f87cbec2ae8 | 188 | |
alt0710 | 3:6f87cbec2ae8 | 189 | case 13: |
alt0710 | 3:6f87cbec2ae8 | 190 | return SEVEN_METER_PAR_SEC_; |
alt0710 | 3:6f87cbec2ae8 | 191 | |
alt0710 | 3:6f87cbec2ae8 | 192 | |
alt0710 | 3:6f87cbec2ae8 | 193 | case 14: |
alt0710 | 3:6f87cbec2ae8 | 194 | return SEVEN_POINT_FIVE_METER_PAR_SEC_; |
alt0710 | 3:6f87cbec2ae8 | 195 | |
alt0710 | 3:6f87cbec2ae8 | 196 | |
alt0710 | 3:6f87cbec2ae8 | 197 | case 15: |
alt0710 | 3:6f87cbec2ae8 | 198 | return EIGHT_METER_PAR_SEC_; |
alt0710 | 3:6f87cbec2ae8 | 199 | |
alt0710 | 3:6f87cbec2ae8 | 200 | |
alt0710 | 3:6f87cbec2ae8 | 201 | default: |
alt0710 | 3:6f87cbec2ae8 | 202 | return PERIOD_OF_FORCE_FIRE_; |
alt0710 | 3:6f87cbec2ae8 | 203 | |
alt0710 | 3:6f87cbec2ae8 | 204 | } |
alt0710 | 3:6f87cbec2ae8 | 205 | |
alt0710 | 3:6f87cbec2ae8 | 206 | } |