#contents
*ロボコンの説明 [#pf7397c5]
[[2006a/ロボコン]]に乗ってます!
*プログラム [#k803efe2]
ロボットを二台使用する事にして、缶を取ってくるロボット(α)と缶を受け取りゴールするロボット(β)を作りました。
**試作1(タッチセンサーとタイマーを使用) [#c8707704]
***(α)号 [#fad48422]
 #define  turn_right OnFwd(OUT_A);OnRev(OUT_C);
 #define  turn_left OnRev(OUT_A);OnFwd(OUT_C);
 #define  go  OnFwd(OUT_A+OUT_C);
 #define  back OnRev(OUT_A+OUT_C);
 #define  stop_turn Off(OUT_A+OUT_C);
 
 task main ()
 {
  SetSensor(SENSOR_1,SENSOR_TOUCH);
  
  ClearTimer(0); 
  
  go;
  until (SENSOR_1==1)
  back;
  Wait(FastTimer(0)/2);
  
  turn_right;
  Wait(120);
  
  ClearTimer(0);
  
  go;
  until (SENSOR_1==1)
  back;
  Wait(FastTimer(0)/4);
  
  turn_right;
  Wait(120);
  go;
  until(SENSOR_1==1);
  
  back;
  Wait(50);
  turn_right;
  Wait(250);
  stop_turn;
  Wait(30);
  
  back;
  Wait(50);
  OnRev(OUT_B);
  Wait(17);
  
  ClearTimer(0);
  
  go;
  until(SENSOR_1==1);
  back;
  Wait(FastTimer(0)/2);
  
  turn_left;
  Wait(120);
  
  ClearTimer(0);
  
  go;
  until(SENSOR_1==1);
  back;
  Wait(FastTimer(0)/4);
  
  turn_right;
  Wait(250);
  back;
  Wait(30);
  
  Off(OUT_A+OUT_C);
  OnFwd(OUT_B);
  Wait(17);
  back;
  Wait(30);
  Off(OUT_A+OUT_C);
  }

***(β)号 [#r7644b5c]
 #define  turn_right OnFwd(OUT_A);OnRev(OUT_C);
 #define  turn_left OnRev(OUT_A);OnFwd(OUT_C);
 #define  go  OnFwd(OUT_A+OUT_C);
 #define  back OnRev(OUT_A+OUT_C);
 #define  stop_turn Off(OUT_A+OUT_C);
 
 task main ()
 {
  SetSensor(SENSOR_1,SENSOR_TOUCH);
  
  repeat(2){
  until(SENSOR_1==1);
  back;
  Wait(50);
  turn_right;
  Wait(250);
  stop_turn;
  Wait(30);
  back;
  Wait(50);
  OnFwd(OUT_B);
  Wait(17);
  
  ClearTimer(0);
  
  go;
  until (SENSOR_1==1);
  back;
  Wait(FastTimer(0)/2);
  
  turn_left;
  Wait(120);
  
  ClearTimer(0);
  
  go;
  until (SENSOR_1==1);
  back;
  Wait(FastTimer(0)/4);
  
  turn_right;
  Wait(120);
  Off(OUT_A+OUT_C);
  Wait(30);
  OnRev(OUT_B);
  Wait(17);
  
  back;
  Wait(70);
  Off(OUT_A+OUT_C);
  
  ClearTimer(0);
  
  go;
  until(SENSOR_1==1);
  back
  Wait(FastTimer(0)/2);
  
  turn_right;
  Wait(120);
  
  ClearTimer(0);
  
  go;
  until (SENSOR_1==1)
  back;
  Wait(FastTimer(0)/4);
  
  turn_right;
  Wait(120);
  go;
  Wait(90);
  }
 }

***試作1のプログラムの問題点 [#a1a5e90c]
-真っすぐに進む保障がない
-障害物に当たった時の解決能力が皆無


上のプログラムは試作なのでこれから改良していきます!!
**試作2 (光センサーを使用) [#r36ef13c]
***α号 [#g775a526]
[[2006a/B4/プログラムα]]
***β号 [#p6fed1b7]
[[2006a/B4/プログラムβ]]
*ロボット [#zeeab6b9]
*感想 [#d8de491b]
*コメントお願いします [#b455e8b1]
#comment


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS