#contents *MISSION [#g57706c4] ¼«ºî¤·¤¿¥³¡¼¥¹¤Ë±è¤Ã¤Æ°ì¼þ¤¹¤ë¤¹¤ë¥í¥Ü¥Ã¥È¤òºîÀ®¤»¤è¡£ ¤¿¤À¤·¡¢¼¡¤ÎÅÀ¤ËÃí°Õ¤¹¤ë¤³¤È °ì¿Í¤Ï»þ·×²ó¤êÍÑ¡¢¤â¤¦°ì¿Í¤ÏȾ»þ·×²ó¤¦¤êÍÑ¤Î¥×¥í¥°¥é¥à¤òºîÀ®¤¹¤ë¤³¤È¡Ê¥í¥Ü¥Ã¥ÈËÜÂÎ¤ÏÆ±°ì¤Î¤â¤Î¤ò»È¤¦¡Ë¡£ ¼¡¤Î¥¹¥Æ¥Ã¥×¤Ç¥×¥í¥°¥é¥à¤òºîÀ®¤¹¤ë¤³¤È¡£ -¸òº¹ÅÀ¤ò¤¤Á¤ó¤Èǧ¼±¤·¡¢Àµ¤·¤¯È½ÃǤ·¤ÆÄ̲á¤Ç¤¤ë¤è¤¦¤Ë¤¹¤ë¡£ -³Î¼Â¤Ë°ì¼þ¤Ç¤¤ë¤è¤¦¤Ë¤¹¤ë¡£¥¹¥¿¡¼¥ÈÃÏÅÀ¤«¤é½Ðȯ¤·¤Æ¸µ¤Ë¤â¤É¤ë¤è¤¦¤Ë¤¹¤ë¡£ -¶õ¤´Ì¤ò¸òº¹ÅÀ¤«¤é10cm°Ê¾åÎ¥¤·¤¿Àþ¾å¤Ëµ¯¤¡¢¤½¤ì¤ò°ìö¤É¤±¤ÆºÆ¤Ó¸µ¤Î°ÌÃ֤ˤâ¤É¤¹¤è¤¦¤Ë²þÎɤ¹¤ë¡£ -1¸Ä¤Î¶õ¤´Ì¤Ç¤¦¤Þ¤¯¤¤¤Ã¤¿¤é¡¢2¸Ä¤Î¶õ¤´Ì¤Ç¤ä¤Ã¤Æ¤ß¤ë¡£ **¥³¡¼¥¹ [#ke4b0572] &ref(2013b/Member/mato/Mission1/route£µ.jpg); »ä¤Ïº¸¼þ¤ê¤òôÅö¤¹¤ë¡£ ¸å¤Î¥×¥í¥°¥é¥à¤ÎÀâÌÀ¤Î¤¿¤á¤Ë¥³¡¼¥¹¤ò£³¤Ä¤Ëʬ¤±¤ë¡£ ±¦¾å¤Î±ß¤ò¾®±ß¤È¸Æ¤Ö *¥í¥Ü¥Ã¥È¤ÎÀâÌÀ [#ya482e58] &ref(2013b/Member/mato/Mission1/IMG_0558 (3).jpg); &ref(2013b/Member/mato/Mission1/¥í¥Ü.jpg,20%); -¥Ð¥ó¥Ñ¡¼¤òÃæ¿´¤«¤éÎ¥¤¹¤³¤È¤Ç¡¢¤Æ¤³¤Î¸¶Íý¤Ë¤è¤ê¥¿¥Ã¥Á¥»¥ó¥µ¤¬È¿±þ¤·¤ä¤¹¤¯¤·¤¿¡£ -´Ì¤ò°ìËܤΥ¢¡¼¥à¤ÇÄϤि¤á¤Ë¥¢¡¼¥à¤ò¤«¤®¤Å¤á·¿¤Ë¤·¤¿¡£ -¥â¡¼¥¿¡¼¤È¥¢¡¼¥à¤Î°ÌÃÖ¤¬Î¥¤ì¤Æ¤¤¤ë¤¿¤á¥´¥à¤ò»È¤Ã¤ÆÆ°¤«¤»¤ë¤è¤¦¤Ë¤·¤¿¡£ *¥×¥í¥°¥é¥à [#m44b309f] **ÄêµÁ [#d1bdcea1] #define THRESHOLD 43 //ïçÃÍ #define HIPOWER 2¡¡//¹â® #define LOWPOWER 1 //Äã® #define set_power_H SetPower(OUT_AC,HIPOWER); //AC¤ò¹â®¤Çư¤«¤¹ #define set_power_L SetPower(OUT_AC,LOWPOWER); //AC¤òÄ㮤Çư¤«¤¹ #define go_forward set_power_H; OnFwd(OUT_AC); //Á°¿Ê #define turn_left1 set_power_L; Off(OUT_A); OnFwd(OUT_C); //º¸ÀÞ¡¡ #define turn_left2 set_power_L; OnRev(OUT_A); OnFwd(OUT_C); //º¸Àû²ó #define turn_left3 set_power_L; OnRev(OUT_A); //±¦¸å¿Ê #define turn_right1 set_power_L; Off(OUT_C); OnFwd(OUT_A); //±¦ÀÞ #define turn_right2 set_power_L; OnRev(OUT_C); OnFwd(OUT_A); //±¦Àû²ó #define arm_hold OnFwd(OUT_B);Wait(50);Off(OUT_B); //´Ì¤òÄϤà #define arm_part OnRev(OUT_B);Wait(50);Off(OUT_B); //´Ì¤òÎ¥¤¹ #define STEP 1 #define nMAX 4 //¥«¥¦¥ó¥¿¤ÎºÇÂç¿ô #define short_break Off(OUT_AC);Wait(50); //¾®µÙ»ß #define CROSS_TIME 40 //¸òº¹ÅÀ¤òÅϤë»þ´Ö #define cross_line set_power_L; OnFwd(OUT_AC); Wait(CROSS_TIME); short_break; //¸òº¹ÅÀ¤òÅϤë #define time0 2000 //¡¤Î»þ´Ö #define time1 700 //¢¤Î»þ´Ö **¥µ¥Ö¥ë¡¼¥Á¥ó [#a2fda3b2] -ÉáÄ̤Υ饤¥ó¥È¥ì¡¼¥¹¡Ê5Ãʳ¬É¾²Á¡Ë sub normal_trace() { if (SENSOR_2 < THRESHOLD -1){ turn_left2; } else if (SENSOR_2 < THRESHOLD +3){ turn_left1; } else if (SENSOR_2 < THRESHOLD +7){ go_forward; } else if (SENSOR_2 < THRESHOLD +8){ turn_right1; } else { turn_right2; } } -¸òº¹ÅÀ¤òÅϤë¥é¥¤¥ó¥È¥ì¡¼¥¹¡Ê4²óϢ³¤Çº¸Àû²ó¤·¤¿¤éľ¿Ê¡Ë [#l1c71e98] -¸òº¹ÅÀ¤òÅϤë¥é¥¤¥ó¥È¥ì¡¼¥¹¡Ê4²óϢ³¤Çº¸Àû²ó¤·¤¿¤éľ¿Ê¡Ë sub across_line () { int nOnline=0; while(nOnline < nMAX ){ if(SENSOR_2< THRESHOLD -1) { turn_left2; nOnline++; }else{ if(SENSOR_2< THRESHOLD ){ turn_left1; }else if(SENSOR_2< THRESHOLD +4){ go_forward; }else if(SENSOR_2< THRESHOLD +7){ turn_right1; }else{ turn_right2; } nOnline=0; } Wait(STEP); }short_break;PlaySound(2); turn_right1;Wait(nMAX*STEP); cross_line; nOnline=0; } -¾®±ß¤ÎÆâ¦¤òÅϤë¥é¥¤¥ó¥È¥ì¡¼¥¹¡Ê±¦¸å¿Ê¤ò¶î»È¤·¤Æ¶Ê¤¬¤ê¤¤ë¡Ë [#ib41f144] -¾®±ß¤ÎÆâ¦¤òÅϤë¥é¥¤¥ó¥È¥ì¡¼¥¹¡Ê±¦¸å¿Ê¤ò¶î»È¤·¤Æ¶Ê¤¬¤ê¤¤ë¡Ë sub circle_trace() { ClearTimer(0); while(FastTimer(0) <= time1){ if (SENSOR_2 < THRESHOLD -2){ turn_left3; } else if (SENSOR_2 < THRESHOLD -1){ turn_left2; } else if (SENSOR_2 < THRESHOLD +5){ go_forward; } else { turn_right1 } } } -´Ì¤òÂऱ¤ë [#tf64d432] -´Ì¤òÂऱ¤ë sub can_turn () { set_power_L ; arm_hold; OnFwd(OUT_AC); Wait(200); turn_right2; Wait(500); arm_part; turn_left2 ; Wait(500); } **¥á¥¤¥ó¤Î¥×¥í¥°¥é¥à [#yf4e269e] task main() { SetSensor(SENSOR_2, SENSOR_LIGHT); SetSensor(SENSOR_3, SENSOR_TOUCH); ClearTimer(0); //¡¡¥¿¥¤¥Þ¡¼¤ò¥ê¥»¥Ã¥È while(FastTimer(0) <= time0){¡¡//¢¤Þ¤Ç°Ê²¼¤Î¥×¥í¥°¥é¥à¤ò·«¤êÊÖ¤¹ if (SENSOR_3 == 1){ //¥¿¥Ã¥Á¥»¥ó¥µ¤¬È¿±þ¤·¤¿¤é¡¡ PlaySound(2); //²»¤ò¤Ê¤é¤·¤Æ can_turn(); //´Ì¤òÂऱ¤ë } else {¡¡//¥¿¥Ã¥Á¥»¥ó¥µ¤¬È¿±þ¤·¤Ê¤«¤Ã¤¿¤é normal_trace(); //¡¡Ä̾ï¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹ } } repeat(3) { //¢¤ËÍ褿¤é¸òº¹ÅÀ¤ò£³²ó¤ï¤¿¤ë across_line(); } circle_trace(); //£¤ËÍ褿¤é¾®±ß¤ò²ó¤ë across_line(); //¾®±ß¤ò¤Ì¤±¤ë while(true){ normal_trace(); //Ä̾ï¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹ } } *¹©Éפ·¤¿ÅÀ [#l399870a] +¥¢¡¼¥à¤Ï¥â¡¼¥¿¡¼£±¤Ä¤Ç¤«¤®ÄޤηÁ¤Ë¤¹¤ë¤³¤È¤Ç¡¢¤·¤Ã¤«¤ê¤Ä¤«¤à¤³¤È¤¬¤Ç¤¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£ +¥¿¥¤¥ä¤Î¥â¡¼¥¿¡¼¤Î¥¹¥Ô¡¼¥É¤ò2¤È1¤ò»È¤Ã¤Æ¤¤¤ë¤Î¤Ï¡¢ºÇ½é¤Ï7¤È2¤ò»È¤Ã¤Æ¤¤¤¿¤¬¥¹¥Ô¡¼¥É¤Îº¹¤¬Â礤¤¤¿¤á¥í¥Ü¥Ã¥È¤¬º¸±¦¤Ë¤Ö¤ì¤Æ¡¢¤Ê¤«¤Ê¤«Á°¤Ë¿Ê¤Þ¤Ê¤¤¤¿¤áÊѹ¹¤·¤¿¡£ +¸òº¹ÅÀ¤òÅϤëºÝ¤Ë¥«¥¦¥ó¥¿¤¬¤¦¤Þ¤¯»È¤¨¤º¡¢¥×¥í¥°¥é¥à¤ò¸«Ä¾¤·¤¿¤é¥ß¥¹¤òȯ¸«¤·¡¢Ä¾¤¹¤³¤È¤¬¤Ç¤¤¿¡£ +¾®±ß¤ò²ó¤ë¤Î¤¬¤¦¤Þ¤¯¤¤¤«¤º±ß¤«¤é¤Ï¤ß½Ð¤¹¤¿¤á¡¢º¸¤Î¥â¡¼¥¿¡¼¤À¤±¥Ð¥Ã¥¯¤µ¤»¤ë¥×¥í¥°¥é¥à¤òÁȤ߹þ¤ó¤À¤é²ó¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£ +¥×¥í¥°¥é¥à¤Ï̵Â̤ʤ¯ºî¤ì¤¿¤È»×¤¦¡£ *²þÁ±ÅÀ [#y6b316fc] -ÏӤΥ⡼¥¿¡¼¤Îµ¡¹½¤¬½Å¤¯¤Ê¤Ã¤Æ¤·¤Þ¤¤¡¢¸å¤í¤Î¥¿¥¤¥ä¤¬É⤤¤Æ¤·¤Þ¤Ã¤¿¤Î¤Ç¡¢·ÚÎ̲½¤¹¤ëɬÍפ¬¤¢¤ë¡£ -¥¿¥¤¥Þ¡¼¤ò»È¤ï¤Ê¤¤¥×¥í¥°¥é¥à¤òÁȤߤ¿¤¤¡£ -´Ì¤ò£±¤Ä¤·¤«Âऱ¤ì¤Æ¤Ê¤¤¤Î¤Ç¡¢£²¤Ä¤Î¥×¥í¥°¥é¥ß¥ó¥°¤âºî¤ê¤¿¤«¤Ã¤¿¡£ *´¶ÁÛ [#a4ad8d1c] ¥«¥¦¥ó¥¿¤¬»È¤¨¤º¥¿¥¤¥Þ¡¼¤ËÍê¤è¤¦¤È»×¤Ã¤¿¤¬¡¢¤Þ¤µ¤«¼«Ê¬¤Î¥×¥í¥°¥é¥à¤¬´Ö°ã¤Ã¤Æ¤¤¤ë¤È¤Ï»×¤ï¤Ê¤«¤Ã¤¿¡£¿¼¤¯È¿¾Ê¤·¤¿¤¤¡£ ¥¢¡¼¥à¤ÎÀ½ºî¤¬¤¢¤Þ¤ê»þ´Ö¤ò¼è¤ì¤º¡¢´Ê°×¤Ç²õ¤ì¤ä¤¹¤¤¤â¤Î¤Ë¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿¤Î¤¬¾¯¤·¿´»Ä¤ê¤À¤Ã¤¿¡£ Æó¿Í¤Ç¶¨ÎϤ·¤Æ¥í¥Ü¥Ã¥È¤òºî¤Ã¤Æ¤¤¤ì¤Ð¤â¤¦¾¯¤·´°À®ÅÙ¤¬¹â¤¯¤Ê¤Ã¤¿¤«¤â¤·¤ì¤Ê¤¤¡£