#author("2020-02-14T12:30:24+09:00","ameame","ameame")
#author("2020-02-14T12:32:19+09:00","ameame","ameame")
[[2019b/Member]]
#contents
*²ÝÂê3 ¥Ü¡¼¥ë±¿¤Ó [#d6beec22]
¥³¡¼¥¹¤ä¥ë¡¼¥ë¤Ï[[¤³¤Á¤é¤Î¥Ú¡¼¥¸>2019b/Mission3]]¤Ë¤¢¤ë¡¥~
4¿Í¤Ç1¤Ä¤Î²ÝÂê¤ËÄ©¤ó¤À¡¥¥°¥ë¡¼¥×¤Ï3N4N¤Ç¤¢¤ë¡¥
*À®²Ì [#z4b650fd]
´ðÁÃÅÀ0ÅÀ¡¤µ»½ÑÅÀ¤ÎÊ¿¶Ñ14ÅÀ¤Ç¹ç·×ÅÀ14ÅÀ¤Ç¤¢¤ê¡¤½ç°Ì¤Ï3°Ì¤Ç¤¢¤Ã¤¿¡¥
*¥í¥Ü¥Ã¥È¤Ë¤Ä¤¤¤Æ [#r7c8b892]
£²¤Ä¤Î¥í¥Ü¥Ã¥È¤òºî¤Ã¤¿¡¥
**¥í¥Ü¥Ã¥È­¡ [#k0543428]
#ref(3-¥í¥Ü1.jpeg)
¥Ü¡¼¥ë¤ò´Ì¤´¤È¥³¡¼¥¹¤Î¿¿¤óÃæ¤Þ¤Ç±¿¤ó¤Ç¤¯¤ë¥í¥Ü¥Ã¥È¡¥¥â¡¼¥¿¡¼3¤Ä¤È¸÷¥»¥ó¥µ¤¬¤Ä¤¤¤Æ¤¤¤ë¡¥2¤Ä¤Î¥â¡¼¥¿¡¼¤Ç¥¿¥¤¥ä¤ò²ó¤·¡¤¤â¤¦1¤Ä¤Ï¥¢¡¼¥à¤òư¤«¤¹¡¥¥¢¡¼¥à¤Ï350ml¤Î¥¢¥ë¥ß´Ì¤¬3¤ÄÆþ¤ëŤµ¤Ë¤Ê¤Ã¤Æ¤¤¤ë¡¥¥¢¡¼¥à¤Ï2ËܤÎËÀ¤¬Ê¿¹Ô¤Ë¤Ä¤±¤é¤ì¤Æ¤ª¤êÊÒ¦¤ÎËÀ¤¬¥í¥Ü¥Ã¥È¦¤Îü¤òÃæ¿´¤Ë¤·¤Æ²óž¤·¾å¤Ë¾å¤¬¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤ë¡¥´Ì¤ò½¸¤á¤ëºÝ»þ·×²ó¤ê¤Ç½¸¤á¤ë¤¿¤á¾å¤²¤ëËÀ¤ÏÊÒ¦¤À¤±¤Ç¹½¤ï¤Ê¤¤¡¥¸÷¥»¥ó¥µ¤Ï¥é¥¤¥ó¥È¥ì¡¼¥¹¤Ë»È¤¦¡¥
**¥í¥Ü¥Ã¥È­¢ [#h9d0d78d]
#ref(3-¥í¥Ü2.jpeg)
´Ì¤Î¾å¤Ë¾è¤Ã¤¿¥Ü¡¼¥ë¤ò½¸¤á¡¤´Ì¤Î¾å¤ËÃÖ¤¯¥í¥Ü¥Ã¥È¡¥¥â¡¼¥¿¡¼3¤Ä¤È¸÷¥»¥ó¥µ¡¤Ä¶²»ÇÈ¥»¥ó¥µ¤¬1¤Ä¤º¤Ä¤Ä¤¤¤Æ¤¤¤ë¡¥¥â¡¼¥¿¡¼2¤Ä¤Ï¥¿¥¤¥ä¤ò²ó¤·¡¤¤â¤¦1¤Ä¤Ï¾åÉô¤ÎÒĤηÁ¤ò¤·¤¿¥Ñ¡¼¥Ä¤ò²ó¤·¤Æ¤¤¤ë¡¥¸÷¥»¥ó¥µ¤Ï¥é¥¤¥ó¥È¥ì¡¼¥¹¤È´Ì¤ÎÀܶá¤ò´¶ÃΤ·¡¤Ä¶²»ÇÈ¥»¥ó¥µ¤Ï´Ì¤È¤Îµ÷Î¥¤ò¬¤ë¤Î¤Ë»È¤¦¡¥¸÷¥»¥ó¥µ¤Ç´Ì¤ÎÀܶá¤ò´¶ÃΤ¹¤ëÊýË¡¤Ï¸å½Ò¤¹¤ë¡¥
#ref(manzi.jpeg)
¼Ì¿¿¤ÎÒĤηÁ¤ò¤·¤¿¥Ñ¡¼¥Ä¤Îº¸²¼¤ÎÉôʬ¤Ë¥¢¥ë¥ß´Ì¤¬¤Ï¤Þ¤ê¡¤ÒĤηÁ¤ò¤·¤¿¥Ñ¡¼¥Ä¤¬È¿»þ·×²ó¤ê¤Ë²óž¤¹¤ë¤³¤È¤Ç¡¥¥Ü¡¼¥ë¤ò½¸¤á¤ë¡¥¥Ü¡¼¥ë¤ò3¤Ä½¸¤á¤¿¸å¤ÏƱÊý¸þ¤Ë¥Ñ¡¼¥Ä¤ò²óž¤µ¤»¤ë¤³¤È¤Ç´Ì¤Ë¥Ü¡¼¥ë¤òÃÖ¤¯¤³¤È¤¬¤Ç¤­¤ë¡¥
#ref(¥®¥ä.jpeg)
¥â¡¼¥¿¡¼¤«¤éÒĤηÁ¤ò¤·¤¿¥Ñ¡¼¥Ä¤Ø¤Ï¼Ì¿¿¤Î¤è¤¦¤Ë¥®¥ä¤òÁȤ߹ç¤ï¤»Æ°ÎϤòÅÁ¤¨¤Æ¤¤¤ë¡¥¤³¤Î¼Ì¿¿¤Ç¤Ï¥»¥ó¥µ¤Î°ÌÃÖ¤¬ÊѤï¤Ã¤Æ¤¤¤ë¤¬¡¤ËÜÈ֤Ǥϥí¥Ü¥Ã¥È­¢¤Î1ÈÖ¾å¤Î¼Ì¿¿¤Î°ÌÃ֤˥»¥ó¥µ¤¬¤Ä¤¤¤Æ¤¤¤¿¡¥
#ref(touchLight.jpeg)
¸÷¥»¥ó¥µ¤Ç´Ì¤ÎÀܶá¤ò´¶ÃΤ¹¤ë»ÅÁȤߤϼ̿¿¤Î¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤ë¡¥B¤Î¥Ñ¡¼¥Ä¤ÈC¤Î¥Ñ¡¼¥Ä¤Ï¼´¤Ç¤Ä¤Ê¤¬¤Ã¤Æ¤¤¤ë¤¿¤áB¤¬´Ì¤Ë¤è¤Ã¤Æ¥í¥Ü¥Ã¥È¤ÎÊý¤Ë²¡¤µ¤ì¤ë¤ÈC¤¬¸÷¥»¥ó¥µ¤Î²¼¤ËÆþ¤ê´¶ÃΤ¹¤ë¡¥¤Þ¤¿B¤¬²¡¤µ¤ì¤¿¤È¤­¥®¥ä¤Ç¤Ä¤Ê¤¬¤Ã¤Æ¤¤¤ëA¤¬¾å¤Ë»ý¤Á¾å¤¬¤ë¤¿¤á¡¤B¤ò²¡¤·¤Æ¤¤¤ëÎϤ¬Ìµ¤¯¤Ê¤ë¤ÈB,C¤Ï¸µ¤Î°ÌÃÖ¤ØÌá¤ë¡¥Ä¶²»ÇÈ¥»¥ó¥µ¤Ï¶áµ÷Î¥¤Î¤â¤Î¤ä´Ì¤Î¤è¤¦¤Ë¶ÊÌ̤ˤʤäƤ¤¤ë¤â¤Î¤È¤Îµ÷Î¥¤òÀµ³Î¤Ë¬¤ì¤Ê¤«¤Ã¤¿¤³¤È¤È¡¤¥¿¥Ã¥Á¥»¥ó¥µ¤Ç¤ÏÈ¿±þ¤»¤º¤½¤Î¤Þ¤Þ´Ì¤ò²¡¤·¤Æ¤·¤Þ¤¦¤³¤È¤«¤é¤³¤Î»ÅÁȤߤòºî¤Ã¤¿¡¥
*¥×¥í¥°¥é¥à¤Ë¤Ä¤¤¤Æ [#s4279a79]
»ä¤ÎÈɤǤÏ4¿Í¤½¤ì¤¾¤ì¥×¥í¥°¥é¥à¤òºî¤ê¡¤Æ°¤«¤·¤Æ¡¤1ÈÖ¤¦¤Þ¤¯¤¤¤Ã¤¿¿Í¤Î¥×¥í¥°¥é¥à¤òËÜÈ֤ǻȤ¦¤È¤¤¤¦ÊýË¡¤ò¼è¤Ã¤¿¡¥ËÜÈ֤ǻȤ俤Τϻä¤Î¥×¥í¥°¥é¥à¤Ç¤Ï̵¤¯¡¤»ä¤Î¥×¥í¥°¥é¥à¤Ç¤Ï¤¦¤Þ¤¯¥Ü¡¼¥ë¤ò´Ì¤Î¾å¤Ë¾è¤»¤ë¤³¤È¤Ï¤Ç¤­¤Ê¤«¤Ã¤¿¡¥¤è¤Ã¤Æ¸å¤Ë½ñ¤¯¥×¥í¥°¥é¥à¤ÎÀâÌÀ¤Ï¼ÂºÝ¤Îư¤­¤Ç¤Ï¤Ê¤¯»ä¤ÎÁÛÄꤷ¤¿Æ°¤­¤Ç¤¢¤ë¡¥
**¥í¥Ü¥Ã¥È­¡¤Î¥×¥í¥°¥é¥à [#cc7f68a8]
 #define TIME1 130           //¤³¤Î»þ´Ö¤òͤ¨¤Æ¹õ¤ÎÉôʬ¤Ë¤¤¤ë¤È½½»úÏ©¤ÈȽÃǤ¹¤ë
 #define SPEED 50            //¥í¥Ü¥Ã¥È¤Î¥Ù¡¼¥¹¤È¤Ê¤ë®¤µ
 #define centor 40           //Çò¤È¹õ¤Î¶­Ìܤθ÷¥»¥ó¥µ¤ÎÃÍ
 const float diameter=5.5;   //¥¿¥¤¥ä¤Îľ·Â
 const float distance=12.5;  //¥¿¥¤¥ä´Ö¤Îµ÷Î¥
 const float pi=3.14;        //±ß¼þΨ
 #define limit 40            //¥é¥¤¥ó¥È¥ì¡¼¥¹»þ¤Î®¤µ¤ÎÀ©¸Â
 #define CONN 1              //ÄÌ¿®¤¹¤ëNXT¤ÎÈÖ¹æ
 #define SIGNALON 11         //ÄÌ¿®Àè¤ÎNXT¤òư¤«¤¹¤¿¤á¤ÎÈÖ¹æ
 
 float CmToDeg(int cm)
 {
     int Tiredeg=360*cm/(diameter*pi);
     return Tiredeg;
 }
 
 float DegToDeg(int deg)
 {
     int TireDeg=deg*distance/diameter;
     return TireDeg;
 }
 
 void change_line(int curve){
     while(SENSOR_4>centor-10){
         OnRev(OUT_B,50*(-curve/abs(curve)));
         OnFwd(OUT_C,50*(-curve/abs(curve)));
     }
 }
 
 void crossroad(int d,int t)
 {
     if(d>0){RotateMotorEx(OUT_BC,20,DegToDeg(d),100,true,true);}
     if(d<0){RotateMotorEx(OUT_BC,20,DegToDeg(-d),-100,true,true);}
     OnFwd(OUT_BC,40);
     Wait(t);
     Off(OUT_BC);
 }
 
 void follow_line(int curve,int slowdown)
 {
     int a=(curve/25)*(SENSOR_4-centor);
     int vb=(SPEED-a)/(slowdown/10);
     int vc=(SPEED+a)/(slowdown/10);
 
     if(vb>limit){vb=limit;}
     if(vc>limit){vc=limit;}
     if(vb<-limit){vb=-limit;}
     if(vc<-limit){vc=-limit;}
     OnFwd(OUT_B,vb);
     OnFwd(OUT_C,vc);
 }
 
 void follow_linePlus(int CURVE,int SLOWDOWN,long tmin,long tmax)
 {
     long t0=CurrentTick();
     long tb=CurrentTick();
 
     while(CurrentTick()-tb<TIME1 && CurrentTick()-t0<tmax){
         follow_line(CURVE,SLOWDOWN);
         if(SENSOR_4>centor-5 || CurrentTick()-t0<tmin){tb=CurrentTick();}
     }
     Off(OUT_BC);
 }
 
 task main()
 {
     SetSensorLight(S4);
 
     follow_linePlus(100,20,2000,10000);
     crossroad(10,0);
     RotateMotor(OUT_C,30,2*DegToDeg(85));
     RotateMotor(OUT_A,30,50);
     follow_linePlus(100,20,100,10000);
     crossroad(10,100);
     follow_linePlus(100,20,10,10000);
     crossroad(-20,0);
     follow_linePlus(100,20,2000,2000);
     RotateMotorEx(OUT_BC,-40,CmToDeg(20),0,true,true);
     RotateMotor(OUT_A,-40,49);
     SendRemoteNumber(CONN,MAILBOX1,SIGNALON);
     RotateMotorEx(OUT_BC,-40,CmToDeg(20),0,true,true);
 }
**¥í¥Ü¥Ã¥È­¢¤Î¥×¥í¥°¥é¥à [#yd621489]
 #define TIME1 120       //¤³¤Î»þ´Ö¤òͤ¨¤Æ¹õ¤ÎÉôʬ¤Ë¤¤¤ë¤È½½»úÏ©¤ÈȽÃǤ¹¤ë
 #define SPEED 50        //¥í¥Ü¥Ã¥È¤Î¥Ù¡¼¥¹¤È¤Ê¤ë®¤µ
 #define centor 40       //Çò¤È¹õ¤Î¶­Ìܤθ÷¥»¥ó¥µ¤ÎÃÍ
 const float diameter=5.5;
 const float distance=12.5;
 const float pi=3.14;
 #define limit 60
 #define SIGNALON 11
 #define TIME1 130           //¤³¤Î»þ´Ö¤òͤ¨¤Æ¹õ¤ÎÉôʬ¤Ë¤¤¤ë¤È½½»úÏ©¤ÈȽÃǤ¹¤ë
 #define SPEED 50            //¥í¥Ü¥Ã¥È¤Î¥Ù¡¼¥¹¤È¤Ê¤ë®¤µ
 #define centor 40           //Çò¤È¹õ¤Î¶­Ìܤθ÷¥»¥ó¥µ¤ÎÃÍ
 const float diameter=5.5;   //¥¿¥¤¥ä¤Îľ·Â
 const float distance=12.5;  //¥¿¥¤¥ä´Ö¤Îµ÷Î¥
 const float pi=3.14;        //±ß¼þΨ
 #define limit 40            //¥é¥¤¥ó¥È¥ì¡¼¥¹»þ¤Î®¤µ¤ÎÀ©¸Â
 #define SIGNALON 11         //ÄÌ¿®Àè¤ÎNXT¤òư¤«¤¹¤¿¤á¤ÎÈÖ¹æ
 
 
 float CmToDeg(int cm)
 {
     int TireDeg=(360*cm)/(diameter*pi);
     return TireDeg;
 }
 
 float DegToDeg(int deg)
 {
     int Tiredeg=deg*distance/diameter;
     return Tiredeg;
 }
 
 void change_line(int curve)
 {
     while(SENSOR_2>centor-10){
         OnRev(OUT_B,50*(-curve/abs(curve)));
         OnFwd(OUT_C,50*(-curve/abs(curve)));
     }
 }
 
 void follow_line(int curve,int slowdown)
 {
     int a=(curve/25)*(SENSOR_2-centor);
     int vb=(SPEED-a)/(slowdown/10);
     int vc=(SPEED+a)/(slowdown/10);
 
     if(vb>limit){vb=limit;}
     if(vc>limit){vc=limit;}
     if(vb<-limit){vb=-limit;}
     if(vc<-limit){vc=-limit;}
     OnFwd(OUT_B,vb);
     OnFwd(OUT_C,vc);
 }
 
 void follow_linePlus(int CURVE,int SLOWDOWN,long tmin,long tmax)
 {
     long t0=CurrentTick();
     long tb=CurrentTick();
 
     while(CurrentTick()-tb<TIME1 && CurrentTick()-t0<tmax){
         follow_line(CURVE,SLOWDOWN);
         if(SENSOR_2>centor-5 || CurrentTick()-t0<tmin){tb=CurrentTick();}
     }
 }
 
 void fetch_ball(int CURVE,int SLOWDOWN)
 {
     int c=0;
     while(c<3){
         while(SensorUS(S3)>6){
 	    follow_line(CURVE,SLOWDOWN);
 	}
 	RotateMotorEx(OUT_BC,30,CmToDeg(6),0,true,true);
 	RotateMotor(OUT_A,30,85);
 	RotateMotor(OUT_B,-30,180);
     	RotateMotor(OUT_B,30,180);
        c=c++;
     }
     RotateMotorEx(OUT_BC,-40,DegToDeg(180),100,true,true);
 }
 
 void find_can(int deg)
 {
     long tacho_min=0;
     int d_min=300;
 
     RotateMotorEx(OUT_BC,20,DegToDeg(deg)/2,100,true,true);
     ResetTachoCount(OUT_BC);
     OnFwdSync(OUT_BC,20,-100);
     while(MotorTachoCount(OUT_B)<=DegToDeg(deg)){
       if(SensorUS(S3)<d_min&&SensorUS(S3)>10){
         d_min=SensorUS(S3);
         tacho_min=MotorTachoCount(OUT_B);
       }
     }
     OnFwdSync(OUT_BC,20,100);
     until(MotorTachoCount(OUT_B)<=tacho_min);
     Wait(14);
     Off(OUT_BC);
 }
 
 void put_ball(int tmax)
 {
     long T0=CurrentTick();
 
     OnFwdSync(OUT_BC,20,0);
     until(SENSOR_2<35||CurrentTick()-T0>tmax);
     Off(OUT_BC);
     long T=CurrentTick()-T0;
     RotateMotor(OUT_A,20,87);
     OnRevSync(OUT_BC,20,0);
     Wait(T);
     Off(OUT_BC);
 }
 
 task main()
 {
     SetSensorLight(S2);
     SetSensorLowspeed(S3);
 
     follow_linePlus(-100,20,6000,6000);
     change_line(50);
 
     int msg;
     while(msg!=SIGNALON){
         ReceiveRemoteNumber(MAILBOX1,true,msg);
     }
 
     fetch_ball(100,20);
     change_line(-50);
     follow_linePlus(-100,20,0,10000);
     find_can(60);
     put_ball(5000);
     RotateMotorEx(OUT_BC,40,DegToDeg(90),-100,true,true);
     find_can(60);
     put_ball(5000);
 }
**´Ø¿ô¤ÎÀâÌÀ [#jb848e96]
­¡­¢¤Ë¶¦Ä̤δؿô¤Ë¤Ä¤¤¤ÆÀâÌÀ¤¹¤ë¡¥
***CmToDeg [#gfe0d885]
 float CmToDeg(int cm)
 {
     int TireDeg=(360*cm)/(diameter*pi);
     return TireDeg;
 }
¿Ê¤ß¤¿¤¤µ÷Î¥(cm)¤«¤é¥¿¥¤¥ä¤Î²óž³ÑÅÙ¤ò·×»»¤¹¤ë´Ø¿ô¡¥
***DegToDeg [#c1982aee]
 float DegToDeg(int deg)
 {
     int TireDeg=deg*distance/diameter;
     return TireDeg;
 }
¥í¥Ü¥Ã¥È¤Î²óž¤·¤¿¤¤³ÑÅÙ¤«¤é¥¿¥¤¥ä¤Î²óž³ÑÅÙ¤ò·×»»¤¹¤ë´Ø¿ô¡¥
***change_line [#lc9bbbec]
 void change_line(int curve){
     while(SENSOR_4>centor-10){
         OnRev(OUT_B,50*(-curve/abs(curve)));
         OnFwd(OUT_C,50*(-curve/abs(curve)));
     }
 }
¥é¥¤¥ó¥È¥ì¡¼¥¹¤Î±è¤¦Â¦¤òÊѹ¹¤¹¤ë´Ø¿ô¡¥¥»¥ó¥µ¡¼¤¬¥é¥¤¥ó¤Î³°¤Ë¤¢¤ë¤È¤­¤Ë±è¤¦Â¦¤òÊѤ¨¤Æ¤·¤Þ¤¦¤È¥³¡¼¥¹¥¢¥¦¥È¤·¤Æ¤·¤Þ¤¦¤¿¤á°ìÅ٥饤¥ó¤Î¾å¤ËÌᤵ¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡¥¤½¤Î¤¿¤á¡¤¥»¥ó¥µ¡¼¤¬Çò¤ÎÉôʬ¤ÎÃͤò¼è¤ë´Ö¤½¤Î¾ì¤ÇÀû²ó¤¹¤ë¡¥~
°ú¿ô¤Ï1¤Ä¤¢¤ê¡¤º¸¤«¤é±¦¤Ë°Ü¤ë»þ¤ÏÉé¤ÎÃÍ¡¤±¦¤«¤éº¸¤Î»þ¤ÏÀµ¤ÎÃͤòÆþ¤ì¤ë¡¥
***follow_line [#z31a8548]
 void follow_line(int curve,int slowdown)
 {
     int a=(curve/25)*(SENSOR_1-centor); //¸÷¥»¥ó¥µ¤ÎÃͤÈÇò¹õ¤Î¶­ÌܤÎÃÍ(centor)¤Îº¹¤ËÈæÎ㤹¤ëÃÍ
     int vb=(SPEED-a)/(slowdown/10);     //¥â¡¼¥¿B¤Î®¤µ
     int vc=(SPEED+a)/(slowdown/10);     //¥â¡¼¥¿C¤Î®¤µ
 
     if(vb>limit){vb=limit;}             //¥â¡¼¥¿¤Î®¤µ¤ò[-limit,limit]¤ËÀ©¸Â
     if(vc>limit){vc=limit;}
     if(vb<-limit){vb=-limit;}
     if(vc<-limit){vc=-limit;}
     OnFwd(OUT_B,vb);
     OnFwd(OUT_C,vc);
 }
SPEED:¥í¥Ü¥Ã¥È¤Î¥Ù¡¼¥¹¤È¤Ê¤ë®¤µ~
¸÷¥»¥ó¥µ¤ÎÃͤˤè¤Ã¤Æº¸±¦¤Î¥â¡¼¥¿¤Î®¤µ¤ò¤½¤ì¤¾¤ì-limit¡Álimit¤Î´Ö¤Ç1¼¡´Ø¿ôŪ¤ËÊѲ½¤µ¤»¤ë´Ø¿ô¡¥~
°ú¿ô¤Ï2¼ïÎढ¤ê¡¤~
curve:¥í¥Ü¥Ã¥È¤Î¶Ê¤¬¤ê¤ä¤¹¤µ¤ò·è¤á¤ë¡¥''ÃͤÎÀµÉé¤Ç±è¤¦¥é¥¤¥ó¤Îº¸±¦¤¬·è¤Þ¤ë''¡¥~
slowdown:¥í¥Ü¥Ã¥È¤òÁ´ÂÎŪ¤Ë¸ºÂ®¤µ¤»¤ë.~
***follow_linePlus [#e1c0e49f]
 void follow_linePlus(int CURVE,int SLOWDOWN,long tmin,long tmax)
 {
     long t0=CurrentTick();
     long tb=CurrentTick();
 
     while(CurrentTick()-tb<TIME1 && CurrentTick()-t0<tmax){
         follow_line(CURVE,SLOWDOWN);
         if(SENSOR_2>centor-5 || CurrentTick()-t0<tmin){tb=CurrentTick();}
     }
 }
¥é¥¤¥ó¥È¥ì¡¼¥¹¤ò¤¹¤ë¡¥·Ð²á»þ´Ö¤¬tmin°Ê¹ß¤Ç½½»úÏ©¤Ë¤Ä¤¯¡¤¤Þ¤¿¤Ïtmax¤òͤ¨¤ë¤È´Ø¿ô¤¬½ªÎ»¤¹¤ë¡¥~
°ú¿ô¤Ï4¤Ä¤¢¤ê¡¤Á°2¤Ä¤Ïfollow_lineÆâ¤ÎÃͤò·è¤á¡¤¸å2¤Ä¤ÏÁ°Ê¸¤ÇÀâÌÀ¤·¤¿tmin¤Ètmax¤ò»ØÄꤹ¤ë¡¥
**¥í¥Ü¥Ã¥È­¡¤Î´Ø¿ô [#z9f31889]
¥í¥Ü¥Ã¥È­¡¤Î¥×¥í¥°¥é¥à¤Ë¤À¤±»È¤Ã¤¿´Ø¿ô¤òÀâÌÀ¤¹¤ë¡¥
***crossroad [#s411b092]
 void crossroad(int d,int t)
 {
     if(d>0){RotateMotorEx(OUT_BC,20,DegToDeg(d),100,true,true);}
     if(d<0){RotateMotorEx(OUT_BC,20,DegToDeg(-d),-100,true,true);}
     OnFwd(OUT_BC,40);
     Wait(t);
     Off(OUT_BC);
 }
¸òº¹ÅÀ¤Ê¤É¤ÇÄä»ß¤·¤¿¸å¥í¥Ü¥Ã¥È¤Î°ÌÃÖ¤òÄ´À°¤¹¤ë¤Î¤Ë»È¤¦´Ø¿ô¡¥»ØÄꤷ¤¿³ÑÅÙd¤À¤±²óž¤·¡¤¤½¤Î¸å40%¤Î¥¹¥Ô¡¼¥É¤ÇtÉÃÁ°¿Ê¤¹¤ë¡¥d¤ÏÀµÉé¤Ç²óžÊý¸þ¤òÊѤ¨¤ë¤³¤È¤¬¤Ç¤­¤ë¡¥
**¥í¥Ü¥Ã¥È­¢¤Î´Ø¿ô [#x496d63f]
¥í¥Ü¥Ã¥È­¢¤Î¥×¥í¥°¥é¥à¤Ë¤À¤±»È¤Ã¤¿´Ø¿ô¤òÀâÌÀ¤¹¤ë¡¥
***fech_ball [#r97ab3b7]
 void fetch_ball(int CURVE,int SLOWDOWN)
 {
     int c=0;
     while(c<3){                         //°Ê²¼¤Îưºî¤ò3²ó·«¤êÊÖ¤¹
         while(SensorUS(S3)>6){          //Ͳ»ÇÈ¥»¥ó¥µ¤ÎÃͤ¬6°Ê¾å¤Î´Ö¥é¥¤¥ó¥È¥ì¡¼¥¹
 	    follow_line(CURVE,SLOWDOWN);
 	}
 	RotateMotorEx(OUT_BC,30,CmToDeg(6),0,true,true);  //6cmÁ°¿Ê
 	RotateMotor(OUT_A,30,85);                         //¥¢¡¼¥à¤ò90ÅÙ²óž
 	RotateMotor(OUT_B,-30,180);                       //¥í¥Ü¥Ã¥È¤òº¸¤Ë¸þ¤±¤ë
     	RotateMotor(OUT_B,30,180);                        //ÀµÌ̤ò¸þ¤¯
        c=c++;
     }
     RotateMotorEx(OUT_BC,-40,DegToDeg(180),100,true,true);  //¥í¥Ü¥Ã¥È¤¬180ÅÙȿž
 }
Àþ¾å¤Ë½Ä°ìÎó¤Ëʤó¤Ç¤¤¤ë¥Ü¡¼¥ë¤òºÜ¤»¤¿´Ì¤«¤é¥Ü¡¼¥ë¤ò½¸¤á¤ë´Ø¿ô¡¥´Ì¤Ë¶á¤Å¤¯¤Þ¤Ç¥é¥¤¥ó¥È¥ì¡¼¥¹¤ò¹Ô¤¤¡¤´Ì¤Ë¶á¤Å¤¤¤¿¤é¥Ü¡¼¥ë¤ò²ó¼ý¤¹¤ë¡¥¤½¤Î¸å¥í¥Ü¥Ã¥È¤òº¸¤Ë¸þ¤±¤ë¤³¤È¤Ç´Ì¤ò¤É¤«¤·¡¤¤Ä¤®¡¼¤Î´Ì¤Ø¸þ¤«¤¦¡¥´Ì¤È¥Ü¡¼¥ë¤Ï3¤Ä¤Ê¤Î¤Ç3²ó·«¤êÊÖ¤¹¡¥ºÇ¸å¤Ë¥Ü¡¼¥ë¤òÃÖ¤­¤Ë¹Ô¤¯¤¿¤á¤Ë¸å¤í¤ò¸þ¤¯¡¥¥í¥Ü¥Ã¥È¤ÎÀâÌÀ¤Ç¾Ò²ð¤·¤¿¶á¤Å¤¤¤¿´Ì¤ò´¶ÃΤ¹¤ë»ÅÁȤߤϤ³¤Î¥×¥í¥°¥é¥à¤ò½ñ¤¤¤¿¸å¤Ë¼è¤êÉÕ¤±¤¿¤¿¤á¤³¤³¤Ç¤Ï»ÈÍѤ·¤Ê¤¤¡¥
***find_can [#o1a2aeb0]
 void find_can(int deg)
 {
     long tacho_min=0;           //¥¿¥¤¥ä¤Î²óž³ÑÅÙ¤òµ­²±¤¹¤ë¤¿¤á¤ÎÊÑ¿ô
     int d_min=300;              //²¾¤ÎºÇ¾®ÃÍ
 
     RotateMotorEx(OUT_BC,20,DegToDeg(deg)/2,100,true,true);  //»ØÄꤷ¤¿³ÑÅÙ¤ÎȾʬ²ó¤ë
     ResetTachoCount(OUT_BC);
     OnFwdSync(OUT_BC,20,-100);                               //»ØÄꤷ¤¿³ÑÅÙ²ó¤ë
     while(MotorTachoCount(OUT_B)<=DegToDeg(deg)){            //
       if(SensorUS(S3)<d_min&&SensorUS(S3)>10){               //ºÇ¾®Ãͤι¹¿·¤È³ÑÅ٤ε­²±
         d_min=SensorUS(S3);                                  //
         tacho_min=MotorTachoCount(OUT_B);                    //
       }
     }
     OnFwdSync(OUT_BC,20,100);                                //µ­²±¤·¤¿³ÑÅÙ¤Þ¤ÇÌá¤ë
     until(MotorTachoCount(OUT_B)<=tacho_min);                //
     Wait(14);
     Off(OUT_BC);
 }
ºÇ¤â¶á¤¤´Ì¤òõ¤¹´Ø¿ô¡¥»ÅÁȤߤϹֵÁÆâ¤Ç¾Ò²ð¤µ¤ì¤¿¤â¤Î¤È¤Û¤È¤ó¤ÉƱ¤¸¤Ç¤¢¤ë¡¥°ú¿ô¤Î³ÑÅÙʬ¥í¥Ü¥Ã¥È¤ÎÀµÌ̤òõ¤¹¡¥¤·¤«¤·Ä¶²»ÇÈ¥»¥ó¥µ¤ÎÉÔ¶ñ¹ç¤Çµ©¤ËÆÍÁ³¾®¤µ¤ÊÃͤ¬½Ð¤ë¤³¤È¤¬¤¢¤Ã¤¿¤¿¤á¡¥ºÇ¾®Ãͤò¹¹¿·¤¹¤ë¾ò·ï¤ËͲ»ÇÈ¥»¥ó¥µ¤ÎÃͤ¬10°Ê¾å¤Ç¤¢¤ë¤³¤È¤ò²Ã¤¨¤¿¡¥
***put_ball [#nff4fbc4]
 void put_ball(int tmax)
 {
     long T0=CurrentTick();                       //·Ð²á»þ´Ö¤ò·×¤ë¤¿¤á¤ÎÊÑ¿ô
 
     OnFwdSync(OUT_BC,20,0);                      //´Ì¤¬À᤹ܶ¤ë¤Þ¤ÇÁ°¿Ê¤¹¤ë
     until(SENSOR_2<35||CurrentTick()-T0>tmax);   //
     Off(OUT_BC);
     long T=CurrentTick()-T0;                     //Á°¿Ê¤·¤¿»þ´Ö¤òµ­Ï¿
     RotateMotor(OUT_A,20,87);                    //¥Ü¡¼¥ë¤òÃÖ¤¯
     OnRevSync(OUT_BC,20,0);                      //Á°¿Ê¤·¤¿»þ´Ö¤À¤±¸åÂà
     Wait(T);                                     //
     Off(OUT_BC);                                 //
 }
find_can¤Ç´Ì¤ò¸«¤Ä¤±¤¿¸å¡¤ÀµÌ̤ˤ¢¤ë´Ì¤Ë¥Ü¡¼¥ë¤ò¤Î¤»¤Ë¹Ô¤­¡¤Æ±¤¸°ÌÃÖ¤ËÌá¤ë´Ø¿ô¡¥´Ì¤ÎÀܶá¤Ï¡¤¥í¥Ü¥Ã¥È¤ÎÀâÌÀ¤Ç¾Ò²ð¤·¤¿¡¤¸÷¥»¥ó¥µ¤òÍøÍѤ·¤¿¤â¤Î¡¤¤ò»È¤Ã¤ÆÈ½Ê̤·¤Æ¤¤¤ë¡¥
**main¥×¥í¥°¥é¥à¤ÎÀâÌÀ [#l7036e47]
Á´ÂΤÎή¤ì¤Ï~
¥í¥Ü¥Ã¥È­¡­¢µ¯Æ°~
¢­~
¥í¥Ü¥Ã¥È­¡´Ì¤ò½¸¤á¤ë¡¤¥í¥Ü¥Ã¥È­¢I¡­¤Ë°Üư¤¹¤ë¡¥~
¢­~
¥í¥Ü¥Ã¥È­¡´Ì¤ò½¸¤á½ª¤ï¤ê¡¤´Ì¤«¤éÎ¥¤ì¤ë~
¢­~
¥í¥Ü¥Ã¥È­¢´Ì¤«¤é¥Ü¡¼¥ë¤ò²ó¼ý¤¹¤ë~
¢­~
¥í¥Ü¥Ã¥È­¢H¡­¤Ë°Üư¤¹¤ë~
¢­~
¥í¥Ü¥Ã¥È­¢´Ì¤òõ¤·¤Æ¥Ü¡¼¥ë¤òÃÖ¤¯~
¤È¤Ê¤ê¡¤¶ñÂÎŪ¤ÊÀâÌÀ¤Ï¥×¥í¥°¥é¥à¤ËľÀܵ­ºÜ¤¹¤ë¡¥
#ref(roats.jpeg)
 task main()                  //¥í¥Ü¥Ã¥È1
 {
     SetSensorLight(S4);
 
     follow_linePlus(100,20,2000,10000);                //º¸Â¦¥é¥¤¥ó¥È¥ì¡¼¥¹(E,C,D)
     crossroad(10,0);                                   //¸òº¹ÅÀD¤ÇÄä»ß
     RotateMotor(OUT_C,30,2*DegToDeg(85));              //±¦¥¿¥¤¥äÃæ¿´¤Ë»þ·×²ó¤ê¤Ë90ÅÙ²óž
     RotateMotor(OUT_A,30,50);                          //¥¢¡¼¥à¤òÊĤ¸¤ë
     follow_linePlus(100,20,100,10000);                 //º¸Â¦¥é¥¤¥ó¥È¥ì¡¼¥¹(D,G)
     crossroad(10,100);                                 //¸òº¹ÅÀG¤òľ¿Ê
     follow_linePlus(100,20,10,10000);                  //º¸Â¦¥é¥¤¥ó¥È¥ì¡¼¥¹(G,H,I)
     crossroad(-20,0);                                  //¸òº¹ÅÀH¤òº¸ÀÞ
     follow_linePlus(100,20,2000,2000);                 //º¸Â¦¥é¥¤¥ó¥È¥ì¡¼¥¹
     RotateMotorEx(OUT_BC,-40,CmToDeg(20),0,true,true); //°ÌÃÖÄ´À°¤Ç¸åÂà
     RotateMotor(OUT_A,-40,49);                         //¥¢¡¼¥à¤ò¾å¤²¤ë
     SendRemoteNumber(CONN,MAILBOX1,SIGNALON);          //¥í¥Ü¥Ã¥È2µ¯Æ°
     RotateMotorEx(OUT_BC,-40,CmToDeg(20),0,true,true); //²ó¼ý¤Î¼ÙËâ¤Ë¤Ê¤ë¤Î¤Ç¸åÂà
 }
¥¢¡¼¥à¤Ï350ml¥¢¥ë¥ß´Ì3ËÜʬ¤ÎÌó200mm¤¢¤ë¤¿¤á¡¤D¤Ç²óž¤¹¤ë¤³¤È¤ÇE,F¤Î´Ì¤ò½¸¤á¤ë¤³¤È¤¬¤Ç¤­¤ë¡¥±¦¥¿¥¤¥ä¤òÃæ¿´¤Ë²ó¤ë¤³¤È¤Ç½¸¤á¤Ê¤¬¤é´Ì¤¬¥í¥Ü¥Ã¥È¦¤Ë´ó¤Ã¤ÆÍè¤ë¡¥°ÌÃÖÄ´À°¤Î¸åÂà¤Ï¥í¥Ü¥Ã¥È­¢¤ÈF¡­¤Î´Ì¤¬¿¨¤ì¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¤¿¤á¤Ç¤¢¤ë¡¥
 task main()                  //¥í¥Ü¥Ã¥È2
 {
     SetSensorLight(S2);
     SetSensorLowspeed(S3);
 
     follow_linePlus(-100,20,6000,6000);            //±¦Â¦¥é¥¤¥ó¥È¥ì¡¼¥¹(A¡­,J¡­,H¡­,I¡­)
     change_line(50);                               //º¸Â¦¤Ë¼ÖÀþÊѹ¹
 
     int msg;
     while(msg!=SIGNALON){                          //¥í¥Ü¥Ã¥È1¤«¤é¥á¥Ã¥»¡¼¥¸¤¬Íè¤ë¤Î¤òÂÔ¤Ä
         ReceiveRemoteNumber(MAILBOX1,true,msg);
     }
 
     fetch_ball(100,20);                                   //¥Ü¡¼¥ë¤ò²ó¼ý¤·È¿Å¾
     change_line(-50);                                     //±¦Â¦¤Ë±è¤¦
     follow_linePlus(-100,20,0,10000);                     //±¦Â¦¥é¥¤¥ó¥È¥ì¡¼¥¹(I¡­,H¡­)
     find_can(60);                                         //C¡­¤Î°ÌÃ֤ˤ¢¤ë´Ì¤òõ¤¹
     put_ball(5000);                                       //¥Ü¡¼¥ë¤òÃÖ¤­¤Ë¹Ô¤Ã¤ÆÌá¤ë
     RotateMotorEx(OUT_BC,40,DegToDeg(90),-100,true,true); //F¡­¤ÎÊý¸þ¤ÎÊÕ¤ê¤ò¸þ¤¯
     find_can(60);                                         //F¡­¤Î°ÌÃ֤ˤ¢¤ë´Ì¤òõ¤¹
     put_ball(5000);                                       //¥Ü¡¼¥ë¤òÃÖ¤­¤Ë¹Ô¤Ã¤ÆÌá¤ë
 }
¥í¥Ü¥Ã¥È­¢¤Ï¥³¡¼¥¹¤ÎÃæ¿´¤Ç¥Ü¡¼¥ë¤ò²ó¼ý¤·¤¿¸åH¡­¤Ë¸þ¤«¤¤¤½¤Î¤È¤­¥³¡¼¥¹¤Î¼Ì¿¿¤Î±¦Â¦¤ò¸þ¤¤¤Æ¤¤¤ë¤¿¤á½é¤á¤ËC¡­¤Î´Ì¤òõ¤¹¡¥¤½¤Î¸å¤Þ¤¿H¡­¤ËÌá¤ê¡¤90ÅÙ»þ·×²ó¤ê¤Ë²ó¤êF¡­¤Î´Ì¤òõ¤¹¡¥¥í¥Ü¥Ã¥ÈËÜÂΤ¬Â礭¤¯¸òº¹ÅÀG¡­D¡­¤Ë¿Ê¤à¤³¤È¤Ï´Ì¤òÅݤ·¤Æ¤·¤Þ¤¦´í¸±¤¬¤¢¤Ã¤¿¤¿¤áE¡­¤Î´Ì¤ÏÄü¤á¤Æ¤¤¤ë¡¥¤â¤·ËþÅÀ¤òÁÀ¤¦¤Î¤Ê¤é¤ÐE¡­¤Î´Ì¤Îº¸Â¦¤«¤é¶á¤Å¤¯É¬Íפ¬¤¢¤ë¡¥¤Þ¤¿ºÇ½é¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹¤ÏI¡­ÉÕ¶á¤ÇÄä»ß¤¹¤ëͽÄê¤À¤¬¡¤I¡­ÉÕ¶á¤ÏÌܰõ¤¬Ìµ¤¯»þ´Ötmax¤ÇÄä»ß¤¹¤ëɬÍפ¬¤¢¤ë¡¥¥×¥í¥°¥é¥àÆâ¤Ç¤Ï6ÉäÇÀßÄꤷ¤Æ¤¤¤ë¤¬¤³¤Î¿ô»ú¤Ç¤Ï¥í¥Ü¥Ã¥È­¡¤È´³¾Ä¤·¤Æ¤·¤Þ¤¦¤Î¤ÇÄ´À°¤¹¤ëɬÍפ¬¤¢¤ë¡¥
*¤Þ¤È¤á [#cf1a0a02]
¥í¥Ü¥Ã¥È¤Ë´Ø¤·¤Æ¤Ï¤«¤Ê¤êËþ­¤Î¤¤¤¯¤â¤Î¤òºî¤ë¤³¤È¤¬¤Ç¤­¤¿¡¥Á°Ç¯ÅÙÅù¤Î±ÇÁü¤Ç¸«¤¿¤â¤Î¤È¤Ï°ã¤Ã¤¿¤â¤Î¤òºî¤ê¤¿¤¤¤È¤¤¤¦¹Í¤¨¤«¤é²£¤Ë²óž¤¹¤ë¥¢¡¼¥à¤òºî¤Ã¤¿¤¬´Ì¤È¤Îµ÷Î¥¤Ë¤è¤Ã¤Æµóư¤¬Â礭¤¯ÊѤï¤êÀ©¸æ¤¬ÂçÊѤǤ¢¤Ã¤¿¡¥¥í¥Ü¥Ã¥È¤òÁȤßΩ¤Æ¤Ê¤¬¤éƱ»þ¤Ë¥×¥í¥°¥é¥à¤âºî¤ê¡¤ºÙ¤«¤¯µóư¤ò³Îǧ¤·¤Ê¤¬¤é¥í¥Ü¥Ã¥È¡¤¥×¥í¥°¥é¥à¤Î½¤Àµ¤ò¹Ô¤¦¤È¤¤¤¦·Á¤ò¤È¤ì¤ì¤Ð¤è¤«¤Ã¤¿¡¥~
¼«Ê¬¤Î¥×¥í¥°¥é¥à¤Ï̤´°À®¤Ç¤¢¤Ã¤¿¡¥¥í¥Ü¥Ã¥È­¡¤Ë´Ø¤·¤Æ¤Ï¤¹¤Ù¤Æµóư¤¬³Îǧ¤Ç¤­¤Æ¤¤¤¿¤¬¥í¥Ü¥Ã¥È­¢¤Ï¥Ü¡¼¥ë¤ò²ó¼ý¤¹¤ëÉôʬ¤Î¤ß¤Ç¤¢¤Ã¤¿¡¥¸ß¤¤¤ÎÏ¢·È¤ä¥Ü¡¼¥ë¤òÃÖ¤¯¥×¥í¥°¥é¥à¤Ïµóư¤ò³Îǧ¤Ç¤­¤Æ¤¤¤Ê¤¤¡¥¥×¥í¥°¥é¥à¤òºî¤Ã¤Æ¤¤¤ëÅÓÃæ¤ÇNXT¤Ë¥×¥í¥°¥é¥à¤¬Æþ¤é¤Ê¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿¡¥¸¶°ø¤ÏÍÆÎÌÉÔ­¤ÇNXTÆâ¤Î¥×¥í¥°¥é¥à¤ò¾Ã¤¹¤³¤È¤Ç²ò·è¤·¤¿¤¬¡¤Â礭¤¯»þ´Ö¤ò¼è¤é¤ì¤Æ¤·¤Þ¤Ã¤¿¡¥¤½¤¦¤¤¤Ã¤¿¥¢¥¯¥·¥Ç¥ó¥È¤âÁÛÄꤷ¤ÆÍ½Äê¤òΩ¤Æ¤ë¤Î¤¬½ÅÍפʤΤÀ¤È³Ø¤ó¤À¡¥

¥È¥Ã¥×   ÊÔ½¸ º¹Ê¬ ÍúÎò źÉÕ Ê£À½ ̾Á°Êѹ¹ ¥ê¥í¡¼¥É   ¿·µ¬ °ìÍ÷ ¸¡º÷ ºÇ½ª¹¹¿·   ¥Ø¥ë¥×   ºÇ½ª¹¹¿·¤ÎRSS