[[2014a/Member]] *¥á¥ó¥Ð¡¼ [#we26e668] ¡¡tacchan ¡¡¡¡¡¡¥¹¥¿¡¼¥È¤«¤é¥´¡¼¥ë¤Ø¸þ¤±¤Æ¤Î¥×¥í¥°¥é¥àôÅö ¡¡yukiyamaneko¡¡¡¡¡¡ ¡¡¡¡¡¡¥´¡¼¥ë¤«¤é¥¹¥¿¡¼¥È¤Ø¸þ¤±¤Æ¤Î¥×¥í¥°¥é¥àôÅö **²ÝÂê¤Ë¤Ä¤¤¤Æ [#h6e6f05f] ¡¡º£²ó¤Î²ÝÂê¤Ï[[2014a/Mission1]]¤Ë¤¢¤ë¤è¤¦¤Ë¥¹¥¿¡¼¥È¡Ê¤Þ¤¿¤Ï¥´¡¼¥ë¡Ë¤«¤é¥é¥¤¥ó¥È¥ì¡¼¥¹¤ò¤·¡¢ÅÓÃæ¤Ç¥Ô¥ó¥Ý¥ó¶Ì¤òÄϤßÈ¿ÂЦ¤ÎÃÏÅÀ¤Þ¤Ç±¿¤Ö¤È¤¤¤¦¤â¤Î¤Ç¤¢¤ë¡£¡Ê¥³¡¼¥¹¿Þ¤Ï²¼¤Î¤È¤ª¤ê¤Ç¤¢¤ë¡£¡Ë &ref(http://yakushi.shinshu-u.ac.jp/robotics/?plugin=ref&page=2014a%2FMission1&src=2014a-mission1.png); **²ÝÂ깶ά¤Ë¸þ¤±¤Æ¡¡ [#me8c615b] ¡¡¥³¡¼¥¹¤ÎÅÓÃæ¤ËÃÖ¤¤¤Æ¤¢¤ë¥Ô¥ó¥Ý¥ó¶Ì¤Î±¿ÈÂÊýË¡¤Ë¤Ä¤¤¤Æ¹Í¤¨¤ë¡£¥Ô¥ó¥Ý¥ó¶Ì¤ò¥´¡¼¥ë¤Þ¤Ç±¿¤ÖÊýË¡¤Ï¤¤¤í¤¤¤í¹Í¤¨¤é¤ì¤ë¤¬¡¢º£²ó¤Ï¥â¡¼¥¿¡¼¤ò¤Ä¤«¤¤¾å¤«¤éäÆ¤Î¤è¤¦¤Ê¤â¤Î¤Ç¥Ô¥ó¥Ý¥ó¶Ì¤ò°Ï¤¤±¿¤Ö¤³¤È¤Ë¤·¤¿¡£¤³¤ÎÊýË¡¤Ç±¿¤Ö¤¿¤á¤Ë¤Ï¥Ô¥ó¥Ý¥ó¶Ì¤Î¤¢¤ë¾ì½ê¤ò´¶ÃΤ·¤Æ»ß¤Þ¤ëɬÍפ¬¤¢¤ê¡¢ÂоݤȤε÷Î¥¤ò¬¤ë¤³¤È¤Î¤Ç¤¤ëͲ»ÇÈ¥»¥ó¥µ¡¼¤ò»ÈÍѤ¹¤ë¤³¤È¤Ë¤·¤¿¡£²ÝÂê¤ËÄ©¤àµ¡ÂΤϰʲ¼¤Î¤è¤¦¤Ë¤Ê¤Ã¤¿¡£ &ref(2014a/Member/tacchan/Mission1/DSC_02301.jpg,20%,µ¡ÂΦÌÌ); &ref(2014a/Member/tacchan/Mission1/DSC_02381.jpg,20%,µ¡ÂξåÌÌ); ¥é¥¤¥ó¥È¥ì¡¼¥¹¤ò¤¹¤ë¤¿¤á¤Î¥é¥¤¥È¥»¥ó¥µ¡¼¤ò¤Ç¤¤ë¤À¤±¼Ö¼´¤Ë¶á¤¤°ÌÃÖ¤ËÃÏÌ̤ȿâľ¤Ë¤Ê¤ë¤è¤¦¤Ë¼è¤êÉÕ¤±¡¢Ä¶²»ÇÈ¥»¥ó¥µ¡¼¤ò¤¬Âоݤò´¶ÃΤ·¤ä¤¹¤¤¤è¤¦¤ËÀµÌ̤ËÇÛÃÖ¤·¡¢¤½¤Î¾åÉô¤Ë¥Ô¥ó¥Ý¥ó¶Ì¤ò°Ï¤à䯤òư¤«¤¹¥â¡¼¥¿¡¼¤ò¼è¤êÉÕ¤±¤¿¡£ **¥×¥í¥°¥é¥à³µÍ× [#c647c50e] ¡¡¡¥¹¥¿¡¼¥È¤«¤éºÇ½é¤Î¸òº¹ÅÀÄÌ²á ¡¡¢ºÇ½é¤ÈÆó¤ÄÌܤθòº¹ÅÀ¶è´Ö ¡¡£¤½¤Î¾ ¤Î»°¤Ä¤Ë¥³¡¼¥¹¤òʬ³ä¤·¤½¤ì¤¾¤ì¤Î¶è´Ö¤Ç¹Ô¤¦Æ°ºî¤ä¸òº¹ÅÀ¤Ç¤ÎÊý¸þ½¤Àµ¤ò²Ã¤¨¤¿¥é¥¤¥ó¥È¥ì¡¼¥¹¤Î¥×¥í¥°¥é¥à¤òÁȤó¤À¡£ º£²óÀ½ºî¤·¤¿¥×¥í¥°¥é¥à¤Ï°Ê²¼¤ÎÄ̤ê¤Ç¤¢¤ë¡£ #define THRESHOLD 50 #define SPEED_H 35 #define SPEED_L 25 #define OnRL(speedR,speedL) OnFwd(OUT_B,speedR);OnFwd(OUT_C,speedL); #define go_forward OnRL(SPEED_H,SPEED_H); #define turn_left1 OnRL(SPEED_L,-SPEED_L);//º¸Àû²ó #define turn_left0 OnRL(SPEED_L,0);//º¸ÀÞ #define turn_right0 OnRL(0,SPEED_L);//±¦ÀÞ #define turn_right1 OnRL(-SPEED_L,SPEED_L);//±¦Àû²ó #define STEP 1 #define nMAX 120//ºÇ½é¤Î¸òº¹ÅÀ¤òÅϤꤤë¤Þ¤Ç¤Î¹õÀþ¥«¥¦¥ó¥¿¡¼¤ÎºÇÂçÃÍ #define nMAX2 175//¥Ü¡¼¥ë¤ò¼è¤Ã¤¿¸å¤Î¹õÀþ¥«¥¦¥ó¥¿¡¼¤ÎºÇÂçÃÍ #define short_break Off(OUT_BC);Wait(1000); #define CROSS_TIME 450 #define cross_line OnRL(SPEED_L,SPEED_L);Wait(CROSS_TIME);short_break; task main() { SetSensorLight(S3);//ü»Ò3¤Ë¥é¥¤¥È¥»¥ó¥µ¡¼ SetSensorLowspeed(S4)//;ü»Ò4¤ËͲ»ÇÈ¥»¥ó¥µ¡¼ int nOnline=0;//³¤±¤Æ¹õ¤Ë¤Ê¤Ã¤¿²ó¿ô int cross_number=0;//¸òº¹ÅÀ¤òÅϤ俲ó¿ô int sensor_number=0;//¥»¥ó¥µ¡¼¤¬È¿±þ¤·¤¿²ó¿ô go_forward; Wait(1000); while(cross_number<1)//ºÇ½é¤Î¸òº¹ÅÀ¤òÅϤë¤Þ¤Ç¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹ { while(nOnline<nMAX) { if(SENSOR_3<THRESHOLD-15) { turn_right1; nOnline++;//¹õÀþ¥«¥¦¥ó¥¿¡¼¤òÄɲà }else{ if(SENSOR_3<THRESHOLD-7) { turn_right0; }else if(SENSOR_3<THRESHOLD+7) { go_forward; }else if(SENSOR_3<THRESHOLD+15) { turn_left0; }else{ turn_left1; } nOnline=0; } Wait(STEP); } short_break; turn_right1;Wait(nMAX*STEP+100); cross_line; PlaySound(SOUND_UP); nOnline=0; cross_number++;//¸òº¹ÅÀ¤òÅϤ뤴¤È¤Ë¸òº¹ÅÀ¥«¥¦¥ó¥¿¡¼¤òÄɲà } while(sensor_number==0)//¶Ì¤òǧ¼±¤·¤Æ¼è¤ë¤Þ¤Ç¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹ { if(SENSOR_3<THRESHOLD-15) { turn_right1; nOnline++; if(SensorUS(S4)<10)//¶Ì¤ò¤È¤ëưºî { Off(OUT_BC); turn_right0;//°ÌÃÖ½¤Àµ Wait(1000); Off(OUT_BC); OnFwd(OUT_A,20);//¥¢¡¼¥à¹ß²¼ Wait(1300); Off(OUT_A); Off(OUT_BC); sensor_number++;//¥»¥ó¥µ¡¼¤Î¥«¥¦¥ó¥¿¡¼¤òÁý¤ä¤¹ } }else{ if(SENSOR_3<THRESHOLD-7) { turn_right0; }else if(SENSOR_3<THRESHOLD+7) { go_forward; }else if(SENSOR_3<THRESHOLD+15) { turn_left0; }else{ turn_left1; } nOnline=0; } Wait(STEP); } while(cross_number<=3)//¶Ì¤ò¤È¤Ã¤¿¸å¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹ { while(nOnline<nMAX2) { if(SENSOR_3<THRESHOLD-15) { turn_right1; nOnline++; }else{ if(SENSOR_3<THRESHOLD-7) { turn_right0; }else if(SENSOR_3<THRESHOLD+7) { go_forward; }else if(SENSOR_3<THRESHOLD+15) { turn_left0; }else{ turn_left1; } nOnline=0; } Wait(STEP); } short_break; turn_right1;Wait(nMAX*STEP+300); cross_line; PlaySound(SOUND_UP); nOnline=0; cross_number++; } Off(OUT_BC);//¶Ì¤ò¥´¡¼¥ë¤ËÆþ¤ì¤ëưºî OnRev(OUT_A,20); Wait(400); } ¡¡¡¥¹¥¿¡¼¥È¤«¤éºÇ½é¤Î¸òº¹ÅÀÄÌ²á ¡¡¢ºÇ½é¤ÈÆó¤ÄÌܤθòº¹ÅÀ¶è´Ö ¡¡£¤½¤Î¾ ¤Î»°¤Ä¤Ë¥³¡¼¥¹¤òʬ³ä¤·¤½¤ì¤¾¤ì¤Î¶è´Ö¤Ç¹Ô¤¦Æ°ºî¤ä¸òº¹ÅÀ¤Ç¤ÎÊý¸þ½¤Àµ¤ò²Ã¤¨¤¿¥é¥¤¥ó¥È¥ì¡¼¥¹¤Î¥×¥í¥°¥é¥à¤òÁȤó¤À¡£ ¡¡ **¼è¤êÁȤ߸å¤Î´¶ÁÛ¡¦È¿¾ÊÅÀ [#h1829f7a] º£²ó¤Î²ÝÂê¤Ç¤Ï¥é¥¤¥ó¥È¥ì¡¼¥¹¤Î¥×¥í¥°¥é¥à¤Ï¤¹¤°¤Ëºî¤ë¤³¤È¤Ï¤Ç¤¤¿¤¬¡¢¤½¤³¤ËͲ»ÇÈ¥»¥ó¥µ¡¼¤Ç¥Ô¥ó¥Ý¥ó¶Ì¤ò´¶ÃΤ¹¤ë¥×¥í¥°¥é¥à¤òÆþ¤ì¤¿¾ì¹ç¤Ë¤¦¤Þ¤¯¥é¥¤¥ó¥È¥ì¡¼¥¹¤·¤Ê¤¯¤Ê¤Ã¤¿¤ê¡¢¥Ô¥ó¥Ý¥ó¶Ì¤òÄÏ¤àÆ°ºî¤ò´Þ¤ó¤Àwhileʸ¤«¤éÈ´¤±½Ð¤µ¤Ê¤¯¤Ê¤ë¤Ê¤É¤ÎÌäÂ꤬¤¢¤Ã¤¿¤¿¤á¥³¡¼¥¹¤òʬ³ä¤¹¤ë¤Ê¤É¤·¤Æ¥×¥í¥°¥é¥à¤¬¸ß¤¤¤Ë´³¾Ä¤·¤Ê¤¤¤è¤¦¤ËÁȤà¤Î¤¬ÂçÊѤÀ¤Ã¤¿¡£¤Þ¤¿¡¢¥»¥ó¥µ¡¼Îà¤È¥â¡¼¥¿¡¼¤¬¼ÖÂÎÁ°Êý¤Ë½¸Ã椷¼ÖÂΤ¬Â礤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿¡£