[[2018a/Member]] Ìܼ¡ #contents *²ÝÂê3¡§¶õ¤´Ì±¿ÈÂ¥í¥Ü¥Ã¥È [#ce619be1] ¶õ¤´Ì¤òʬÊ̤·¤Æ½êÄê¤Î¾ì½ê¤Ë±¿¤Ö¡£ #ref(2018a-mission3.png) **¥Õ¥£¡¼¥ë¥É¤ÎÀâÌÀ [#o6ac06f1] ¡¦¥Õ¥£¡¼¥ë¥É¤Ï²ÝÂê2¤Ç»ÈÍѤ·¤¿»æ¤ò»ÈÍѤ¹¤ë¡£ ¡¦2¼ïÎà¤Î¶õ¤´Ì(A¥¿¥¤¥×,B¥¿¥¤¥×)¤ò¤½¤ì¤¾¤ì3¸Ä¤º¤ÄÍѰդ·¡¢±ßX¤ËABA¡¢±ßY¤ËBAB¤È¤Ê¤ë¤è¤¦¤Ë3Ãʤº¤ÄÀѤ߾夲¤ë¡£ ¡¦¶õ¤´Ì¤Ë¤Ï¿§¤ò¤Ä¤±¤¿¤êʸ»ú¤äµ¹æ¤ò½ñ¤¤¤Æ¤â¤è¤¤¡£¤¢¤ë¤¤¤Ï¼þ°Ï¤Ë»æ¤òÄ¥¤Ã¤Æ¤â¤è¤¤¡£ **¥ß¥Ã¥·¥ç¥ó [#le3d30ac] A¥¿¥¤¥×¤Î¶õ¤´Ì¤ò±ßYÆâ¤Ë¡¢B¥¿¥¤¥×¤Î¶õ¤´Ì¤ò±ßXÆâ¤Ë±¿¤Ö¥í¥Ü¥Ã¥È¤òºîÀ®¤»¤è¡£ *¥í¥Ü¥Ã¥È¤ÎÀâÌÀ [#e6433979] º£²ó¤Ï£²¤Ä¤Î¥Ú¥¢¤Ç¤½¤ì¤¾¤ì¥í¥Ü¥Ã¥È¤òºî¤ê¡¢Bluetooth¤ÎÄÌ¿®¤òÍѤ¤¤Æ¡¢Ï¢·È¤·¤Æ´Ì¤ò±¿¤Ö¤È¤¤¤¦ÊýË¡¤òºÎÍѤ·¤¿¡£´Ì¤¬£³ÃÊÀѤ߾夬¤Ã¤Æ¤¤¤ë¤Î¤Ç¡¢£±¤ÄÌܤΥí¥Ü¥Ã¥È(Master)¤¬£²ÃÊÌܤδ̤òÍÞ¤¨¤Æ²¼¤ËÍî¤È¤¹Ìò³ä¤ò¹Ô¤¤¡¢¤â¤¦°ì¤Ä¤Î¥í¥Ü¥Ã¥È(Slave)¤¬£±ÃÊÌܤȣ³ÃÊÌܤδ̤òÄϤó¤Ç°Üư¤µ¤»¤ëÌò³ä¤ò¹Ô¤Ã¤¿¡£ **Master¦¥í¥Ü¥Ã¥È [#zf0aae67] Master¦¥í¥Ü¥Ã¥È¤Ï¡¢ÆóÃÊÌܤδ̤ò¸ÇÄꤷ¤Æ°ìÃÊÌܤȻ°ÃÊÌܤ¬°Üư¤·¤¿¸å¤Ë±ßÆâ¤ËÍî¤È¤¹¤È¤¤¤¦Ìò³ä¤ò¤·¤Æ¤¤¤ë¡£¥í¥Ü¥Ã¥È¤ÎÁ´ÂÎÁü¤Ï°Ê²¼¤Î¼Ì¿¿¤ÎÄ̤ê¤Ç¤¢¤ë¡£ #ref(¿Þ7.jpg) ***ưÎϡʥ¿¥¤¥ä¡ËÉôʬ [#sba647c6] °ÜưÊýË¡¤ÏÄ̾ï¤Î¥í¥Ü¥Ã¥È¤ÈƱ¤¸¤Ç¡¢Æó¤Ä¤Î¥â¡¼¥¿¡¼¤òÍøÍѤ·¤Æ²óž¤·¤¿¤êÁ°¸å¤Ë¿Ê¤ó¤À¤ê¤¹¤ë¤³¤È¤¬²Äǽ¤Ç¤¢¤ë¡£¸÷¥»¥ó¥µ¡¼¤äͲ»ÇÈ¥»¥ó¥µ¡¼¤Ê¤É¤ÏÍѤ¤¤º¤Ë¡¢¤¹¤Ù¤Æ»þ´Ö¤Çư¤¤òÀ©¸æ¤·¤Æ¤¤¤ë¡£ #ref(ºÇ½ª²ÝÂê »ñÎÁ¼Ì¿¿_6.jpg) ***´Ì¤òÄϤàÉôʬ [#oe1a2a07] 4¤Ä¤Îľ³Ñ¤Ë¶Ê¤¬¤Ã¤Æ¤¤¤ëÉôÉʤòÍѤ¤¤Æ¡¢³Î¼Â¤ËÆóÃÊÌܤδ̤ò¸ÇÄê¤Ç¤¤ë¤è¤¦¤Ë¤·¤¿¡£»õ¼Ö¤òÍѤ¤¤Æ¡¢ÊÒ¦¤¬²óž¤·¤¿¤Î¤ÈƱ¤¸Ê¬¤À¤±µÕ¦¤â²óž¤·¤Æ´Ì¤òÄϤ๽¤¤È¤Ê¤Ã¤Æ¤¤¤ë¡£ #ref(ºÇ½ª²ÝÂê »ñÎÁ¼Ì¿¿_7.jpg) **Slave¦¥í¥Ü¥Ã¥È [#z3451aec] Slave¦¥í¥Ü¥Ã¥È¤Ï¡¢°ìÃÊÌܤȻ°ÃÊÌܤδ̤òÄϤ߽êÄê¤Î±ß¤ÎÃæ¤Ë»ý¤Ã¤Æ¤¤¤¯Ìò³ä¤ò¤·¤Æ¤¤¤ë¡£¥í¥Ü¥Ã¥È¤ÎÁ´ÂÎÁü¤Ï°Ê²¼¤Î¼Ì¿¿¤ÎÄ̤ê¤Ç¤¢¤ë¡£ ***ưÎϡʥ¿¥¤¥ä¡ËÉôʬ [#f87ae6bc] Master¦¥í¥Ü¥Ã¥È¤ÈƱÍͤι½Â¤¤ò¤·¤Æ¤¤¤ë¡£°ìÃÊÌܤòÄϤि¤á¤Ë¡¢Áàºî¥Ü¥Ã¥¯¥¹¤ò¤Ç¤¤ë¤À¤±²¼¤ËÃÖ¤¯É¬Íפ¬¤¢¤Ã¤¿¤¿¤á¡¢¥â¡¼¥¿¡¼¤¬Áàºî¥Ü¥Ã¥¯¥¹¤Î²£¤ËÃÖ¤«¤ì¥í¥Ü¥Ã¥ÈÁ´ÂΤÎÉý¤¬Â礤¯¤Ê¤Ã¤¿¡£¸å¤í¤Î¥¿¥¤¥ä¤â¤½¤ì¤¾¤ì¤Î¥â¡¼¥¿¡¼¤´¤È¤Ë°ì¤Ä¤Ä¤±¤ë¤è¤¦¤Ë¤·¤¿¡£¤³¤Î¤³¤È¤Ë¤è¤Ã¤Æ½Å¿´¤¬¤«¤Ê¤ê°ÂÄꤷ¡¢Åݤì¤ë¤Ê¤É¤Î¥È¥é¥Ö¥ë¤ò¤Ê¤¯¤¹¤³¤È¤¬¤Ç¤¤¿¡£Áàºî¥Ü¥Ã¥¯¥¹¤Ï¡¢ÅŸ»¤òÆþ¤ì¤ë¤Î¤ò´Êñ¤Ë¤¹¤ë¤¿¤á΢ÊÖ¤·¤Î¾õÂ֤ˤ·¤¿¡£ ¤Þ¤¿¡¢Ä¶²»ÇÈ¥»¥ó¥µ¡¼¤òÍѤ¤¤Æ¡¢Master¦¤¬ÆóÃÊÌܤδ̤òÄϤó¤À¥¿¥ï¡¼¤òȯ¸«¤·¶á¤¯¤Þ¤Ç¤¤¤±¤ë¤è¤¦¤Ë¤·¤¿¡£²¾¤ËMaster¦¤¬»°ÃÊÌܤδ̤òÍî¤È¤·¤¿¤È¤·¤Æ¤â¥¿¥ï¡¼¤ò¸«Ê¬¤±¤é¤ì¤ë¤è¤¦¤Ë¡¢Ä¶²»ÇÈ¥»¥ó¥µ¡¼¤Î°ÌÃÖ¤òÆóÃÊÌܤδ̤¬¤¢¤ë¹â¤µ¤Ë¤ª¤¤¤¿¡£ #ref(ºÇ½ª²ÝÂê »ñÎÁ¼Ì¿¿_2.jpg) ***´Ì¤òÄϤàÉôʬ [#z8e27c17] Master¦¤È¤Û¤ÜƱÍͤÎÊýË¡¤Ç´Ì¤òÄϤ๽¤¤Ë¤·¤¿¡£°ìÃÊÌܤȻ°ÃÊÌܤδ̤òÄϤޤʤ±¤ì¤Ð¤Ê¤é¤Ê¤¤¤¬¡¢¥â¡¼¥¿¡¼¤¬°ìÃÊÌܤòÄϤàÉôʬ¤Î¶á¤¯¤Ë¤¢¤ë¤¿¤á¤Ë¡¢»°ÃÊÌܤÎÊý¤¬ÄϤàÎϤ¬¼å¤¯¤Ê¤Ã¤Æ¤·¤Þ¤¦¤È¤¤¤¦ÌäÂ꤬¤¢¤Ã¤¿¡£¤³¤ì¤ò²ò·è¤¹¤ë¤¿¤á¡¢»°ÃÊÌܤˤϾ®¤µ¤Ê¥¿¥¤¥ä¤ò¤Ä¤±¤Æ´Ì¤ò¥¿¥¤¥ä¤Î¥´¥à¤ÎË໤¤Ç²¡¤µ¤¨¤ë¤è¤¦¤Ë¤·¡¢°ìÃÊÌܤϥ¿¥¤¥ä¤ò¤Ä¤±¤º¤Ë´ÌÁ´ÂΤò°Ï¤à¤³¤È¤¬¤Ç¤¤ë¤è¤¦¤Ê¹½Â¤¤Ë¤·¤¿¡£ ¤Þ¤¿¡¢°ìÃÊÌܤȻ°ÃÊÌܤδ̤òÄϤàÉôʬ¤ò¤Ä¤Ê¤°½½»þ¤ÎËÀ¤¬¤«¤Ê¤êŤ¤¤¿¤á¡¢¼Ð¤á¤Ë¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿¤ê¡¢º¸±¦¤¬Æ±¤¸¤è¤¦¤Ë²óž¤·¤Ê¤¤¤Ê¤É¤ÎÌäÂ꤬µ¯¤¤¿¡£¤½¤³¤Ç¡¢¸å¤í¦¤ËÂ礤ʻ٤¨¤ÎËÀ¤ò¤Ä¤±¡¢ÅÓÃæ¤Ë»õ¼Ö¤Ç¥â¡¼¥¿¡¼¤Î²óž¤òµÕ¦¤ËÅÁ¤¨¤ëÉôʬ¤òÁý¤ä¤·¤¿¤ê¤·¤¿¡£ #ref(¿Þ6.jpg) *¥á¥¤¥ó¥×¥í¥°¥é¥à¤Ø¤Î½àÈ÷ [#s6f57fcd] º£²ó¤Î¥×¥í¥°¥é¥à¤Ç¤Ï¡¢²ÝÂê3¤Î¥Ò¥ó¥È¤Ç¤¢¤Ã¤¿Ä¶²»ÇÈ¥»¥ó¥µ¡¼¤òÍѤ¤¤Æ´Ì¤Î°ÌÃÖ¤òÆÃÄꤹ¤ë¥×¥í¥°¥é¥à¤òÍѤ¤¤¿¤ê¡¢Bluetooth¤òÍѤ¤¤ÆMaster¤ÈSlave¤Ç¥á¥Ã¥»¡¼¥¸¤òÁ÷¤ê¹ç¤¦¤³¤È¤Ç¤½¤ì¤¾¤ì¤Î¥×¥í¥°¥é¥à¤òưºî¤µ¤»¤¿¤ê¤·¤¿¡£ **Ͳ»ÇÈ¥»¥ó¥µ¡¼¤òÍѤ¤¤Æ´Ì¤Î°ÌÃÖ¤òÆÃÄꤷ¡¢´Ì¤Î¼êÁ°¤Þ¤Ç°Üư¤¹¤ë¥×¥í¥°¥é¥à [#m676fd18] [[2018a/Mission3]]¤Î¥Ò¥ó¥È¤Ë¤¢¤Ã¤¿¥×¥í¥°¥é¥à¤ÎÎã¤ò¾¯¤·²þÎɤ·¤ÆÍѤ¤¤¿¡£¥â¡¼¥¿¡¼¤«¥»¥ó¥µ¡¼¤ÎÄ´»Ò¤¬°¤¯¡¢Á´ÂÎŪ¤ËÊý¸þ¤¬´Ì¤Î±¦Â¦¤Ë¤è¤Ã¤Æ¤·¤Þ¤¦¤³¤È¤¬¤ï¤«¤Ã¤¿¤Î¤Ç¡¢¸þ¤¤òº¸¤Ë¾¯¤·Æ°¤«¤¹Ì¿Îá¤òºÇ¸å¤ËÆþ¤ì¤Æ¤¤¤ë¡£Master¦¤Î¤ßÍøÍѤ·¤¿¡£°Ê²¼ÍѤ¤¤¿¥×¥í¥°¥é¥à #define SPEED 50 #define SPEED_SLOW 30 const float diameter = 5.45; // ¥¿¥¤¥ä¤Îľ·Â(cm) const float track = 10.35; // ¥¿¥¤¥ä¤Î¥È¥ì¥Ã¥ÉÉý(cm) const float pi = 3.1415; // ±ß¼þΨ void fwdDist(float d) // µ÷Î¥ d cm Á°¿Ê { long angle; angle = d/(diameter*pi)*360.0; // ³ÑÅÙ¤ò·×»»¤¹¤ë RotateMotorEx(OUT_BC, SPEED_SLOW, angle, 0, true, true); } void turnAng(long ang) // ³ÑÅÙ ang Å٤λþ·×²ó¤ê¤ÎÀû²ó { long angle; angle = track/diameter * ang; RotateMotorEx(OUT_BC, SPEED_SLOW, angle, 100, true, true); } int searchDirection(long ang) // ¸½ºß¤ÎÊý¸þ¤òÃæ¿´¤ËangÅÙ¤ÎÈϰϤÇõ¤· // ¾ã³²Êª¤Þ¤Ç¤Îµ÷Î¥¤òÊÖ¤¹ { long angle,tacho_min=0, tacho_corr ; int d, d_min; d_min = 300; // ²¾¤ÎºÇ¾®ÃÍ angle = (track/diameter)*ang; // Àû²ó³ÑÅÙ¤«¤é¥¿¥¤¥ä¤Î²óž¤ò·×»» turnAng(ang/2); // »ØÄꤵ¤ì¤¿³ÑÅÙ¤ÎȾʬ¤òÀû²ó ResetTachoCount(OUT_BC); // ³ÑÅٷ׬¤ò¥ê¥»¥Ã¥È OnFwdSync(OUT_BC,SPEED_SLOW,-100); // È¿»þ·×²ó¤ê¤ËÀû²ó while(MotorTachoCount(OUT_B)<=angle){ d = SensorUS(S1); // ¸½ºß¤Îµ÷Î¥ if (d < d_min){ d_min = d; // ²¾¤ÎºÇ¾®Ãͤò¹¹¿· tacho_min = MotorTachoCount(OUT_B); // ²¾¤ÎºÇ¾®Ãͤò¹¹¿·¤·¤¿¤È¤¤Î¥â¡¼¥¿¤Î²óž³ÑÅÙ } } OnFwdSyncEx(OUT_BC,SPEED_SLOW,100,RESET_NONE); until(MotorTachoCount(OUT_B) <= tacho_min || SensorUS(S1) <= d_min); Wait(14); // ÈùÄ´À° Off(OUT_BC);Wait(500); return d_min; OnFwd(OUT_C,30); OnRev(OUT_B,30); Wait(200); } **Bluetooth¤Ç¥á¥Ã¥»¡¼¥¸¤òÁ÷¼õ¿®¤·¡¢¼õ¿®»þ¤Ë¥×¥í¥°¥é¥à¤òư¤«¤¹¥×¥í¥°¥é¥à [#h60441fd] NXT¤Ç¤Ï¡¢Bluetooth¤òÍѤ¤¤ÆÊ£¿ô¤Î¥í¥Ü¥Ã¥È¤òϢư¤µ¤»¤ÆÆ°¤«¤¹¤³¤È¤¬²Äǽ¤Ç¤¢¤ë¡£º£²ó¤Ï¤³¤ì¤òÍѤ¤¤Æ¡¢Master¦¤¬ÆóÃÊÌܤδ̤òÄϤó¤À¤é¡¢Slave¦¤¬°ìÃÊÌܤȻ°ÃÊÌܤδ̤òÄϤó¤Ç½êÄê¤Î¾ì½ê¤Ë°Üư¤¹¤ë¤È¤¤¤¦ÊýË¡¤ÇÏ¢·È¤·¤Æ»°Ãʤδ̤ò°Üư¤µ¤»¤ëÊýË¡¤ò¹Í¤¨¤¿¡£ ***Master¦¤«¤éSlave¦¤Ë¥á¥Ã¥»¡¼¥¸¤òÁ÷¤ë¤È¡¢Slave¦¤¬Æ°¤½Ð¤¹¥×¥í¥°¥é¥à [#qd055957] Master¦ task main() { SendRemoteNumber(1,MAILBOX1,11); //Slave¦¤ÎMAILBOX1¤Ë11¤È¤¤¤¦Ê¸»ú¤òÁ÷¤ë } Slave¦ task main() { int msg,frg1=1; while(frg1){ ReceiveRemoteNumber(MAILBOX1,true,msg); // MAILBOX1¤ÎÃͤò¼õ¤±¼è¤êmsg¤Ë³ÊǼ if(msg==11){ //¤â¤·msg¤Ë¤¢¤ë¿ô»ú¤¬11¤Ê¤é¤Ð²¼¤ÎÌ¿Îá¤ò¹Ô¤¦ ¡Êư¤«¤·¤¿¤¤Ì¿Îá¡Ë; frg1=0; } } } ***Slave¦¤«¤éMaster¦¤Ë¥á¥Ã¥»¡¼¥¸¤òÁ÷¤ë¤È¡¢Master¦¤¬Æ°¤½Ð¤¹¥×¥í¥°¥é¥à [#c63b6d9c] Slave¦ task main() { SendResponseNumber(MAILBOX1,12); //Master¦¤ÎMAILBOX1¤Ë12¤È¤¤¤¦Ê¸»ú¤òÁ÷¤ë } Master¦ task main() { int msg,frg1=1; while(frg1){ ReceiveRemoteNumber(MAILBOX1,true,msg); // MAILBOX1¤ÎÃͤò¼õ¤±¼è¤êmsg¤Ë³ÊǼ if(msg==12){¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//¤â¤·msg¤Ë¤¢¤ë¿ô»ú¤¬12¤Ê¤é¤Ð²¼¤ÎÌ¿Îá¤ò¹Ô¤¦ ¡Êư¤«¤·¤¿¤¤Ì¿Îá¡Ë; frg1=0; } } } ¤³¤Î2¤Ä¤Î¥×¥í¥°¥é¥à¤ò¸ò¸ß¤Ë¹Ô¤¦¤³¤È¤Ç¡¢ÊÒÊý¤¬Æ°¤¤¤Æ¤¤¤ë´Ö¤Ï¤â¤¦ÊÒÊý¤ÏÀŻߤ·¤Æ¤¤¤ë¤Î¤Ç¡¢2¤Ä¤Î¥í¥Ü¥Ã¥È¤Î¾×ÆÍ¤Ê¤É¤òÈò¤±¤é¤ì¤ë¤è¤¦¤Ë¤·¤¿¡£ **Ì¿Îá¤ÎÄêµÁ [#hb3fa9fc] Á°¿Ê¡¢º¸ÀÞ¡¢±¦ÀÞ¡¢Àû²ó¤Ê¤É¤ÎÌ¿Îá¤ä¥¹¥Ô¡¼¥É¤ÎÃͤòÄêµÁ¤¹¤ë¤³¤È¤Ç¡¢¥á¥¤¥ó¥×¥í¥°¥é¥à¤¬¾¯¤·¤Ç¤â´Ê·é¤Ë¤Ê¤ë¤è¤¦¤Ë¤·¤¿¡£Slave¦¤Î¤ßÍøÍѤ·¤Æ¤¤¤ë¡£ #define SPEED_H 30 #define SPEED_L 35 #define OnRL(speedR,speedL) OnFwd(OUT_B,speedR);OnFwd(OUT_C,speedL); #define go_forward OnRL(SPEED_H, SPEED_H); // Á°¿Ê **¥í¥Ü¥Ã¥È¤òÁ°¿Ê¤µ¤»¤ë¤¿¤á¤Î¥×¥í¥°¥é¥à [#z3f32300] ¥µ¥Ö¥ë¡¼¥Á¥ó¤äÌ¿Îá¤ÎÄêµÁ¤ò»È¤Ã¤ÆÁ°¿Ê¤¹¤ëÌ¿Îá¡¢»þ´Ö¡¢ÅŸ»¤òÀÚ¤ëÌ¿Îá¤ò¤Ò¤È¤Þ¤È¤á¤Ë¤·¤¿¡£ Master¦ sub zen(int i) { ¡¡¡¡¡¡ int t; t=i*50; OnFwd(OUT_B,50); OnFwd(OUT_C,49); Wait(t); Off(OUT_BC); } sub zeny(int i) { int t; t=i*100; OnFwd(OUT_B,25); OnFwd(OUT_C,25); Wait(t); Off(OUT_BC); } Slave¦ #define str(X) go_forward;Wait(X);Off(OUT_BC); **¥í¥Ü¥Ã¥È¤ò¸åÂव¤»¤ë¥×¥í¥°¥é¥à [#bf922d59] ¾å¤ÈƱÍͤˤҤȤޤȤá¤Ë¤·¤¿¡£ Master¦ sub kou(int i) { int t; t=i*50; OnRev(OUT_B,50);OnRev(OUT_C,49); Wait(t); Off(OUT_BC); } Slave¦ #define Back(X) OnRev(OUT_BC,30);Wait(X);Off(OUT_BC); **¥í¥Ü¥Ã¥È¤ò²óž¤µ¤»¤ë¥×¥í¥°¥é¥à [#mde05c3f] ÊÒÊý¤Î¥¿¥¤¥ä¤ÈƱ¤¸Â®Å٤Ǥ⤦ÊÒÊý¤Î¥¿¥¤¥ä¤òµÕ¤Ë²óž¤µ¤»¤ëÀû²ó¤È¡¢ÊÒÊý¤Î¥¿¥¤¥ä¤Ï»ß¤á¤Æ¤ª¤¤¤Æ¤â¤¦ÊÒÊý¤Î¥¿¥¤¥ä¤À¤±Æ°¤«¤¹±¦ÀÞ¡¢º¸ÀÞ¤ÎÊýË¡¤Î2¤Ä¤òºÎÍѤ·¤¿¡£ Master¦ #define kail OnFwd(OUT_B,50);OnRev(OUT_C,50);Wait(500);Off(OUT_BC); //º¸Àû²ó¤ò0.5ÉôֹԤ¦ #define kair OnFwd(OUT_C,50);OnRev(OUT_B,50);Wait(500);Off(OUT_BC); //±¦Àû²ó¤ò0.5ÉôֹԤ¦ Slave¦ #define turn_rt(X) OnRL(SPEED_L, -SPEED_L);Wait(X);Off(OUT_BC); // ±¦Àû²ó #define turn_right(X) OnRL(SPEED_L, 0);Wait(X);Off(OUT_BC); // ±¦ÀÞ #define turn_left(X) OnRL(0, SPEED_L);Wait(X);Off(OUT_BC); // º¸ÀÞ #define turn_lt(X) OnRL(-SPEED_L, SPEED_L);Wait(X);Off(OUT_BC); // º¸Àû²ó **´Ì¤ò¤Ä¤«¤à¤¿¤á¤Î¥×¥í¥°¥é¥à [#x11912a6] Master¦¤Î¤ßÍøÍѤ·¤Æ¤¤¤Æ¡¢Slave¦¤ÏľÀܥᥤ¥ó¥×¥í¥°¥é¥à¤ËÆþÎϤ·¤Æ¤¤¤ë¡£¤Þ¤¿¡¢Master¦¤ÈSlave¦¤Ç¥â¡¼¥¿¡¼¤Î¸þ¤¤¬µÕ¤Ê¤Î¤ÇÌ¿Î᤬µÕ¤Ë¤Ê¤Ã¤Æ¤¤¤ë¡£ sub armc() { OnFwd(OUT_A,30); } **´Ì¤òÎ¥¤¹¤¿¤á¤Î¥×¥í¥°¥é¥à [#r36eb875] Master¦¤Î¤ßÍøÍѤ·¤Æ¤¤¤Æ¡¢Slave¦¤ÏľÀܥᥤ¥ó¥×¥í¥°¥é¥à¤ËÆþÎϤ·¤Æ¤¤¤ë¡£ sub armo() { OnRev(OUT_A,30); } *¥á¥¤¥ó¥×¥í¥°¥é¥à [#l753f33d] Master¦ task main() { int msg,frg1=1,frg2=1;¡¡¡¡¡¡¡¡¡¡¡¡¡¡//¡´Ø¿ôfrg1,frg2¤òÄêµÁ zen(51);¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//¢2.55Éá¢50¡ó¤Î®¤µ¤ÇÁ°¿Ê kair;¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ //£0.5Éñ¦Àû²ó zen(75);¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//¤3.75Éá¢50¡ó¤Î®¤µ¤ÇÁ°¿Ê kair;¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ //¥0.5Éñ¦Àû²ó zeny(20);¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ //¦2Éá¢25¡ó¤Î®¤µ¤ÇÁ°¿Ê armc();¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ //§ÆóÃÊÌܤδ̤òÄϤࡡX¤Ë°Üư´°Î» SendRemoteNumber(1,MAILBOX1,11);//Á÷¿® //¨Slave¦¤Ë11¤Î¿ô»ú¤òÁ÷¿®¡Ê°ìöÄä»ß¡Ë while(frg1){ ReceiveRemoteNumber(MAILBOX1,true,msg);//°¼õ¿® if(msg==12){ armo();¡¡¡¡¡¡¡¡¡¡¡¡ //±´Ì¤òÎ¥¤¹ kou(20);¡¡¡¡¡¡¡¡¡¡¡¡//²1ÉøåÂà kair;¡¡¡¡¡¡¡¡¡¡¡¡¡¡ //³0.5Éñ¦Àû²ó zen(44);¡¡¡¡¡¡¡¡¡¡¡¡//20 2.2Éá¢50¡ó¤Î®¤µ¤ÇÁ°¿Ê kail;¡¡¡¡¡¡¡¡¡¡¡¡¡¡ //21 0.5Éú¸Àû²ó zeny(20);¡¡¡¡¡¡¡¡¡¡ //22 0.5Éá¢25¡ó¤Î®¤µ¤ÇÁ°¿Ê armc();¡¡¡¡¡¡¡¡¡¡¡¡ //23 ÆóÃÊÌܤδ̤òÄϤࡡY¤Ë°Üư´°Î» frg1=0;¡¡¡¡¡¡¡¡¡¡¡¡ //´Ø¿ôfrg1¤Ë0¤òÂåÆþ SendRemoteNumber(1,MAILBOX1,13);¡¡//24 Slave¦¤Ë13¤Î¿ô»ú¤òÁ÷¿®¡Ê°ìöÄä»ß¡Ë¡¡ } } while(frg2){ ReceiveRemoteNumber(MAILBOX1,true,msg); //43 ¼õ¿® if(msg==14){ armo(); //44 ´Ì¤òÎ¥¤¹ frg2=0;¡¡¡¡¡¡¡¡¡¡¡¡ //´Ø¿ôfrg2¤Ë0¤òÂåÆþ¡Ê´°Á´Ää»ß¡Ë } } } Slave¦ task main() { int msg,frg1=1,frg2=1; while(frg1){ ReceiveRemoteNumber(MAILBOX1,true,msg); //©MAILBOX1¤ÎÃͤò¼õ¤±¼è¤êmsg¤Ë³ÊǼ if(msg==11){ SetSensorLowspeed(S1); //ª´Ì¤ÎÊý¸þ¤òõ¤·¤¿¸å¡¢¶á¤Å¤¤¤Æ10cm¼êÁ°¤ÇÄä»ß int d = searchDirection(120); if (d > 10) { fwdDist(d-10.0); } str(500);¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//«0.5ÉÃÁ°¿Ê Off(OUT_A);¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//¥â¡¼¥¿¡¼A¤ÎÅŸ»¤òÀÚ¤ë str(400);¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//¬0.4ÉÃÁ°¿Ê OnRev(OUT_A,30);¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ //°ìÃÊÌܤȻ°ÃÊÌܤδ̤òÄϤࡡX¤Ë°Üư´°Î» Wait(1000);¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//1ÉÃÂÔ¤Ä Back(1000);¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//®1ÉøåÂà SendResponseNumber(MAILBOX1,12); //¯Master¦¤Ë12¤Î¿ô»ú¤òÁ÷¿®¡Ê°ìöÄä»ß¡Ë frg1=0;¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//´Ø¿ôfrg1¤Ë0¤òÂåÆþ } } while(frg2){ ReceiveRemoteNumber(MAILBOX1,true,msg); //25 MAILBOX1¤ÎÃͤò¼õ¤±¼è¤êmsg¤Ë³ÊǼ if(msg==13){ turn_lt(600); //26 0.6Éú¸Àû²ó str(4000);¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//27 4ÉÃÁ°¿Ê turn_rt(1000);¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//28 1Éñ¦Àû²ó str(1000);¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//29 1ÉÃÁ°¿Ê OnFwd(OUT_A,30);¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//30 ´Ì¤òÎ¥¤¹ Y¤Ë°Üư´°Î» Wait(500);¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//0.5ÉÃÂÔ¤Ä Off(OUT_A);¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ //¥â¡¼¥¿¡¼A¤ÎÅŸ»¤òÀÚ¤ë Back(1000);¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ //31 1ÉøåÂà turn_rt(800);¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ //32 0.8Éñ¦Àû²ó str(500);¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ //33 0.5ÉÃÁ°¿Ê turn_lt(1000);¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//34 1Éú¸Àû²ó str(2000);¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//35 2ÉÃÁ°¿Ê turn_left(1000);¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//36 1Éú¸ÀÞ OnRev(OUT_A,30);¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//37 °ìÃÊÌܤȻ°ÃÊÌܤδ̤òÄϤà Wait(1000);¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ //1ÉÃÂÔ¤Ä Back(1000);¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ //38 1ÉøåÂà turn_rt(2000);¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//39 2Éñ¦Àû²ó str(4000);¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//40 4ÉÃÁ°¿Ê OnFwd(OUT_A,30);¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//41 ´Ì¤òÎ¥¤¹ Wait(1000);¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ //1ÉÃÂÔ¤Ä Off(OUT_A);¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ //¥â¡¼¥¿¡¼A¤ÎÅŸ»¤òÀÚ¤ë SendResponseNumber(MAILBOX1,14); //42 Master¦¤Ë14¤Î¿ô»ú¤òÁ÷¤ë frg2=0;¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ //´Ø¿ôfrg2¤Ë0¤òÂåÆþ¡Ê´°Á´Ää»ß¡Ë } } } #ref(¿Þ8.jpg) ¾å¤Î¥×¥í¥°¥é¥à¤ËÀâÌÀ¤È¤·¤Æ½ñ¤«¤ì¤Æ¤¤¤ë¿ô»ú¤Ï¡¢¾å¤Î¿Þ¤Î¿ô»ú¤ÈϢư¤·¤Æ¤¤¤ë¡£ËÜÈ֤Ϥ³¤Î¿ô»ú¤Î½çÈ֤ǹԤä¿¡£¿Þ¤ò¤ï¤«¤ê¤ä¤¹¤¯¤¹¤ë¤¿¤á¡¢¼ÂºÝ¤ÎÂ礤µ¤È¾å¤Î¿Þ¤Ï°Û¤Ê¤ë¡£Ìð°õ¤ÏÁ°¿Ê¤ä¸åÂà¡¢´Ý¤ÏÀû²ó¤ä´Ì¤òÄϤà¤Þ¤¿¤ÏÎ¥¤¹±¿Æ°¡¢Á÷¼õ¿®¤ò¼¨¤·¤Æ¤¤¤ë¡£ÀÖ¤¤Ìð°õ¤ä´Ý¤ÏMaster¦¤Î¥í¥Ü¥Ã¥È¤Î±¿Æ°¡¢ÀĤ¤Ìð°õ¤ä´Ý¤ÏSlave¦¤Î¥í¥Ü¥Ã¥È¤Î±¿Æ°¤ò¼¨¤·¤Æ¤¤¤ë¡£ *·ë²Ì [#hf4c6ded] °ì²óÌܤϡ¢Master¦¤¬´Ì¤òÄϤळ¤È¤¬¤Ç¤¤º¡¢¥¿¥ï¡¼¤òÅݤ·¤Æ¤·¤Þ¤¤0ÅÀ¤Ç¤¢¤Ã¤¿¡£Æó²óÌܤϡ¢Master¦¤Ï´Ì¤ò¤Ä¤«¤á¤¿¤â¤Î¤Î¡¢Slave¦¤¬¤¢¤Þ¤ê¤¤¤¤°ÌÃ֤˴̤ò±¿¤Ù¤º¤ï¤º¤«2ÅÀ¤Ç¤¢¤Ã¤¿¡£ µ»½ÑÅÀ¤Ï¡¢Ê¿¶Ñ12.2ÅÀ¤È¤Ê¤ê¡¢Á´Âιç·×¤Ç14.2ÅÀ¤Ç¤¢¤Ã¤¿¡£½ç°Ì¤Ï13¥Á¡¼¥àÃæ7°Ì¤È¤¤¤¦·ë²Ì¤Ç¤¢¤Ã¤¿¡£ *²ÝÂê3¤ÎÈ¿¾Ê¡¦´¶ÁÛ [#o08e4935] ²ÝÂê3¤Ï¡¢¥Æ¥¹¥ÈÁ°¤È¤¤¤¦¤³¤È¤â¤¢¤Ã¤Æ¤¢¤Þ¤ê»þ´Ö¤¬¤Ê¤¯ÅÀ¤ò¼è¤ëºîÀï¤Ê¤É¤ò¤·¤Ã¤«¤ê¤ÈÎý¤ë¤³¤È¤¬¤Ç¤¤Ê¤«¤Ã¤¿¤¬¡¢¥Á¡¼¥à¤Î¿Íã¤È¶¨ÎϤ·¤Æ¡¢º£¤Þ¤Ç³Ø¤ó¤Ç¤¤¿¥×¥í¥°¥é¥ß¥ó¥°¤Ê¤É¤ò¶î»È¤·¤Æ´°À®¤Ç¤¤¿¤Î¤Ç¤è¤«¤Ã¤¿¡£¥í¥Ü¥³¥ó¤Ç¤Ï¡¢¤¢¤Þ¤ê¤¤¤¤ÅÀ¤ò¼è¤ë¤³¤È¤¬¤Ç¤¤Ê¤«¤Ã¤¿¤Î¤Ç»Äǰ¤À¤Ã¤¿¡£¼«Ê¬¤Ï¼ç¤ËSlave¦¤Î¥í¥Ü¥Ã¥È¤ÎÀ©ºî¤È¥×¥í¥°¥é¥ß¥ó¥°¤ò¹Ô¤Ê¤Ã¤¿¤¬¡¢1ÃÊÌܤÈ3ÃÊÌܤδ̤òÄϤà¤Ë¤Ïº£¤Þ¤Ç¤È¤Ï°ã¤Ã¤ÆÂ礤¤¥í¥Ü¥Ã¥È¤¬É¬ÍפÀ¤Ã¤¿¤á¡¢¥í¥Ü¥Ã¥È¼«ÂΤÎÀ߷פ«¤é¤È¤Æ¤âÆñ¤·¤«¤Ã¤¿¡£Â礤¯¤Ê¤Ã¤¿¤³¤È¤Ç¿§¡¹¤ÊÌäÂêÅÀ¤¬½Ð¤Æ¤¤¿¤¬¡¢¥Á¡¼¥à¤Î¿Í¤È°Õ¸«¤ò½Ð¤·¹ç¤¤¤Ê¤¬¤é²ò·è¤¹¤ë¤³¤È¤¬¤Ç¤¤Æ¤è¤«¤Ã¤¿¡£¥×¥í¥°¥é¥ß¥ó¥°¤Ç¤Ï¡¢»þ´Ö¤Ç¤ÎÀ©¸æ¤À¤±¤Ç¤Ê¤¯¡¢²óž¤ä¥é¥¤¥ó¥È¥ì¡¼¥¹¤Ê¤É¤âÍѤ¤¤ë¤È¡¢¤â¤¦¾¯¤·Àµ³Î¤Ë´Ì¤ò°Üư¤Ç¤¤¿¤È»×¤¦¤Î¤Ç¡¢¼«Ê¬¤Î¥×¥í¥°¥é¥ß¥ó¥°ÎϤò¤â¤Ã¤È¤Ä¤±¤Æ¤¤¤¤¿¤¤¤È»×¤Ã¤¿¡£ ¤³¤Î¼ø¶È¤òÄ̤·¤Æ½é¤á¤Æ¥í¥Ü¥Ã¥È¤ò¥×¥í¥°¥é¥ß¥ó¥°¤ÇÁàºî¤¹¤ë¤È¤¤¤¦·Ð¸³¤ò¤·¤¿¤¬¡¢¥×¥í¥°¥é¥ß¥ó¥°¸À¸ì¤Ç¥í¥Ü¥Ã¥È¤Ë¤ä¤Ã¤Æ¤Û¤·¤¤¤³¤È¤òÅÁ¤¨¤ë¤Î¤ÏÈó¾ï¤ËÆñ¤·¤¤¤³¤È¤À¤È¤¤¤¦¤³¤È¤¬¤ï¤«¤Ã¤¿¡£°ìÊý¤Ç¥í¥Ü¥Ã¥È¤ò¼«Ê¬¤ÎÎϤǻؼ¨ÄÌ¤êÆ°¤«¤¹¤³¤È¤¬¤Ç¤¤ë³Ú¤·¤µ¤â¤µ¤ë¤³¤È¤¬¤Ç¤¤¿¡£ËÜÅö¤Ëµ®½Å¤ÊÂ賤ò¤µ¤»¤Æ¤â¤é¤¤¤Þ¤·¤¿¡£¤¢¤ê¤¬¤È¤¦¤´¤¶¤¤¤Þ¤·¤¿¡£ ¤³¤Î¼ø¶È¤òÄ̤·¤Æ½é¤á¤Æ¥í¥Ü¥Ã¥È¤ò¥×¥í¥°¥é¥ß¥ó¥°¤ÇÁàºî¤¹¤ë¤È¤¤¤¦·Ð¸³¤ò¤·¤¿¤¬¡¢¥×¥í¥°¥é¥ß¥ó¥°¸À¸ì¤Ç¥í¥Ü¥Ã¥È¤Ë¤ä¤Ã¤Æ¤Û¤·¤¤¤³¤È¤òÅÁ¤¨¤ë¤Î¤ÏÈó¾ï¤ËÆñ¤·¤¤¤³¤È¤À¤È¤¤¤¦¤³¤È¤¬¤ï¤«¤Ã¤¿¡£°ìÊý¤Ç¥í¥Ü¥Ã¥È¤ò¼«Ê¬¤ÎÎϤǻؼ¨ÄÌ¤êÆ°¤«¤¹¤³¤È¤¬¤Ç¤¤ë³Ú¤·¤µ¤âÃΤ뤳¤È¤¬¤Ç¤¤¿¡£ËÜÅö¤Ëµ®½Å¤ÊÂ賤ò¤µ¤»¤Æ¤â¤é¤¤¤Þ¤·¤¿¡£¤¢¤ê¤¬¤È¤¦¤´¤¶¤¤¤Þ¤·¤¿¡£