[[2019a/Member]]

#contents

*課題について [#m624d2bd]
**課題の内容 [#rcb820a6]
**コースの内容 [#ud1ef437]
*ロボットの構造について [#rbaf5e80]
**ロボットの全体の構造 [#l5b28cc4]
**アームの構造 [#r82de299]
*プログラムについて [#ieeb1338]
**地面に落ちているボール担当 [#m457ca2f]
 #define MOVE_TIME 250
 #define SPEED_H 35
 #define SPEED_L 20
 #define OnRL(speedR,speedL) OnFwd(OUT_B,speedR);OnFwd(OUT_C,speedL);
 #define go_straight OnRL(SPEED_H,SPEED_H);
 #define rot_r OnRL(-SPEED_L,SPEED_L);
 #define turn_r OnRL(0,SPEED_L);
 #define rot_l OnRL(SPEED_L,-SPEED_L);
 #define turn_l OnRL(SPEED_L,0);
 #define B1 43
 #define G 53
 #define W1 59
 #define W2 61
 #define BACK OnRL(-SPEED_H,-SPEED_H);
 sub follow_line_l()
 {
     SetSensorLight(S2);
     long t0=CurrentTick();
     while(CurrentTick()-t0<MOVE_TIME){
         if(SENSOR_2>W1){
             rot_r;t0=CurrentTick();
         }
         else if(SENSOR_2>W2){
             turn_r;t0=CurrentTick();
         }
         else if(SENSOR_2>G){
             go_straight;t0=CurrentTick();
         }
         else if(SENSOR_2>B1){
             turn_l;t0=CurrentTick();
         }
         else{
             rot_l;
         }
     }
 }
 sub follow_line_r()
 {
     SetSensorLight(S2);
     long t0=CurrentTick();
     while(CurrentTick()-t0<MOVE_TIME){
         if(SENSOR_2>W1){
             rot_l;t0=CurrentTick();
         }
         else if(SENSOR_2>W2){
             turn_l;t0=CurrentTick();
         }
         else if(SENSOR_2>G){
             go_straight;t0=CurrentTick();
         }
         else if(SENSOR_2>B1){
             turn_r;t0=CurrentTick();
         }
         else{
             rot_r;
         }
     }
 }
 sub short_break()
 {
     Off(OUT_BC);
     Wait(1000);
 }
 sub arm_down()
 {
     OnFwd(OUT_A,70);
     Wait(600);
     Off(OUT_A);
     Wait(500);
     OnRev(OUT_A,50);
     Wait(500);
     Off(OUT_A);
 }
 sub shoot()
 {
     OnRev(OUT_A,60);
     Wait(700);
     Off(OUT_A);
     OnFwd(OUT_A,55);
     Wait(500);
     Off(OUT_A);
 } 
 sub back(long t)
 {
     BACK;
     Wait(t);
     Off(OUT_BC);
 }
 task main()
 {
     Off(OUT_A);
     go_straight;
     Wait(1000);
     Off(OUT_BC);
     follow_line_l();
     short_break();
     rot_r;
     Wait(400);
     Off(OUT_BC);
     go_straight;
     Wait(800);
     Off(OUT_BC);
     arm_down();
     turn_r;
     Wait(3500);
     Off(OUT_BC);
     shoot();
     Wait(1000);
     rot_r;
     Wait(3900);
     Off(OUT_BC);
     go_straight;
     Wait(6600);
     Off(OUT_BC);
     rot_l;
     Wait(600);
     Off(OUT_BC);
     arm_down();
     back(3000);
     OnRL(0,-SPEED_L);
     Wait(300);
     Off(OUT_BC);
     shoot();
 }
**箱の中のボール担当 [#m32be704]
 #define MOVE_TIME 250
 #define SPEED_H 35
 #define SPEED_L 20
 #define OnRL(speedR,speedL) OnFwd(OUT_B,speedR);OnFwd(OUT_C,speedL);
 #define go_straight OnRL(SPEED_H,SPEED_H);
 #define rot_r OnRL(-SPEED_L,SPEED_L);
 #define turn_r OnRL(0,SPEED_L);
 #define rot_l OnRL(SPEED_L,-SPEED_L);
 #define turn_l OnRL(SPEED_L,0);
 #define B1 43
 #define G 53
 #define W1 59
 #define W2 61
 #define BACK OnRL(-SPEED_H,-SPEED_H);
 sub follow_line_l()
 {
     SetSensorLight(S2);
     long t0=CurrentTick();
     while(CurrentTick()-t0<MOVE_TIME){
         if(SENSOR_2>W1){
             rot_r;t0=CurrentTick();
         }
         else if(SENSOR_2>W2){
             turn_r;t0=CurrentTick();
         }
         else if(SENSOR_2>G){
             go_straight;t0=CurrentTick();
         }
         else if(SENSOR_2>B1){
             turn_l;t0=CurrentTick();
         }
         else{
             rot_l;
         }
     }
 }
 sub follow_line_r()
 {
     SetSensorLight(S2);
     long t0=CurrentTick();
     while(CurrentTick()-t0<MOVE_TIME){
         if(SENSOR_2>W1){
             rot_l;t0=CurrentTick();
         }
         else if(SENSOR_2>W2){
             turn_l;t0=CurrentTick();
         }
         else if(SENSOR_2>G){
             go_straight;t0=CurrentTick();
         }
         else if(SENSOR_2>B1){
             turn_r;t0=CurrentTick();
         }
         else{
             rot_r;
         }
     }
 }
 sub cross_line_1()
 {
     while(SENSOR_2<W1){
         go_straight;
     }
     while(SENSOR_2>G){
         turn_l;
     }
     Off(OUT_BC);
 }  
 sub cross_line_2()
 { 
     while(SENSOR_2<W1){
         go_straight;
     }
     while(SENSOR_2>G){
         rot_l;
     }
     Off(OUT_BC);
 }  
 sub short_break()
 {
     Off(OUT_BC);
     Wait(1000);
 }
 sub arm_down()
 {
     OnFwd(OUT_A,50);
     Wait(500);
     Off(OUT_A);
     Wait(500);
     OnRev(OUT_A,50);
     Wait(500);
     Off(OUT_A);
 }
 sub shoot()
 {
     OnRev(OUT_A,60);
     Wait(600);
     Off(OUT_A);
     OnFwd(OUT_A,90);
     Wait(800);
     Off(OUT_A);
 }
 sub back(long t)
 {
     BACK;
     Wait(t);
 }
 task main()
 {
     go_straight;
     Wait(1000);
     Off(OUT_BC);
     rot_l;
     Wait(2800);
     Off(OUT_BC);
     go_straight;
     Wait(3000);
     Off(OUT_BC);
     rot_l;
     Wait(4500);
     Off(OUT_BC);
     go_straight;
     Wait(3000);
     turn_l;
     Wait(8700);
     Off(OUT_BC);
     Wait(27000);
     OnFwd(OUT_A,50);
     Wait(700);
     OnRev(OUT_BC,60);
     Wait(700);
     Off(OUT_BC);
     shoot();
 }
*考察 [#gfcdbe77]
**ロボットについて [#rfb65cf8]
**プログラムについて [#h41669d2]
**感想 [#nb656577]


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