青と赤のボールを運搬して、空き缶の上に載せる。
外側のアームで缶をホールドし引き寄せ、内側のプロペラで車内にボールを格納する/ボールを車内から出す。
#define r2 OnFwd(OUT_B,40);OnFwd(OUT_C,-40); #define r1 OnFwd(OUT_B); #define go_fwd OnFwd(OUT_BC,40); #define l1 OnFwd(OUT_C,40); #define l2 OnFwd(OUT_B,-40);OnFwd(OUT_C,40); #define go_back OnFwd(OUT_BC,-40); #define kaishu; #define noseru; #define CONN 1;
void follow_line { SetSensorLight(S3); SetSensorLowspeed(S4); long t0=CurrentTick(); While(CurrentTick()-t0<150){ if(SENSOR_4<=6){Off(OUT_BC);breake;} if(SENSOR_3<32){l2; t0=CurrentTick()} else if(SENSOR_3<36){l1; t0=CurrentTick()} else if(SENSOR_3<40){go_fwd; t0=CurrentTick()} else if(SENSOR_3<48){r1; t0=CurrentTick()} else{r2; t0=CurrentTick()} } Off(OUT_BC); }
task main(){ follow_line; SendRemoteNumber(CONN,MAILBOX1,kaishu); Wait(20000); go_back; Wait(1000); r1; wait(1500); follow_line; go_fwd; Wait(4800); l2; Wait(400); SendRemoteNumber(CONN,MAILBOX1,kaishu); Wait(20000); r1; Wait(400); follow_line; SendRemoteNumber(CONN,MAILBOX1,kaishu); Wait(20000); follow_line; l2; Wait(400); follow_line; go_fwd; Wait(400); follow_line; l2; Wait(400); follow_line; /HからH' r2; Wait(400); follow_line; r2; Wait(400); go_fwd; Wait(3000); l2; Wait(500); SendRemoteNumber(CONN,MAILBOX1,noseru); Wait(20000); r2; Wait(400); follow_line; SendRemoteNumber(CONN,MAILBOX1,noseru); Wait(20000); follow_line; go_fwd; Wait(400); follow_line; SendRemoteNumber(CONN,MAILBOX1,noseru); Wait(20000); go_back; Wait(300); follow_line; go_fwd; Wait(400); follow_line; }
#define speed 15; #define kaishu; #define noseru; #define tsukamu OnFwd(OUT_B,speed);Wait(7000);Off(OUT_B); #define hanasu OnRev(OUT_B,speed);Wait(7000);Off(OUT_B); #define arm_up OnFwd(OUT_C,speed);Wait(3800);Off(OUT_C); #define arm_down OnRev(OUT_C,speed);Wait(3800);Off(OUT_C);
task_main() { int msg; while(true){ if(msg==kaishu){ arm_down; tsukamu; arm_up; } if(msg==noseru){ arm_down; hanasu; arm_up; } } }
なぜか、書いたプログラムをロボットに送信できないという悲劇的なことがおこった。試せなかったのは極めてふがいないですが、この授業で学んだことを他の授業で生かせたりできたのでよかった。同じチームの中村君に大いに感謝します。