[[2019a/Member]] #contents *²ÝÂꡦÊý¿Ë [#tf80aef5] **¥Ý¥ê¥·¡¼ [#q02baee2] ¤Þ¤º¡¢²ÝÂê¤ä¥í¥Ü¥Ã¥È¤¬¶ñÂÎŪ¤ËÌÀ¤é¤«¤Ë¤Ê¤ëÁ°¤Ë¡¢·è¤á¤Æ¤¤¤¿¤³¤È¤¬¤¢¤ë¡£~ ¤½¤ì¤Ï¡¢ºîư®ÅÙ¤ÏÃÙ¤¯¤Æ¤â¡¢Àµ³Î¤Ëưºî¤¹¤ë¥í¥Ü¥Ã¥È¤òºî¤í¤¦¤È¤¤¤¦¤³¤È¤Ç¤¢¤ë¡£~ **²ÝÂê [#s6a09795] º£²ó¤Î²ÝÂê3¤Ï¡Ä~ ²ÝÂê2¤Ç»ÈÍѤ·¤¿»æ¤ò»ÈÍѤ·2¤Ä¤ò¾å²¼µÕ¤Ë¤Ê¤ë¤è¤¦¤ËÁȤ߹ç¤ï¤»¤Æ¥Õ¥£¡¼¥ë¥É¤È¤¹¤ë¡£~ À¸¶¨¤Î¤ªÊÛÅö¤Î»Í³Ñ¤¤¥×¥éÍÆ´ï2¤Ä¤ò¤½¤ì¤¾¤ì±ßÆâ¤ËÃÖ¤¡¢ÊÒÊý¤Ë¶Ì¤ò2¸ÄÆþ¤ì¤ë¡£~ »Ä¤ê¤Î2¸Ä¤Î¶Ì¤Ï²ÝÂê2¤ÈƱ¤¸°ÌÃÖ¤ËÃÖ¤¯¡£~ ¤½¤ì¤é¤Î¶Ì¤ò¡¢¶õ¤ÎÍÆ´ï¤ÎÊý¤ËÆþ¤ì¤ë¡£~ ¥Õ¥£¡¼¥ë¥É(Z,Z'¤ª¤è¤Ó2Ëç¤Î¶³¦¤Î¥é¥¤¥ó¤Ï¥ë¡¼¥ë¤Ë§¤Ã¤ÆÉÕ¤±²Ã¤¨¤¿¡Ë~ &ref(¥³¡¼¥¹.jpeg); **Êý¿Ë [#f59d202b] ¥é¥¤¥ó¤ò¤¿¤É¤Ã¤Æ¥Ü¡¼¥ë´Ö¤ò°Üư¡¢¤½¤Î¹ç´Ö¤Ë¥Ü¡¼¥ë¤ÎÊä¡¢²òÊü¤ò¤·¤Æ¥ß¥Ã¥·¥ç¥ó¤òãÀ®¤¹¤ë¡£ *¥Ï¡¼¥É [#t554702d] 2ÂæÏ¢·È¤Ç¤Ï¥¿¥¤¥ß¥ó¥°¤è¤¯Ï¢·È¤ò¼è¤ì¤ë¤«¤É¤¦¤«¤Ë¤ª¤¤¤ÆÉÔ³ÎÄ꤫¤È´¶¤¸¤¿¤Î¤Ç¡¢°ìÂη¿¤Ë¤·¡¢Âå¤ï¤ê¤Ë¥¹¥Ú¥Ã¥¯¸þ¾å¤òÌܻؤ·¤¿¡£ **¥ë¡¼¥ë¤Ë½¾¤¦¤¿¤á¤Ë [#q9277dd4] ¥í¥Ü¥Ã¥È¤ÏA¤Î»Í³Ñ¤¤ÏÈ¤ËÆþ¤é¤Ê¤¯¤Æ¤Ï¤¤¤±¤Ê¤¤¤Î¤Ç¡¢¤Ç¤¤ë¤À¤±¥³¥ó¥Ñ¥¯¥È¤Ë¤Ê¤ë¤è¤¦¤Ë¤·¤¿¡£~ ¤½¤ÎºÝ¡¢²ÝÂê1¤ÇºîÀ®¤·¤¿¥í¥Ü¥Ã¥È¤Î¡Ø°ÜưÍѥ⡼¥¿¡¼¤ò¾å¤«¤éÄߤ겼¤²¤ë¡Ù¤È¤¤¤¦¥¢¥¤¥Ç¥¢¤ò»²¹Í¤Ë¤·¤¿¡£~ **¹½À®°Æ [#w9d2426c] -¥®¥¢¤ò»È¤Ã¤Æ¥â¡¼¥¿¡¼°ì¤Ä¤Çº¸±¦¤«¤éƱ»þ¤Ë¶´¤á¤ë¥¯¥ì¡¼¥ó¥²¡¼¥à¤Î¤è¤¦¤Ê¥¢¡¼¥à¤ò¤Ä¤±¤ì¤Ð¤è¤¤¤Î¤Ç¤Ï~ -¤½¤Î¥¢¡¼¥à¤ò¾å²¼¤µ¤»¤ëµ¡¹½¤¬É¬ÍפǤϤʤ¤¤«~ -¤ä¤Ï¤ê°Üư¤Î¥â¡¼¥¿¡¼¤Ï°ÂÄêÀ¤Î¤¿¤á¤Ë¥®¥¢¤¬É¬ÍפǤϤʤ¤¤«~ -¿§³Ð¥»¥ó¥µ¡¼¤ò2¤ÄÅëºÜ¤·¤Æ¥é¥¤¥ó¥È¥ì¡¼¥¹¤òº¸±¦¤Îü¤ò·è¤á¤º¤Ë¤Ç¤¤ë¤è¤¦¤Ë¤·¤¿Êý¤¬°ÂÄꤹ¤ë¤Î¤Ç¤Ê¤¤¤«~ -Ͳ»ÇÈ¥»¥ó¥µ¡¼¤ò»È¤Ã¤Æ¥Ü¡¼¥ë¤È¤Îµ÷Î¥¤ò¬¤ì¤ÐÎɤ¤¤Î¤Ç¤Ï¤Ê¤¤¤«~ ¤Ê¤É¤Î°Æ¤¬½Ð¤¿ **¹½À®°Æ¼Â¸½¤Î¤¿¤á¤Ë [#a9abcc92] ʬô¤ò¤·¤Æ¥Ñ¡¼¥Ä¤´¤È¤ÇÁȤळ¤È¤Ë¤·¤¿¡£~ ¤½¤ì¤ò»ý¤Á´ó¤Ã¤Æ¡¢¸ß¤¤¤Ë²þÎɤ·¤Æ¤¤¤±¤Ð¹¹¤Ë¹âÅ٤ʤâ¤Î¤¬¤Ç¤¡¢¸úΨ²½¤Ë¤â·Ò¤¬¤ë¤È¹Í¤¨¤¿¤¿¤á¤Ç¤¢¤ë¡£~ **³µ·Á´°À®¸å¤Î¥Æ¥³Æþ¤ì [#ie60f14f] ¤½¤Î¡Ø»ý¤Á´ó¤ê¡Ù¤ÎÀè¤Ç¡¢´°À®¸å¤â¿·¤¿¤ËÊѹ¹¤·¤¿ÅÀ¤Ë¤Ä¤¤¤Æ¤Ç¤¢¤ë¡£ ***ľ¾å·¿¥â¡¼¥¿¡¼ÇÛÃÖ [#a46f5c41] Àè½Ò¤ÎÄ̤ꡢ¥³¥ó¥Ñ¥¯¥È·¿¤Ë¤¹¤ë¤¿¤á¤Ë²ÝÂê1¤Ç¤Î¥í¥Ü¥Ã¥È¤ò»²¹Í¤Ë¤³¤Î¹½Â¤¤ò¤È¤Ã¤¿¡£~ ¤½¤Î¤Û¤«¤Ë¤â¡¢²£ÃÖ¤·¿¤Î¥â¡¼¥¿¡¼ÇÛÃÖ¤ÇÀ߷פ·¤¿¤È¤³¤í¡¢Á´ÂΤËÉÔ°ÂÄê¤Ê¥í¥Ü¥Ã¥È¤Ë¤Ê¤Ã¤Æ¤·¤Þ¤¤¡¢¤½¤Î²þÁ±¤È¤¤¤¦Íýͳ¤¬¤¢¤ë¡£ »²¹Í:²ÝÂê1¤Î¥í¥Ü¥Ã¥È &ref(v1robot.jpeg); ¤½¤Î¤Û¤«¤Ë¤â¡¢²£ÃÖ¤·¿¤Î¥â¡¼¥¿¡¼ÇÛÃÖ¤ÇÀ߷פ·¤¿¤È¤³¤í¡¢Á´ÂΤËÉÔ°ÂÄê¤Ê¥í¥Ü¥Ã¥È¤Ë¤Ê¤Ã¤Æ¤·¤Þ¤¤¡¢¤½¤Î²þÁ±¤È¤¤¤¦Íýͳ¤¬¤¢¤ë¡£~ »²¹Í:²ÝÂê1¤Î¥í¥Ü¥Ã¥È~ &ref(v1robot.jpeg);~ ***¥¯¥ì¡¼¥óÀè [#h553004e] ¥¯¥ì¡¼¥óÀè¤Î¥¢¡¼¥à¤Ï¥¯¥ì¡¼¥ó¥²¡¼¥à¤Î¤è¤¦¤ËåÌÌ©¤ÊÁàºî¤Ç¤Ê¤¯¤Æ¤â¡¢³Î¼Â¤ËºÙ¤¯¤Ç¤¤ë¤â¤Î¤È¤·¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£¤·¤¿¤¬¤Ã¤Æ¡¢Çظå¤ËÊɤòÀߤ±¤¿¤ê¡¢Á°¸å¤ÎÊäÂÈϰϤò¹¤¯¤·¤¿¤ê¡¢µÕ¤Ë¥×¥éÍÆ´ï¤Ë¼ý¤Þ¤ë¤è¤¦¤Ë²£Éý¤ò¶Ë¸Â¤Þ¤Çºï¤Ã¤¿¤ê¤·¤¿¡£ ***¥¯¥ì¡¼¥ó´ØÏ¢¤Î¥®¥¢ [#u52477b9] -Åö½é¤ÏƱ¤¸¤â¤Î¤ò¥¢¡¼¥à¤¸¤å¤¦¤Ë¤Ä¤¿¤ï¤»¤Æ¡¢¥·¥ó¥×¥ë¤Ê¹½Â¤¤Ë¤·¤Æ¤¤¤¿¤¬¡¢¼ã´³¥¬¥¯¥¬¥¯¤·¤¿¤ê¤ÇÉÔ°ÂÄê¤À¤Ã¤¿¤¿¤á¡¢¥®¥¢¤¬ºÇ¤â³ú¤à¹½Â¤¤òõ¤·¤Æ¿·¤·¤¤ÁȤ߹ç¤ï¤»¤ËÊѹ¹¤·¤¿¡£ -«¤é¥®¥¢¤Ç¶´¤à¤³¤È¤Ç¡¢¥¢¡¼¥à¤ÎϢưÀ¤â¾å¤¬¤Ã¤¿¡£ ***¥¯¥ì¡¼¥ó¾å²¼Íѥ⡼¥¿¡¼¤Î¼þÊÕ¥®¥¢ [#fc3d87c8] ¥¯¥ì¡¼¥ó¤ò¤â¤Á¤¢¤²¤ë¤Î¤Ï¤¿¤Ã¤¿°ì¤Ä¤Î¥â¡¼¥¿¡¼¤Ê¤Î¤Ç¡¢Â®¤µ¤è¤ê¤â°µÅÝŪ¤Ë¥Ñ¥ï¡¼¤¬É¬ÍפȤʤä¿¡£~ ¤Ê¤Î¤Ç¡¢Èæ½Å¤ÎÂ礤¤¥®¥¢¤òºÎÍѤ·¤¿¡£ ***¥À¥Ö¥ë¥«¥é¡¼¥»¥ó¥µ¡¼ [#q9283bdb] ²ÝÂê2¤ÈƱÍÍ¡¢¿§³Ð¥»¥ó¥µ¡¼¤Î°ÌÃ֤ˤ³¤À¤ï¤Ã¤¿¡£ºîÀ®¤·¤¿¥×¥í¥°¥é¥à¤ÎÅÔ¹ç¾å¡¢¥é¥¤¥ó¤Î²£Éý¤è¤ê¤â¾¯¤·¤À¤±Ã»¤¤¤¯¤é¤¤¤Î²£Éý¤¬¤Á¤ç¤¦¤ÉÎɤ¤¡£Á°¸å´Ø·¸¤â¡¢Á°²óƱÍÍ¡¢°Üư¤Î¥â¡¼¥¿¡¼¤è¤ê¤ï¤º¤«¤ËÁ°Êý¤È¤¤¤¦¤Õ¤¦¤Ë¤·¤¿¡£ **ºÇ½ªÅª¤Ê¹½À® [#b8e6a18c] ¥×¥í¥°¥é¥à¤ÎÁȤߤ䤹¤µ¤ò¹Í¤¨¤ë¤È°Ê²¼¤ÎÄ̤ê¤È¤Ê¤Ã¤¿¡£Ä¶²»ÇÈ¥»¥ó¥µ¡¼¤Ï»þ´Ö¤¬¤Ê¤«¤Ã¤¿¤¿¤áÉÔºÎÍÑ¡£~ &ref(system.jpeg); **´°À®·Ï [#p574c054] ¥¯¥ì¡¼¥ó¤Î·Ï~ &ref(clane.jpeg); &ref(clane.jpeg);~ ¤½¤ì°Ê³°¤Î(¥é¥¤¥ó¥È¥ì¡¼¥µ¡¼¡Ë~ &ref(tracer.jpeg); &ref(tracer.jpeg);~ Á´ÂÎÁü~ &ref(v3robot.jpeg); &ref(v3robot.jpeg);~ **¤Þ¤È¤á [#i8c2d495] -³Î¼Â¤Ë¥Ü¡¼¥ë¤òª¤¨¤ë¤³¤È¤¬¤Ç¤ -°ÂÄꤷ¤ÆÁöÇˤǤ~ ¤ë¤¿¤á¤Î¹©Éפò¶Å¤é¤·¤¿¡£ *¥×¥í¥°¥é¥à [#ub2b3db5] **Ï¢·È [#p8edf9fd] ÆóÂæ¤Ïbluetooth¤ÇÏ¢·È¤·¤Æ¤¤¤ë¡£¥é¥°¤Î¹Íθ¤È¤·¤Æ¡¢short_break(¾®µÙ·Æ)¤Ê¤É¤ò»È¤Ã¤Æ¤Ä¤ê¤¢¤¤¤ò¤È¤ë¡£ **Ãí°Õ¤·¤¿ÅÀ [#ee2b0939] ¸úΨ¤Ë¤âÌܤò¸þ¤±¤Æ¡¢ºî¶ÈÃæ¤âÃí¼áʸ¤ä¥Ó¡¼¥×²»¤ò»È¤Ã¤Æ½¤Àµ²Õ½ê¤òȯ¸«¤·¤ä¤¹¤¯¤·¤¿¡£~ **¥ë¡¼¥È [#ma530ef8] ¹õ¤¤¥é¥¤¥ó¤òé¤ë¤³¤È¤Î¤ß¤Î°Üư¤È¤·Á´¤Æ¤Î¹ÔÄø¤ò³Î¼Â¤Ê¤â¤Î¤Ë¤·¤¿¡£~ **SLAVE [#pc3ef195] SLAVE¤Î¤Ê¤¹Áàºî¤Ï¡¢¥Ü¡¼¥ë¤ò¥Û¡¼¥ë¥É¡¢¥ê¥ê¡¼¥¹¤·¤¿¤ê¡¢¥¯¥ì¡¼¥ó¤ò¾å¾º¡¦²¼¹ß¤·¤¿¤ê¤ÈÍýÏÀ¾å¤Ïñ½ã¤Ê¤â¤Î¤Ð¤«¤ê¤Ç¤¢¤ë¡£~ ~ ¤Þ¤º¥á¡¼¥ë¥Ü¥Ã¥¯¥¹ÍѤΥʥó¥Ð¡¼¤òÄêµÁ¤·¤Æ¡Ä~ #define ball_release 11 #define ball_catch 12 #define arm_up 13 #define arm_down ¡¡14 #define completed 15 #define up_catch 16 #define down_release 17 ¤¢¤È¤Ï¼õ¤±¼è¤Ã¤¿ÈÖ¹æ¤Ë¹ç¤ï¤»¤ÆÆ°ºî¤¹¤ë¤Î¤ß¤Ç¤¢¤ë¡£(¥»¥ó¥µ¡¼¤Ê¤·¤ÎÀ©¸æ¤È¤Ê¤ë¤Î¤Ç¡¢¤³¤³¤ÎÄ´À°¤Ë»þ´Ö¤ò³ä¤«¤ì¤¿¡£¶ìÏ«¤·¤¿¡£)~ task main() { int msg; while(true){ ReceiveRemoteNumber(MAILBOX1,true,msg); if(msg==ball_release){ //¥á¥Ã¥»¡¼¥¸¤¬ball_release¤Ê¤é¤Ð OnFwd(OUT_A,50);Wait(500);Off(OUT_A);Wait(500);//¡Ê¥Ü¡¼¥ë¤òÊü¤¹Æ°ºî¡Ë SendResponseNumber(MAILBOX1,completed); ¡¡//completed¤È¤¤¤¦¥á¥Ã¥»¡¼¥¸¤ò master¤ËÁ÷¤ë(°Ê²¼¤³¤ì¤ËÊ臘) } //¥Ü¡¼¥ë¤ò¥ê¥ê¡¼¥¹¤¹¤ëưºî if(msg==ball_catch){ OnRev(OUT_A,50);Wait(600);Off(OUT_A);Wait(500); SendResponseNumber(MAILBOX1,completed); } //¥Ü¡¼¥ë¥¥ã¥Ã¥Á¤¹¤ëưºî if(msg==arm_up){ OnFwd(OUT_B,50);Wait(600); OnFwd(OUT_B,5);Wait(500); SendResponseNumber(MAILBOX1,completed); } //¥¯¥ì¡¼¥ó¤ò¾å¤²¤ëưºî if(msg==arm_down){ OnRev(OUT_B,30);Wait(600); OnFwd(OUT_B,5);Wait(500); SendResponseNumber(MAILBOX1,completed); } //¥¯¥ì¡¼¥ó¤ò²¼¤²¤ëưºî if(msg==up_catch){ OnFwd(OUT_B,40);OnRev(OUT_A,15);Wait(300); SendResponseNumber(MAILBOX1,completed); } //¥Ü¡¼¥ë¤ò¥¥ã¥Ã¥Á¤·¤Ê¤¬¤é ¥¯¥ì¡¼¥ó¤ò¾å¤²¤ëưºî if(msg==down_release){ OnRev(OUT_B,10);OnFwd(OUT_A,20);Wait(150); SendResponseNumber(MAILBOX1,completed); } //¥Ü¡¼¥ë¤ò¥¥ã¥Ã¥Á¤·¤Ê¤¬¤é ¥¯¥ì¡¼¥ó¤ò²¼¤²¤ëưºî Wait(100); //¾®µÙ·Æ(¥é¥¸¥³¥ó¤Î²ÝÂê¤Î»þ ¤³¤ì¤¬¤Ê¤±¤ì¤Ð¥«¥¯¥«¥¯¤·¤¿Æ°ºî¤È¤Ê¤ê¡¢¤Á¤ç¤Ã¤È¤º¤Ä¤·¤«Æ°¤«¤Ê¤¤¤È¤¤¤¦¤³¤È¤ÇÆþ¤ì¤¿¡£¤½ ¤Î̾»Ä¡£º£¤Ïifʸ¤ÎÃæ¤Îưºî¤Çwait¤¬»È¤ï¤ì¤Æ¤¤¤ë¤Î¤ÇɬÍפ¬¤Ê¤«¤Ã¤¿¤«¤â¤·¤ì¤Ê¤¤) msg=0; //¥á¥Ã¥»¡¼¥¸¤ò¥ê¥»¥Ã¥È¡ª } //whileÊÄ } //task mainÊÄ **MASTER [#ib2e4e7e] ***define¤È¥µ¥Ö¥ë¡¼¥Á¥ó [#he52402a] ÀâÌÀ¤ÎÁ°Ãʳ¬¤È¤·¤ÆÄêµÁ¤È¥µ¥Ö¥ë¡¼¥Á¥ó¤ò¾Ò²ð¤·¤Æ¤ª¤¯~ -define¤Î¾Ò²ð~ #define KOSATEN 37 //¿§³Ð¥»¥ó¥µ¡¼¹õ¤Î¤·¤¤¤ÃÍ¡£¸òº¹ÅÀȽÊÌÍÑ #define completed 15 //slave¤«¤éÁ÷¤é¤ì¤ë¼Â¹ÔºÑ¤ß¤È¤¤¤¦¥á¥Ã¥»¡¼¥¸ #define turn_left OnRev(OUT_A,70);OnFwd(OUT_B,70); //º¸±¦µÕ²óž¤Îº¸²óž #define go_left OnRev(OUT_A,85);Off(OUT_B); //º¸Á°Êýľ¿Ê #define go_straight OnRev(OUT_AB,70); //ľ¿Ê #define go_right OnRev(OUT_B,85);Off(OUT_A); //±¦Á°Êýľ¿Ê #define turn_right OnRev(OUT_B,100);OnFwd(OUT_A,100) //º¸±¦µÕ²óž¤Î±¦²óž #define short_break Off(OUT_AB);Wait(1000); //¾®µÙ·Æ¡£¿§¡¹¤Ê»þ´ÖŪĴÀ°ÍÑ #define brake Off(OUT_AB) //¥Ö¥ì¡¼¥ define_¤½¤Î¾ÀâÌÀ~ --²¿¸ÎµÕ²óž¤Î±¦²óž¤¬¥Ñ¥ï¡¼100¤Ê¤Î¤«¤Ïº£¹Í¤¨¤ë¤ÈÉÔÌÀ¡£(¥ß¥¹¤«¤â¤·¤ì¤Ê¤¤) --¤½¤ì¤¾¤ì¤Îưºî¤Î¥Ñ¥ï¡¼¤ÎÂ礤µ¤Ï¡¢Æâ¦¤Ë¹Ô¤¯Æ°¤¤ÎÂ礤µ¤ËÈæÎ㤵¤»¤¿¡£¤³¤Î¤³¤È¤Ç¥¿¥¤¥Þ¡¼¤ò»È¤¦»þ¤Ë°ãÏ´¶¤¬¤Ê¤¯¤Ê¤ë¡£ --break(¾®µÙ·Æ)¤Èbrake(¥Ö¥ì¡¼¥)¤ÏÄ֤꤬»÷¤Æ¤¤¤ë¤¬°ÕÌ£¤Ï°Û¤Ê¤ë¡£¤½¤Î°ÕÌ£¤Ë¹ç¤ï¤»¤Æ¹ç¤ï¤»¤Æ»È¤¤Ê¬¤±¤¿¡£ -sub¤ÎÀâÌÀ~ sub follow_line() ¡¡¡¡¡¡¡¡ //¸òº¹ÅÀ¼±Ê̤¢¤ê¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹ { while((SENSOR_1>KOSATEN)||(SENSOR_2>KOSATEN)){ int d=SENSOR_1-SENSOR_2; if (d<-6){ turn_right; }else if (d<-3){ go_right; }else if (d<=3){ go_straight; }else if (d<=6){ go_left; }else { turn_left; } } PlaySound(SOUND_CLICK); brake;Wait(200); } sub follow_line2(int followtime) //¥¿¥¤¥Þ¡¼¤ò»È¤¤µ÷Î¥¤ò¬¤ë¥é¥¤¥ó¥È¥ì¡¼¥¹ { long t0=CurrentTick(); while(CurrentTick()-t0<followtime){ int d=SENSOR_1-SENSOR_2; if (d<-6){ turn_right; }else if (d<-3){ go_right; }else if (d<=3){ go_straight; }else if (d<=6){ go_left; }else { turn_left; } } PlaySound(SOUND_CLICK); brake;Wait(200); } sub chokusinL() //ľ¿Êº¸ { go_left;Wait(500); //Wait¤ÏÄ´À° } sub chokusinR() //ľ¿Ê±¦ { go_right;Wait(500); //Ʊ¾å } sub sasetsu() //º¸ÀÞ { turn_left;Wait(500); //º¸²óž¤Èº¸Á°Êýľ¿Ê¤Î¹ç¤ï¤»µ» go_left;Wait(500); //Ʊ¾å } sub usetsu(int migi) //±¦ÀÞ(¹ÔÄø¤Ë´Þ¤Þ¤ì¤ë±¦Á°Ä¾¿Ê¤Îưºî¤Ï¡¢´Ø¿ô²½¡Ë { turn_right;Wait(500); //±¦²óž¤È±¦Á°Êýľ¿Ê¤Î¹ç¤ï¤»µ» go_right;Wait(migi); //Ʊ¾å } sub turn_behind() //¿¶¤ê¸þ¤¯ { turn_left;Wait(1000); //±¦¤Î¿§³Ð¥»¥ó¥µ¡¼¤¬Çò¤Ë¤Ê¤ëÄøÅÙº¸²óž(¥é¥¤¥ó¥È¥ì ¡¼¥¹¤ò¥¹¥È¥Ã¥×¤µ¤»¤ë¡Ë while(SENSOR_1>KOSATEN){ //±¦¤Î¿§³Ð¥»¥ó¥µ¡¼¤¬¹õ¤Ë¤Ê¤ë¤Þ¤Ç turn_left; //º¸¤Ë²óž¤·¤í } Off(OUT_BC); //¥Ö¥ì¡¼¥¤ÎÌò³ä } sub backleft() //¸åÂष±¦¤ò¸þ¤¯ { OnFwd(OUT_A,100);Off(OUT_B);Wait(1500);//¡Ê»þ´ÖÄ´À°¤Î¤¿¤Þ¤â¤Î¡Ë turn_right;Wait(600); Off(OUT_AB); } sub backright() //¸åÂषº¸¤ò¸þ¤¯ { OnFwd(OUT_B,100);Off(OUT_A);Wait(1400);//Ʊ¾å turn_left;Wait(500); Off(OUT_AB); } sub ball_catch() //¶Ì¤òÄϤà(slave¤Îưºî) { int msg; SendRemoteNumber(1,MAILBOX1,12); while(msg==completed){ ReceiveRemoteNumber(MAILBOX1,true,msg); } } sub ball_release() //¶Ì¤òÊü¤¹(slave¤Îưºî) { int msg; SendRemoteNumber(1,MAILBOX1,11); while(msg==completed){ ReceiveRemoteNumber(MAILBOX1,true,msg); } } sub arm_up() //¥¢¡¼¥à¤ò¾å¤²¤ë(slave¤Îưºî¡Ë { int msg; SendRemoteNumber(1,MAILBOX1,13); while(msg==completed){ ReceiveRemoteNumber(MAILBOX1,true,msg); } } sub arm_down() //¥¢¡¼¥à¤ò²¼¤²¤ë(slave¤Îưºî) { int msg; SendRemoteNumber(1,MAILBOX1,14); while(msg==completed){ ReceiveRemoteNumber(MAILBOX1,true,msg); } } sub up_catch() //¥¢¡¼¥à¤ò¾å¤²¤Ê¤¬¤éÊĤ¸¤ë(slave¤Îưºî) { int msg; SendRemoteNumber(1,MAILBOX1,16); while(msg==completed){ ReceiveRemoteNumber(MAILBOX1,true,msg); } } sub down_release() //¥¢¡¼¥à¤ò²¼¤²¤Ê¤¬¤é³«¤¯(slave¤Îưºî) { int msg; SendRemoteNumber(1,MAILBOX1,17); while(msg==completed){ ReceiveRemoteNumber(MAILBOX1,true,msg); } } sub_¤½¤Î¾¤ÎÀâÌÀ -master¤¬¹Ô¤¦±¦ÀÞ¡¦º¸ÀÞ¡¦Ä¾¿Ê±¦¡¦Ä¾¿Êº¸¡¦Ä¾¿Ê¤Ê¤É¤Ï¸òº¹ÅÀ¤ä¶Ê¤¬¤ê³Ñ¤Ê¤É¡¢¿§³Ð¥»¥ó¥µ¡¼¤ÇÄ´À°¤¬¤Ä¤¤Ë¤¯¤¤¤È¤³¤í¤ò¸¶»ÏŪ¤Ëưºî¤Î»þ´ÖÄ´À°¤À¤±¤Ç²ò·è¤Ç¤¤ë¤è¤¦¤Ë¥«¥¹¥¿¥Þ¥¤¥º¤·¤¿¤â¤Î¤Ç¤¢¤ë¡£define¤Ç»È¤Ã¤¿¤â¤Î¤ò2½Å¤ËÄêµÁ¤¹¤ë¤È¤¤¤¦¤«¤¿¤Á¤Ë¤Ê¤ë¤¬¡¢define¤Î¤Û¤¦¤Ï¥é¥¤¥ó¥È¥ì¡¼¥¹¤ÎifʸÆâ¤Ç¤â»È¤Ã¤Æ¤¤¤ë¤Î¤Ç»ÅÊý¤¬¤Ê¤¤¡£ ***¿·¥é¥¤¥ó¥È¥ì¡¼¥¹ (º¸±¦2¤Ä¤Î¥«¥é¡¼¥»¥ó¥µ¡¼¤òÍѤ¤¤Æ)[#ae0b0223] ¿§³Ð¥»¥ó¥µ¡¼¤¬Æó¤Ä¤Ë¤Ê¤Ã¤¿¤Î¤Ç¡¢Àµ³Î¤Ë¡¢¥é¥¤¥ó¤Îü¤Ç¤Ï¤Ê¤¯Ãæ±û¤òÁö¤ë¤³¤È¤¬¤Ç¤¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£~ ¤·¤¤¤Ãͤò»È¤Ã¤¿ÊýË¡¤â¤¢¤êÆÀ¤ë¤Î¤À¤¬¡¢¸¦µæ¤·¤¿·ë²Ì¡¢¥·¥ó¥×¥ë¤ÇÈþ¤·¤¤¡¢¡Øº¸±¦Èæ³Ó·¿¡Ù¤ò´ðËÜ·Á¤È¤¹¤ë¤³¤È¤Ë¤·¤¿¡£~ º¸±¦¤òÈæ¤Ù¤Æ¡¢Ãͤ¬¾®¤µ¤¤Êý¤Ëư¤±¤Ð¡¢¹õ¿§¤òé¤ë¤³¤È¤¬¤Ç¤¤ë¤À¤í¤¦¤È¤¤¤¦¥¢¥¤¥Ç¥¢¤Ç¤¢¤ë¡£~ Îã)º¸¤ÎÊý¤¬±¦¤è¤ê¾®¤µ¤±¤ì¤Ðº¸Á°Êý¤Ø¿Ê¤à~ ¶ñÂÎŪ¤Ë¤Ï°Ê²¼¤Î¤è¤¦¤Ê·Á¡Ä~ int d=SENSOR_1-SENSOR_2;//difference¤ÎƬʸ»ú¤ò¤È¤Ã¤Æ d¤ÇSENSOR_1(±¦)¤ÈSENSOR_2(º¸)¤Îº¹¤òÄêµÁ if (d<-6){ //(¾®¤µ¤¤½ç¤«¤é¹Í¤¨¤Æ¤¤¤¯)±¦¤è¤êº¸¤ÎÃͤ¬¶Ëü¤ËÂ礤¤¤Ê¤é¤Ð turn_right; //±¦¤Ë(º¸±¦µÕ¤Ç¤Î)²óž }else if (d<-3){ //±¦¤è¤êº¸¤ÎÃͤ¬¤ï¤º¤«¤ËÂ礤¤¤Ê¤é¤Ð go_right; //±¦Á°¤Ø¿Ê¤à }else if (d<=3){ //º¸±¦¤ÎÃͤ¬¤Û¤ÜƱ¤¸¤Ê¤é¤Ð go_straight; //ľ¿Ê }else if (d<=6){ //º¸¤è¤ê±¦¤ÎÃͤ¬¤ï¤º¤«¤ËÂ礤¤¤Ê¤é¤Ð go_left; //º¸Á°¤Ø¿Ê¤à }else { //º¸¤è¤ê±¦¤ÎÃͤ¬¶Ëü¤ËÂ礤¤¤Ê¤é¤Ð turn_left; //º¸¤Ë(º¸±¦µÕ¤Ç¤Î)²óž } -µ÷Î¥¤Î¬¤êÊý ~ ¥µ¥Ö¥ë¡¼¥Á¥ó¤Î¾Ò²ð¤ÇÌÀ¤é¤«¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤¬¡¢¤â¤¦°ìÅÙ¼¨¤·¤Æ¤ª¤¯~ sub follow_line2(int followtime) //followtime¤Î´Ø¿ôÉÕ¤¥µ¥Ö¥ë¡¼¥Á¥ó¤Ê¤Î¤Ç ÈÆÍÑÀ¤¬¹â¤¤¡£ { long t0=CurrentTick(); //¤³¤Î»þÅÀ¤Ç¤Î»þ¹ï¤òt0¤È¤¹¤ë while(CurrentTick()-t0<followtime){ //´Ø¿ôfollowtime¤è¤ê¤â¡Ø¼Â¹Ô»þ¤Î»þ¹ï-t0¡Ù¤¬ ¾®¤µ¤¤¤È¤¤Î¤ß·«¤êÊÖ¤¹¡£ int d=SENSOR_1-SENSOR_2; //°Ê²¼¾å½Ò¤Î¿·¥é¥¤¥ó¥È¥ì¡¼¥¹ if (d<-6){ turn_right; }else if (d<-3){ go_right; }else if (d<=3){ go_straight; }else if (d<=6){ go_left; }else { turn_left; } } //whileÊÄ PlaySound(SOUND_CLICK); //while¤¬½ª¤ï¤ê¼¡¤Îưºî¤Ø°Ü¹Ô¤¹¤ë¤³¤È¤ò¹ð¤²¤ë brake;Wait(200); //¾®µÙ·Æ } -¸òº¹ÅÀ¤Î¼±ÊÌ ~ ¤³¤Á¤é¤â¥µ¥Ö¥ë¡¼¥Á¥ó¤Ï¾å¤Ç¾Ò²ð¤·¤¿¤¬¡¢¤â¤¦°ìÅÙ¼¨¤¹¡£ sub follow_line() ¡¡¡¡¡¡¡¡ //¸òº¹ÅÀ¼±Ê̤¢¤ê¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹ { while((SENSOR_1>KOSATEN)||(SENSOR_2>KOSATEN)){ //¤¢¤ë¾ò·ï(²¼¤ÇÀâÌÀ¤¹¤ë¡Ë¤ò Ëþ¤¿¤·¤Æ¤¤¤ë´Ö·«¤êÊÖ¤¹¡£ int d=SENSOR_1-SENSOR_2;¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//°Ê²¼¿·¥é¥¤¥ó¥È¥ì¡¼¥¹ if (d<-6){ turn_right; }else if (d<-3){ go_right; }else if (d<=3){ go_straight; }else if (d<=6){ go_left; }else { turn_left; } } //whileÊÄ PlaySound(SOUND_CLICK); //while¤¬½ª¤ï¤ê¼¡¤Îưºî¤Ø°Ü¹Ô¤¹¤ë¤³¤È¤ò¹ð¤²¤ë brake;Wait(200); //¾®µÙ·Æ } ¤¢¤ë¾ò·ï¤Ë¤Ä¤¤¤Æ~ °Ọ̃Ū¤Ë¤Ï¡¢º¸±¦Î¾Êý¹õ¤È¤Ê¤é¤Ê¤¤¡£¤³¤È¤Ê¤Î¤À¤¬¡¢~ ÏÀÍýÀѤǤʤ¯ÏÀÍýϤòÍѤ¤¤¿¡£¹â¹»¿ô³Øµ¤Ç½¬¤¦¤³¤È¤À¤¬¡¢~ ¥É¡¦¥â¥ë¥¬¥ó¤ÎÄêÍý¡§¡Ö¡É¾ò·ïA¡É¤Þ¤¿¤Ï¡É¾ò·ïB¡É¤ÎÈÝÄê¡×¤Ï¡Ö¡É¾ò·ïA¤ÎÈÝÄê¡É¤«¤Ä¡É¾ò·ïB¤ÎÈÝÄê¡É¡×Åù¤·¤¤~ ¤È¤¤¤¦ÄêÍý¤¬¤¢¤Ã¤¿¡£~ ¤³¤³¤Ç¤ÏSENSOR_1¤âSENSOR_2¤â¡É¹õ¤Ç¤Ê¤¤¡É¤È¤¤¤¦ÈÝÄê¤Î¾ò·ï¤ÎÀѽ¸¹ç¤ò¼è¤ê¤¿¤¤¤Î¤Ç¡¢ÏÀÍýϤòÍѤ¤¤¿¡£ ***task main(Á´ÂΤιÔÄø¤ÎÀâÌÀ¡Ë [#i1552100] ²¼½àÈ÷¤ÏÀ°¤Ã¤¿¤Î¤Ç¡¢Í½Äꤷ¤¿¥³¡¼¥¹¤Ë½¾¤Ã¤Æ¤¤¤¯¡£(»²¾È¤Î¥¢¥ë¥Õ¥¡¥Ù¥Ã¥É¤ò¥×¥í¥°¥é¥à¤ÎÀâÌÀÉôʬ¤Ë¼¨¤¹¡Ë~ ͽÄê¤Î¥ë¡¼¥È~ &ref(¥ë¡¼¥È.jpeg); task main() { SetSensorLight(S1); //±¦¥«¥é¡¼¥»¥ó¥µ¡¼ SetSensorLight(S2); //º¸¥«¥é¡¼¥»¥ó¥µ¡¼ arm_up(); //¥¯¥ì¡¼¥ó¾å¾º¡Ê°Ê²¼Æ±¥³¥Þ¥ó¥ÉÀâÌÀά¡Ë short_break; //¢¨£± ball_release(); //¥Ü¡¼¥ë¤ò¥ê¥ê¡¼¥¹¡Ê¥¢¡¼¥à³«¡Ë¡Ê°Ê²¼Æ±¥³¥Þ¥ó¥ÉÀâÌÀά¡Ë go_straight;Wait(2000); //M¤Þ¤Çľ¿Ê follow_line(); //¸òº¹ÅÀȽÊÌÉÕ¤¥é¥¤¥ó¥È¥ì¡¼¥¹¡Ê°Ê²¼Æ±¥³¥Þ¥ó¥ÉÀâÌÀά¡Ë chokusinR(); //K follow_line2(1500); //KL´Ö¤ò»þ´Ö¤ò¬¤ê¤Ê¤¬¤é¥é¥¤¥ó¥È¥ì¡¼¥¹ short_break; //L arm_down(); //¥¯¥ì¡¼¥ó¹ß²¼¡Ê°Ê²¼Æ±¥³¥Þ¥ó¥ÉÀâÌÀά¡Ë short_break; //¢¨£± ¤³¤³¤è¤ê1µåÌÜ ball_catch(); //¥Ü¡¼¥ë¥¥ã¥Ã¥Á¡Ê¥¢¡¼¥àÊġˡʰʲ¼Æ±¥³¥Þ¥ó¥ÉÀâÌÀά¡Ë short_break; //¢¨£± arm_up(); short_break; //¢¨£± turn_behind(); //¿¶¤êÊ֤äÆÊý¸þž´¹¡Ê°Ê²¼Æ±¥³¥Þ¥ó¥ÉÀâÌÀά¡Ë follow_line(); chokusinL(); //K follow_line(); usetsu(500); //M follow_line(); sasetsu(); follow_line(); chokusinL(); //B follow_line(); usetsu(500); //X follow_line(); sasetsu(); //X' follow_line(); chokusinR(); //B' follow_line(); sasetsu(); //M' follow_line(); sasetsu(); //K' follow_line2(1000); short_break; //J' ball_release(); //¥ê¥ê¡¼¥¹ 1µåÌܽªÎ»¡¢2µåÌÜ(L')¤Þ¤Ç°Üư short_break; backleft(); //K' follow_line2(3700); short_break; //L' arm_down(); short_break; //¢¨£± ¤³¤³¤è¤ê2µåÌÜ ball_catch(); //¥Ü¡¼¥ë¥¥ã¥Ã¥Á short_break; //¢¨£± arm_up(); short_break; //¢¨£± turn_behind(); OnFwd(OUT_AB,30);Wait(100); follow_line(); usetsu(500); //K' follow_line2(500); short_break; //J' ball_release(); //¥ê¥ê¡¼¥¹ 2µåÌܽªÎ»¡£3¡¦4µåÌÜ(I)¤Þ¤Ç°Üư short_break; //¢¨£± backright(); follow_line(); chokusinL(); follow_line(); usetsu(500); //M' follow_line(); chokusinL(); //B' follow_line(); usetsu(500); //X' follow_line(); sasetsu(); //X follow_line(); sasetsu(); //B follow_line(); usetsu(400); //C follow_line2(1650); short_break; //I ¤³¤³¤è¤ê3¡¦4µåÌÜ arm_down(); short_break; //¢¨£± ball_catch(); //¥Ü¡¼¥ë¥¥ã¥Ã¥Á short_break; //¢¨£± up_catch(); short_break; //¢¨£± backleft(); //C follow_line(); usetsu(500); //B follow_line(); usetsu(500); //X follow_line(); sasetsu(); //X' follow_line(); sasetsu(); //B' follow_line(); usetsu(700); follow_line2(900); short_break; //J' down_release(); //¥ê¥ê¡¼¥¹ short_break; //¢¨£± arm_up(); short_break; //¢¨£± backright(); //K' } ¢¨£±¡¡slave¤¬Æ°ºî¤¹¤ë´Ö¡¢master¤¬Æ°¤«¤Ê¤¤¤è¤¦¤Ë¤¹¤ë *´¶ÁÛ [#r59f5759] µÞ¥Ô¥Ã¥Á¤Ç»Å¾å¤²¤¿¤Î¤Ç2Âæ¤Ç¤ÎÏ¢·È¤Ç¤â¤Ã¤ÈȯŸŪ¤Ê¤³¤È¤¬¤Ç¤¤¿¡¢¤â¤·¤¯¤Ï¥×¥í¥°¥é¥à¤òÀöÎý¤µ¤»¤ë¤³¤È¤¬¤Ç¤¤¿¤È¤¤¤¦»×¤¤¤â¤¢¤ê¤Þ¤¹¡£¤·¤«¤·¡¢¤¢¤ëÄøÅ٤Τâ¤Î¤Ï´°À®¤·¤¦¤ì¤·¤¤¤Ç¤¹¡£ ¥Á¡¼¥à¥á¥¤¥È3¿Í¤Î¶¨ÎϤǡ¢ÆÃ¤Ë»ä°Ê³°¤Î2¿Í¤ÎÎϤ¬Â礤¯¤Æ¡¢º£²ó¤Î¥í¥Ü¥Ã¥È¤òÀ©ºî½ÐÍè¤Þ¤·¤¿¡£¸Ä¿ÍŪ¤Ë¤Ï¥í¥Ü¥³¥ó¤Ç1°Ì¤ò¤È¤ì¤¿¤Î¤ÏÉû»ºÊªÄøÅ٤ˤ·¤«»×¤Ã¤Æ¤¤¤Þ¤»¤ó¡£~ ³§¤µ¤ó¤Î¶¨ÎϤÀ¤±¤Ç¤Ê¤¯¡¢ÀâÌÀ¤Î¤Ê¤«¤Ë¤â¡¢¡Ø²ÝÂ꣱¡Ù¡¢¡Ø²ÝÂꣲ¡Ù¤È¤¤¤¦¸ÀÍÕ¤¬»È¤ï¤ì¤Æ¤¤¤Þ¤¹¤¬¤³¤ì¤Þ¤Ç´èÄ¥¤Ã¤Æ¤¤¿Éôʬ¤ò¤¿¤¯¤µ¤ó±þÍѤǤ¤¿¤³¤È¤â¤È¤Æ¤â¤è¤«¤Ã¤¿¤Ç¤¹¡£~ ãÀ®´¶¤¬¤â¤Î¤¹¤´¤¯¤Æ¡¢½¼¼Â¤·¤¿Á°´ü¤ò²á¤´¤¹¤³¤È¤¬¤Ç¤¤¿¤È´¶¤¸¤Þ¤·¤¿¡£¤¢¤ê¤¬¤È¤¦¤´¤¶¤¤¤Þ¤·¤¿¡£~