2016a/Member/fujison/Mission3
¤ò¥Æ¥ó¥×¥ì¡¼¥È¤Ë¤·¤ÆºîÀ®
[
¥È¥Ã¥×
] [
¿·µ¬
|
°ìÍ÷
|
¸¡º÷
|
ºÇ½ª¹¹¿·
|
¥Ø¥ë¥×
|
¥í¥°¥¤¥ó
]
³«»Ï¹Ô:
[[2016a/Member]]
*Ìܼ¡ [#t6aa239e]
#contents
*²ÝÂꣳ¤ÎÀâÌÀ [#xeb46890]
**´ðËܥ롼¥ë [#h818305c]
¥í¥Ü¥Ã¥È¥³¥ó¥Æ¥¹¥È¡Ê²ÝÂꣳ¡Ë¤Ï²ÝÂꣲ¤ÇºîÀ®¤·¤¿¥³¡¼¥¹¤òÍѤ¤¤Æ¥¿¥¤¥à¥ì¡¼¥¹¤ò¹Ô¤¤¡¢ºÇ½ªÆÀÅÀ¤Ç¾¡É餹¤ë¡£º£²ó¤Ï£²Âæ°Ê²¼¤Î¥í¥Ü¥Ã¥È¤ò»ÈÍѤ·¤Æ¡¢CÃÏÅÀ¡Ê£³¸Ä¡Ë¤ÈDÃÏÅÀ¡Ê£³¸Ä¡Ë¤Î£²²Õ½ê¤ËÀßÃÖ¤µ¤ì¤¿»æ¥³¥Ã¥×¤ò¥³¡¼¥¹Ãæ±û¤ÎÎØ¤ÎÃæ¤Ë¸ò¸ß¤Ë½Å¤Í¤ë¡£ºÇ½ªÅª¤ÊÅÀ¿ô¤Ï»æ¥³¥Ã¥×¤Î¸Ä¿ô¤Ë±þ¤¸¤¿´ðËÜÅÀ¤Èưºî¤ÎÀºÅÙ¡¦¥¹¥Ô¡¼¥É¡¦³Î¼ÂÀ¤Ê¤É¤ò´Þ¤á¤¿µ»½ÑŪ¤Ê¹©Éפä·Ý½ÑÀ¤Ë¤Ä¤¤¤Æ¤Îµ»½ÑÅÀ¤Î¹ç·×¤È¤¹¤ë¡£
**Ãí°ÕÅÀ [#h405738f]
-£²Âæ¤Î¥í¥Ü¥Ã¥È¤ÏAÃÏÅÀ¤ÈBÃÏÅÀ¤«¤é¥¹¥¿¡¼¥È¤¹¤ë¡£
-»æ¥³¥Ã¥×¤Ï¡ÊCÃÏÅÀ¤Î¥³¥Ã¥×¡Ë¢ª¡ÊDÃÏÅÀ¤Î¥³¥Ã¥×¡Ë¤Î½ç¤Ë½Å¤Í¤ë¡£
-ºÇ½ªÅª¤Ë»æ¥³¥Ã¥×¤Ï¥í¥Ü¥Ã¥È¤¬¿¨¤ì¤Æ¤¤¤Ê¤¤¾õÂ֤Ǽ«Î©¤·¤Æ¤¤¤ë¤³¤È¡£
-¶¥µ»»þ´Ö¤Ï»æ¥³¥Ã¥×¤ò¤¹¤Ù¤Æ¡ÊºÇÂ磶¸Ä¡Ë½Å¤Í¤ë¤«¡¢¿³È½¤¬Â³¹ÔÉÔǽ¤ÈȽÃǤ¹¤ë¤Þ¤Ç¡£
-¶¥µ»¤¬½ª¤ï¤ë¤Þ¤Ç¥í¥Ü¥Ã¥È¤Ë¿¨¤ì¤Æ¤Ï¤¤¤±¤Ê¤¤¡£
~²ÝÂꣳ¤Î¥ë¡¼¥ë¤Î¾ÜºÙ¤Ï[[¤³¤Á¤é:http://yakushi.shinshu-u.ac.jp/robotics/?2016a%2FMission3]]¤ò»²¾È
~²ÝÂꣲ¤Î¾ÜºÙ¤Ï[[¤³¤Á¤é:http://yakushi.shinshu-u.ac.jp/robotics/?2016a%2FMember%2Ffujison%2FMission2]]¤ò»²¾È
**»æ¥³¥Ã¥×¤ÎÇÛÃÖ [#y9f21e8b]
º£²ó¤Î²ÝÂê¤Ç¤Ï³ÆÃÏÅÀ¤ÎÏÈÆâ¤Ç¤¢¤ì¤Ð¼«Í³¤Ë»æ¥³¥Ã¥×¤òÇÛÃÖ¤·¤Æ¤è¤¤¡£
~»ä¤¿¤Á¤ÎÈɤϼ¡¤Î¿Þ¤Î¤è¤¦¤Ë»æ¥³¥Ã¥×¤òÇÛÃÖ¤·¤¿¡£
#ref(./»æ¥³¥Ã¥×ÇÛÃÖ.png,50%,»æ¥³¥Ã¥×¤ÎÇÛÃÖ)
*¥í¥Ü¥Ã¥È£± [#jaa4c235]
**Ìò³ä [#y6ef6d56]
¤³¤Î¥í¥Ü¥Ã¥È¤ÏAÃÏÅÀ¤«¤é¥¹¥¿¡¼¥È¤·¡¢¥³¡¼¥¹Ãæ±û¤ÇÂÔµ¡¤¹¤ë¡£¤½¤Î¸å¡¢¥í¥Ü¥Ã¥È2¤¬±¿¤ó¤Ç¤¤¿»æ¥³¥Ã¥×¤ò¶´¤ó¤ÇÍÞ¤¨¡¢½Å¤Í¤ë¤È¤¤ËÅݤì¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¤³¤È¤òÌÜŪ¤ËÀ©ºî¤·¤¿¡£
~¸÷¥»¥ó¥µ¤ò2¸Ä¤È¤â¥í¥Ü¥Ã¥È2¤Ë»È¤Ã¤Æ¤·¤Þ¤Ã¤¿¤Î¤Ç¡¢¥í¥Ü¥Ã¥È1¤Îưºî¤Ï¤¹¤Ù¤Æ»þ´Ö»ØÄê¤Ë¤Ê¤Ã¤¿¡£
¢¨ËÜÍè¤Ï¤½¤ÎͽÄê¤Çºî¤Ã¤¿¤¬¡¢ºÇ½é¤Î¥¹¥¿¡¼¥È°ÌÃ֤Τº¤ì¤ä¥í¥Ü¥Ã¥È¤ÎÄ´»Ò¤Ë¤è¤Ã¤Æ¡¢Àµ¤·¤¤¾ì½ê¤ÇÂÔµ¡¤Ç¤¤º¡¢¥í¥Ü¥Ã¥È2¤Îưºî¤Î¼ÙËâ¡¢»æ¥³¥Ã¥×¤ò¤¦¤Þ¤¯¸ÇÄê¤Ç¤¤Ê¤¤¤Ê¤É²ÝÂê¤ÎÀ®¸ùΨ¤¬²¼¤¬¤ë¤ÈȽÃǤ·¡¢¥í¥Ü¥³¥ó¤Î2²óÌܤÎÄ©Àï¤Ç¤Ï»ÈÍѤ·¤Ê¤«¤Ã¤¿¡£
**¹½Â¤ [#m7793056]
¡Ú¥í¥Ü¥Ã¥ÈÁ´ÂÎÁü¡Û
#ref(./image17.JPG,70%,¥í¥Ü¥Ã¥È£±Á´ÂÎÁü)
¡Ú¥í¥Ü¥Ã¥ÈÁ°Â¦¡Û
#ref(./image16.PNG,25%,¥í¥Ü¥Ã¥È£±Á°Â¦)
¡ÚÎϤθþ¤¤ÎÊÑ´¹¡Û
~º£²ó»ÈÍѤ·¤¿¥â¡¼¥¿¡¼¤Î²óž¤Ï¤â¤È¤â¤È½ÄÊý¸þ¤Ç¤¢¤ë¡£¤½¤Î¤¿¤á¡¢¤½¤Î¤Þ¤Þ¤Ç¤Ï¥â¡¼¥¿¡¼¤ÎÎϤò»ÈÍѤ·¤Æº¸±¦¤Ë¥¢¡¼¥à¤ò³«¤¤¤¿¤ê¡¢ÊĤ¸¤¿¤ê¤¹¤ë¤³¤È¤Ï¤Ç¤¤Ê¤¤¡£¤·¤«¤·¡¢¼Ì¿¿¤Î¤è¤¦¤Ë»õ¼Ö¡Ê¿å¿§¤Ç°Ï¤Ã¤¿¤â¤Î¡Ë¤ò»ÈÍѤ¹¤ë¤³¤È¤Ç¡¢½Ä¸þ¤¤ÎÎÏ(ÀÖ¤¤Ìð°õ¡Ë¤ò²£¸þ¤¤ÎÎÏ¡ÊÀĤ¤Ìð°õ¡Ë¤Ø¤ÈÊÑ´¹¤·¤Æ¤¤¤ë¡£
#ref(./image19.PNG,70%,ÎϤÎÊÑ´¹)
¡Ú²þÎÉÅÀ¡Û
-ÎФÎÏȡĥí¥Ü¥Ã¥È£²¤¬¥³¥Ã¥×¤ò²¼¤¹¤È¤¤Ë¥í¥Ü¥Ã¥È1¤Î¥¢¡¼¥à¤¬¼ÙËâ¤Ë¤Ê¤é¤Ê¤¤¤è¤¦¤Ë¡¢¤Ç¤¤ë¤À¤±¥¢¡¼¥à¤Î°ÌÃÖ¤ò²¼¤²¤¿¡£
-ÀĤÎÏȡĥ¿¥¤¥ä¤ò¾®¤µ¤¯¤·¡¢¥í¥Ü¥Ã¥È2¤Îưºî¤Î¼ÙËâ¤Ë¤Ê¤é¤Ê¤¤¤è¤¦¤Ë¤·¤¿¡£¤¿¤À¾®¤µ¤¯¤¹¤ë¤Î¤Ç¤Ï¤Ê¤¯¡¢¥³¥Ã¥×¤ò¤Ä¤«¤ó¤À»þ¤Î°ÂÄêÀ¤â³Îǧ¤·¤Ä¤Ä¡¢¥¿¥¤¥ä¤Î¥µ¥¤¥º¤ò·è¤á¤¿¡£
-ÀÖ¤ÎÏÈ¡Äα¤á¶ñ¤Ï¤Ç¤¤ë¤À¤±¾®¤µ¤¤¤â¤Î¤òÁª¤Ó¡¢¹â¤µ¤ò¤Ê¤¯¤¹¤³¤È¤Ç¡¢¥í¥Ü¥Ã¥È2¤¬¥³¥Ã¥×¤ò²¼¤¹¤È¤¤Ë°ú¤Ã¤«¤«¤ê¡¢¥³¥Ã¥×¤¬Å¾Åݤ·¤Ê¤¤¤è¤¦¤Ë¤·¤¿¡£
#ref(./image20.JPG,100%,²þÎÉÅÀ)
**¥×¥í¥°¥é¥à [#b64112f4]
~¡ÚÄêµÁ¡Û¡¡
#define SIGNALON 121 //121¤ÎÃͤò¥í¥Ü¥Ã¥È2¤«¤é¼õ¿®¤·¤¿¤È¤¡¢¼¡¤Î»ØÄꤵ¤ì¤¿Æ°ºî¤ò¹Ô¤¦¡£
~¢¨ÃͤÏ0¡Á255¤Þ¤Ç¤ÎÃͤò¥á¥Ã¥»¡¼¥¸¤È¤·¤ÆÁ÷¼õ¿®¤Ç¤¤ë¡£
~¡Ú´ðËÜÆ°ºî¡Û
ClearMessage //¥á¥Ã¥»¡¼¥¸(¡¡)¤ÎÃͤò0¤Ë½é´ü²½¤¹¤ë
ClearTimer(0) //Timer(0)¤ò¥ê¥»¥Ã¥È
OnFwd(OUT_A) //A¤Î¥â¡¼¥¿¤òÀµ²óž¤µ¤»¤ë
OnRev(OUT_AC) //A¤ÈC¤Î¥â¡¼¥¿¤òµÕ²óž¤µ¤»¤ë
Wait(t) //Á°¤Îưºî¤òtÉôֹԤ¤¡¢¤½¤Î´Ö¼¡¤Îưºî¤Ë¤Ï¿Ê¤Þ¤Ê¤¤
Off //¥â¡¼¥¿¤òÄä»ß¤µ¤»¤ë
~¡Ú¥á¥¤¥ó¥×¥í¥°¥é¥à¡Û
task main()
{
ClearMessage();
ClearTimer(0);
OnRev(OUT_AC); //QÃÏÅÀ¤Þ¤Ç°Üư¤¹¤ë
Wait(450);
Off(OUT_AC);
OnRev(OUT_A); //¥í¥Ü¥Ã¥È1¤Î¸þ¤¤ÎÄ´À°¤ò¤¹¤ë
OnFwd(OUT_C);
Wait(5);
Off(OUT_AC);
until(Message() == SIGNALON); //until¡Ä¤¢¤ë¾ò·ï¤¬Ëþ¤¿¤µ¤ì¤ë¤Þ¤Çưºî¤òÄä»ß¤¹¤ë
Wait(150); //¥í¥Ü¥Ã¥È2¤¬±¿¤ó¤Ç¤¤¿»æ¥³¥Ã¥×¤Î°ÌÃÖ¤òÄ´À°
OnFwd(OUT_B);
Wait(10);
Off(OUT_B);
Wait(30000); //»æ¥³¥Ã¥×¤¬¤¹¤Ù¤Æ½Å¤Í½ª¤ï¤ë¤Þ¤ÇÄä»ß
OnRev(OUT_B); //¥¢¡¼¥à¤ò¹¤²¡¢»æ¥³¥Ã¥×¤òÎ¥¤¹
Wait(20);
Off(OUT_B);
OnRev(OUT_AC); //»æ¥³¥Ã¥×¤«¤éÎ¥¤ì¤ë
Wait(30);
Off(OUT_AC);
}
*¥í¥Ü¥Ã¥È£²(¤Ä¤«¤à¡¦½Å¤Í¤ë) [#je00e591]
**Ìò³ä [#r1389d1c]
¤³¤Î¥í¥Ü¥Ã¥È¤ÏBÃÏÅÀ¤«¤é¥¹¥¿¡¼¥È¤·¡¢¥é¥¤¥ó¥È¥ì¡¼¥¹¤ò¹Ô¤Ã¤Æ¡¢»æ¥³¥Ã¥×¤Î¤¢¤ëÃÏÅÀ¤Ø¹Ô¤¯¡£¤µ¤é¤Ë¡¢»æ¥³¥Ã¥×¤ò¤Ä¤«¤àÌò³ä¤È½Å¤Í¤ëÌò³ä¤ò»ý¤Ã¤Æ¤¤¤ë¡£
**¹½Â¤ [#d57fe889]
¡Ú¥í¥Ü¥Ã¥È2Á´ÂÎÁü²£Â¦¡Û
#ref(./image25.jpg,90%,Á´ÂÎÁü²£Â¦)
¡Ú¥í¥Ü¥Ã¥È2Á´ÂÎÁüÁ°Â¦¡Û
¸÷¥»¥ó¥µ¡¼¤ò¥¢¡¼¥à¤ÈƱ¤¸Ì̤ËÉÕ¤±¤ë¤³¤È¤Ç¡¢»æ¥³¥Ã¥×¤ò¤Ä¤«¤à»þ¤ËÀ¸¤¸¤ë¡¢¥í¥Ü¥Ã¥È¤È»æ¥³¥Ã¥×¤Î´Ö¹ç¤¤¤Î¤º¤ì¤ò¤Ç¤¤ë¤À¤±ÍÞ¤¨¤¿¡£
¤³¤Î¥í¥Ü¥Ã¥È¤Ï»æ¥³¥Ã¥×¤ò½Å¤Í¤ëºÝ¤Ë¥í¥Ü¥Ã¥È1¤È¤Î¾×ÆÍ¤ò¸º¤é¤¹¤¿¤á¤Ë¡¢³Æ¥¢¡¼¥à¤Ë¥¿¥¤¥ä¤ò1¤Ä¤·¤«¼è¤êÉÕ¤±¤Æ¤¤¤Ê¤¤¡£¤Ä¤Þ¤ê¡¢»æ¥³¥Ã¥×¤ò»ý¤Á¾å¤²¤¿¤ê¡¢±¿¤ó¤À¤ê¤¹¤ë¤È¤¤Î°ÂÄêÀ¤¬Ä㤤¤Î¤Ç¡¢³ÆÆ°ºî¤ò¹Ô¤¦¤È¤¤ËÊ̤ÎÍýͳ¤Ç»æ¥³¥Ã¥×¤¬¤º¤ì¤¿¤ê¡¢Íî¤È¤·¤¿¤ê¤¹¤ë¤³¤È¤ò¸º¤é¤·¤Æ¤¤¤ë¡£
#ref(./image26.jpg,90%,Á´ÂÎÁüÁ°Â¦)
¡Ú¸÷¥»¥ó¥µ¡¼¡Û
¥¿¥Ã¥Á¥»¥ó¥µ¡¼¤Ç¤Ï»æ¥³¥Ã¥×¤ËÈ¿±þ¤·¤Ê¤¤¡¦»æ¥³¥Ã¥×¤¬¤º¤ì¤ë²ÄǽÀ¤¬¹Í¤¨¤é¤ì¤¿¤Î¤Ç¸÷¥»¥ó¥µ¡¼¤ò»ÈÍѤ·¤¿¡£
¾å¦¡ÊÀÖ¿§¤ÎÏȤǰϤޤ줿¡Ë¸÷¥»¥ó¥µ¡¼¤Ï»æ¥³¥Ã¥×¤Î¼±Ê̤Τ¿¤á¤Ë»ÈÍÑ¡£
²¼Â¦¡ÊÀÄ¿§¤ÎÏȤǰϤޤ줿¡Ë¸÷¥»¥ó¥µ¡¼¤Ï¥é¥¤¥ó¥È¥ì¡¼¥¹¤Î¤¿¤á¤Ë»ÈÍÑ¡£
¢¨¾å¦¤Ë»æ¥³¥Ã¥×ÍÑ¡¢²¼Â¦¤Ë¥é¥¤¥ó¥È¥ì¡¼¥¹ÍѤòÉÕ¤±¤¿¡£¤³¤Î·Á¡ÊÁ´ÂÎÁüÁ°Â¦µÚ¤Ó²¼¤Î¸÷¥»¥ó¥µ¡¼¤Î¼Ì¿¿»²¾È¡Ë¤Ë¤·¤¿¤Î¤Ï¡¢¸÷¥»¥ó¥µ¡¼¤¬¿¿¤óÃæ¤Ë¤¢¤ë¤³¤È¤Ç¡¢¶´¤à»þ¤Ë¥¢¡¼¥à¤¬»æ¥³¥Ã¥×¤ËÂФ·¤Æ¡¢Æ±»þ¤ËÎϤò²Ã¤¨¤ë¤³¤È¤¬¤Ç¤¤ë¤è¤¦¤Ë¤¹¤ë¤¿¤á¤Ç¤¢¤ë¡£¤½¤Î·ë²Ì¡¢¥¢¡¼¥à¤ÎÎϤΤĤê¹ç¤¤¤¬¼è¤ì¤º¥³¥Ã¥×¤¬Å¾Åݤ·¤¿¤ê¡¢¤Ä¤«¤á¤Ê¤«¤Ã¤¿¤ê¤¹¤ë¤³¤È¤òËɤ¤¤Ç¤¤¤ë¡£
#ref(./image21.jpg,50%,¸÷¥»¥ó¥µ¡¼)
**¤Ä¤«¤à¡¦½Å¤Í¤ë»ÅÁÈ¤ß [#v8827f28]
»æ¥³¥Ã¥×¤ò½Å¤Í¤ë¤Þ¤Ç¤Î¼ê½ç¤Ï°Ê²¼¤ÎÄ̤ê¤Ç¤¢¤ë¡£
+¥¢¡¼¥à¤¬(¥¢¡¼¥à¼Ì¿¿¡¤ÎÀÖ¤¤Ìð°õ¤ÎÊý¸þ¤Ë)ÊĤ¸¤ë¡£
+»æ¥³¥Ã¥×¤ò¤Ä¤«¤à¡£
~¢¨»æ¥³¥Ã¥×¾å¦¤ÎÊ¥¤¬¥¢¡¼¥à¤Î¥¿¥¤¥äÉôʬ¤Ë°ú¤Ã¤«¤«¤ë¤³¤È¤Ç»æ¥³¥Ã¥×¤ò»ý¤Á¾å¤²¤Æ¤¤¤ë¡£
#ref(./image24.png,50%,¤Ä¤«¤ßÊý)
+¸Â³¦¤Þ¤Ç»æ¥³¥Ã¥×¤ò¤Ä¤«¤à¡£¤Ä¤Þ¤ê¡¢¥¢¡¼¥à¼Ì¿¿¡¤ÎÀÖ¤¤Ìð°õ¤ÎÊý¸þ¤Ë¤½¤ì°Ê¾åÎϤò²Ã¤¨¤ë¤³¤È¤¬¤Ç¤¤Ê¤¤¾õÂÖ¤Ë㤹¤ë¡£
+¤½¤ì¤Þ¤Ç¡¢¥¢¡¼¥à¤òÊĤ¸¤ëÊý¸þ¤Ë¤«¤«¤Ã¤Æ¤¤¤¿ÎϤ¬¡¢¾å¸þ¤¡Ê¥¢¡¼¥à¼Ì¿¿¢¤ÎÀÖ¤¤Ìð°õ¤ÎÊý¸þ¡Ë¤ËÎϤ¬¤«¤«¤ê»Ï¤á¤ë¡£
+¥¢¡¼¥à¤Ï¾å¤Ø¤Èư¤»æ¥³¥Ã¥×¤¬»ý¤Á¾å¤¬¤ë¡£
+²¼¤¹¤È¤¤Ï¥â¡¼¥¿¡¼¤òµÕ¸þ¤¤Ë²ó¤»¤Ð¡¢¼«Æ°Åª¤Ë²¼¤ê¡¢¥¢¡¼¥à¤¬³«¤¯¤Î¤Ç¡¢½Å¤Í¤ë¤³¤È¤¬¤Ç¤¤ë¡£
~¢¨¥â¡¼¥¿¡¼¤ÎÎϤÎÊÑ´¹ÊýË¡¡Ê¥¢¡¼¥à¼Ì¿¿¡¤ÎÀĤ¤ÏȡˤϾå¦(¥í¥Ü¥Ã¥È1/¹½Â¤)¤ËµºÜ¤·¤Æ¤¤¤ë¡£
~¡Ú¥¢¡¼¥à¼Ì¿¿¡¡Û
#ref(./image23.jpg,50%,¥¢¡¼¥àÁ°Â¦)
¡Ú¥¢¡¼¥à¼Ì¿¿¢¡Û
#ref(./image11.JPG,50%,¥¢¡¼¥à²£Â¦)
¡ÚÌäÂêÅÀ¡Û
~¥¢¡¼¥à¤ò¾å²¼¤Ëư¤«¤¹¤È¤¤Î¥¹¥Ô¡¼¥É¤Ï¥¢¡¼¥à¤Î¥®¥¢Èæ(³Æ¥®¥¢¤ÎÂ礤µ¤È¥®¥¢Æ±»Î¤Î¥µ¥¤¥º¤Î°ã¤¤)¤Ë¤è¤Ã¤Æ·è¤Þ¤ë¡£¤·¤«¤·¡¢¤½¤Î¤³¤È¤ò¤¢¤Þ¤ê¾Ü¤·¤¯ÃΤé¤Ê¤«¤Ã¤¿¤³¤È¤â¤¢¤ê¡¢²þÎɤ¹¤ë¤³¤È¤¬¤Ç¤¤Ê¤«¤Ã¤¿¡£¼¡¤Îµ¡²ñ¤Çº¤¤é¤Ê¤¤¤è¤¦¤ËÄ´¤Ù¤Æ¤ª¤¤¿¤¤¡£
**¥×¥í¥°¥é¥à [#n60595f3]
¡ÚÄêµÁ¡Û
#define SIGNALON 121 //ÄÌ¿®ÍÑ
#define MIDDLE 50 //¥é¥¤¥ó¥È¥ì¡¼¥¹¤ò¤¹¤ë¤¿¤á¤ÎÃÍ
#define WHITE 50 //»æ¥³¥Ã¥×¤òȽÃǤ¹¤ë¤¿¤á¤ÎÃÍ
#define turn_left1 SetPower(OUT_AC,2); Off(OUT_A); OnFwd(OUT_C); //º¸ÀÞ
#define turn_left2 SetPower(OUT_A,1); OnRev(OUT_A); OnFwd(OUT_C); //º¸Àû²ó
#define turn_right1 SetPower(OUT_AC,2); OnFwd(OUT_A); Off(OUT_C); //±¦ÀÞ
#define turn_right2 SetPower(OUT_C,1); OnFwd(OUT_A); OnRev(OUT_C); //±¦Àû²ó
#define go_forward SetPower(OUT_AC,7); OnFwd(OUT_AC); //Á°¿Ê
int cup_count=0; //¥³¥Ã¥×¤Î¥«¥¦¥ó¥È
¡Ú¥µ¥Ö¥ë¡¼¥Á¥ó¡Û
MIDDLE+3 //¾å¤ÇMIDDLE¤Ï50¤ÈÄêµÁ¤µ¤ì¤Æ¤¤¤ë¤Î¤Ç¡¢50+3=53¤È¤Ê¤ë
While(¾ò·ï¼°) //³ç¸ÌÆâ¤Î¾ò·ï¤¬Ëþ¤¿¤µ¤ì¤Æ¤¤¤ë´Ö¡¢»ØÄꤵ¤ì¤¿Æ°ºî¤ò³¤±¤ë
if(¾ò·ï¼°)¡¡¡¡¡¡¡¡ //³ç¸ÌÆâ¤Î¾ò·ï¤¬À®¤êΩ¤Ä¤È¤¡¢»ØÄꤵ¤ì¤¿Æ°ºî¤ò¹Ô¤¦
else if(¾ò·ï¼°)¡¡¡¡ //if°Ê³°¤Î¾ò·ï¤ò·è¤á¤ë¤³¤È¤¬¤Ç¤¤ë
~¡¥é¥¤¥ó¥È¥ì¡¼¥¹
~²ÝÂê2¤Ç¹Ô¤Ã¤¿¥é¥¤¥ó¥È¥ì¡¼¥¹¤òÍøÍѤ·¤Æ¤¤¤ë¡£¥é¥¤¥ó¥È¥ì¡¼¥¹¤È¤Ï¸÷¥»¥ó¥µ¤òÍѤ¤¤Æ¡¢¥í¥Ü¥Ã¥È¤Ë¹õ¤¤Àþ¤òǧ¼±¤µ¤»¡¢¥È¥ì¡¼¥¹¤µ¤»¤ë¤³¤È¤Ç¤¢¤ë¡£
sub trace() //¥é¥¤¥ó¥È¥ì¡¼¥¹
{
while(FastTimer(0) < 26) //º¸Àû²ó¤¬°ìÄê»þ´Ö³¤¯¤Þ¤Ç¥ë¡¼¥×
{
¡¡if(SENSOR_2 < MIDDLE-5) //¹õ
¡¡{
turn_left2; //º¸Àû²ó
¡¡}
¡¡else
¡¡{
¡¡if(SENSOR_2 < MIDDLE-2) //Ãæ´Ö¤Ë¶á¤¤¹õ
¡¡{
turn_left1; //º¸¶Ê¤¬¤ê
¡¡}
¡¡else if(SENSOR_2 < MIDDLE+3) //Ãæ´Ö
¡¡{
¡¡¡¡¡¡¡¡¡¡ go_forward; //ľ¿Ê
¡¡}
¡¡else if(SENSOR_2 < MIDDLE+6) //Ãæ´Ö¤Ë¶á¤¤Çò
¡¡{
turn_right1; //±¦¶Ê¤¬¤ê
¡¡}
¡¡else //Çò
¡¡{
turn_right2; //±¦Àû²ó
¡¡}
ClearTimer(0);
}
¡Ñ
}
~¢Ä¾¿Ê¤¹¤ë
sub i_forward() //ľ¿Ê
{
turn_right2;
Wait(30);
go_forward;
Wait(50);
Off(OUT_AC);
}
£º¸ÀÞ¤¹¤ë
sub i_left() //º¸ÀÞ
{¡¡
turn_left2;
Wait(45);
Off(OUT_AC);
}
¤±¦ÀÞ¤¹¤ë
sub i_right() //±¦ÀÞ
{
turn_right2;
Wait(30);
go_forward;
Wait(30);
turn_right2;
Wait(80);
Off(OUT_AC);
}
¥C¤ÈD¤Î1¤ÄÌܤΥ³¥Ã¥×¤ò¤Ä¤«¤ß¥é¥¤¥ó¥È¥ì¡¼¥¹¤Ç¤¤ë°ÌÃÖ¤Ë°ÜÆ°¤¹¤ë
»æ¥³¥Ã¥×¤ÎÇÛÃÖ¤ÈÈÖ¹æ¤Ï¾å¤ËµºÜ¤·¤Æ¤¤¤ë¡£
sub cup1() //C¤ÈD¤Î¤½¤ì¤¾¤ì¤Î1¤ÄÌܤΥ³¥Ã¥×
{
turn_right2; //»æ¥³¥Ã¥×¤Þ¤ÇÊý¸þÄ´À°
Wait(25);
SetPower(OUT_AC,1); //»æ¥³¥Ã¥×¤Þ¤Ç°Üư
OnFwd(OUT_AC);
while(SENSOR_3 <= WHITE);
Off(OUT_AC);
OnRev(OUT_B); //»æ¥³¥Ã¥×¤ò¤Ä¤«¤à
Wait(150);
Off(OUT_B);
turn_right2; //¥é¥¤¥ó¤Þ¤Ç°Üư
Wait(180);
go_forward;
Wait(20);
}
¦C¤ÈD¤Î2¤ÄÌܤΥ³¥Ã¥×¤ò¤ò¤Ä¤«¤ß¥é¥¤¥ó¥È¥ì¡¼¥¹¤Ç¤¤ë°ÌÃÖ¤Ë°ÜÆ°¤¹¤ë
sub cup2() //2¤ÄÌܤΥ³¥Ã¥×
{
SetPower(OUT_AC,1); //»æ¥³¥Ã¥×¤Þ¤Ç°Üư
OnFwd(OUT_AC);
OnFwd(OUT_AC);
while(SENSOR_3 <= WHITE);
Off(OUT_AC);
OnRev(OUT_B); //»æ¥³¥Ã¥×¤ò¤Ä¤«¤à
Wait(150);
Off(OUT_B);
turn_right2; //¥é¥¤¥ó¤Þ¤Ç°Üư
Wait(180);
go_forward;
Wait(120);
}
§C¤ÈD¤Î3¤ÄÌܤΥ³¥Ã¥×¤ò¤ò¤Ä¤«¤ß¥é¥¤¥ó¥È¥ì¡¼¥¹¤Ç¤¤ë°ÌÃÖ¤Ë°ÜÆ°¤¹¤ë
sub cup3() //3¤ÄÌܤΥ³¥Ã¥×
{
turn_right2; //»æ¥³¥Ã¥×¤Þ¤ÇÊý¸þÄ´À°
Wait(45);
SetPower(OUT_AC,1); //»æ¥³¥Ã¥×¤Þ¤Ç°Üư
OnFwd(OUT_AC);
while(SENSOR_3 <= WHITE);
Off(OUT_AC);
OnRev(OUT_B); //»æ¥³¥Ã¥×¤ò¤Ä¤«¤à
Wait(150);
Off(OUT_B);
turn_right2; //¥é¥¤¥ó¤Þ¤Ç°Üư
Wait(170);
go_forward;
Wait(100);
}
¨¥³¥Ã¥×¤ò²¼¤·¡¢¥í¥Ü¥Ã¥È1¤ÈÄÌ¿®¤¹¤ë
~¥³¥Ã¥×¤òÁ°¤Ë²¡¤¹¤³¤È¤Ç£²¤ÄÌܰʹߤΥ³¥Ã¥×¤ò½Å¤Í¤ë¤È¤¤Ë¡¢¤Ò¤Ã¤«¤«¤ê¥³¥Ã¥×¤¬Å¾Åݤ¹¤ë¤³¤È¤Î¤Ê¤¤¤è¤¦¤Ë¤·¤¿¡£
sub cup_down() //¥³¥Ã¥×¤ò²¼¤¹¤È¤¤Îưºî
{
turn_left2; //¥³¥Ã¥×¤ò²¼¤¹°ÌÃÖ¤Þ¤Ç°ÜÆ°
Wait(5);
OnRev(OUT_AC);
Wait(5);
Off(OUT_AC);
if(cup_count == 1) //ºÇ½é¤Î¥³¥Ã¥×¤òÃÖ¤¯¤È¤
{
SendMessage(SIGNALON); //¤â¤¦°ìÂæ¤Îưºî¤òºÆ³«¤¹¤ë
}
OnFwd(OUT_B);
Wait(50);
Off(OUT_B);
if(cup_count == 1) //ºÇ½é¤Î¥³¥Ã¥×¤òÃÖ¤¤¤¿¤È¤
{
OnFwd(OUT_AC); //¥³¥Ã¥×¤ò¾¯¤·Á°¤Ë²¡¤¹
Wait(10);
}
OnRev(OUT_AC); //¥é¥¤¥ó¤Þ¤Ç°Üư
Wait(60);
turn_left2;
Wait(120);
go_forward;
Wait(50);
}
¡Ú¥á¥¤¥ó¥×¥í¥°¥é¥à¡Û
~¥í¥Ü¥Ã¥È¤¬¸òº¹ÅÀ¤òȽÃǤ¹¤ë¤¿¤Ó¤ËÊÑ¿ô£ã¤ÎÃͤòÁý¤ä¤·¤Æ¤¤¤¡¢Àµ¤·¤¤½çÈÖ¤ÇÆ°ºî¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£course_check¤Ï£ÃÃÏÅÀ¤È£ÄÃÏÅÀ¤Î¤É¤Á¤é¤Ë¹Ô¤¯¤«¤ò¸ò¸ß¤ËȽÃǤǤ¤ë¤è¤¦¤Ë¤·¡¢cup_count¤Ï¤É¤Î»æ¥³¥Ã¥×¤Ç¤É¤Îưºî¤ò¹Ô¤¦¤Î¤«¶èÊ̤·¤¿¡£ÊÑ¿ô£ä¤Ï¤¹¤Ù¤Æ¤Î¥³¥Ã¥×¤ò²ó¼ý¤·¤¿¤È¤1¤Ë¤Ê¤ê¡¢Æ°ºî¤òÄä»ß¤¹¤ë¡£
task main()
{
SetSensor(SENSOR_2, SENSOR_LIGHT);
SetSensor(SENSOR_3, SENSOR_LIGHT);
int c=1; //¸òº¹ÅÀ¤Î³Îǧ
int d=0; //1¤Ë¤Ê¤Ã¤¿¤éưºîÄä»ß
int course_check=0; //0¤Ê¤éCÃÏÅÀ¤Ø¡¢1¤Ê¤éDÃÏÅÀ¤Ø
SetPower(OUT_B,1); //¥³¥Ã¥×¤ò¤Ä¤«¤à¤È¤¤Î¥â¡¼¥¿¶¯¤µ¤ò¼å¤¯¤¹¤ë
go_forward; //¥é¥¤¥ó¤Þ¤Çľ¿Ê
Wait(80);
while(d == 0)
{
ClearTimer(0);
trace(); //¥é¥¤¥ó¥È¥ì¡¼¥¹
Off(OUT_AC); //¸òº¹ÅÀ³Îǧ
PlaySound(SOUND_UP);
Wait(100);
switch(c)
{
case 1: //ºÇ½é¤Î¸òº¹ÅÀ
i_left(); //SÃÏÅÀ¤Ø
break;
case 2: //SÃÏÅÀ¤Î¸òº¹ÅÀ
if(course_check == 0)
{
i_right(); //CÃÏÅÀ¤Ø
}
else
{
i_left(); //DÃÏÅÀ¤Ø
i_left(); //DÃÏÅÀ¤Ø
}
break;
case 3: //CÃÏÅÀ¤«DÃÏÅÀ
if(cup_count < 2) //½¸¤á¤¿¥³¥Ã¥×¤¬2¤Ä¤è¤ê¾¯¤Ê¤¤¤Ê¤é
{
cup1();
}
else if(cup_count < 4) //½¸¤á¤¿¥³¥Ã¥×¤¬4¤Ä¤è¤ê¾¯¤Ê¤¤¤Ê¤é
{
cup2();
}
else //½¸¤á¤¿¥³¥Ã¥×¤¬4¤Ä°Ê¾å¤Ê¤é
{
cup3();
}
cup_count++;
break;
case 4:
if(course_check == 0) //CÃÏÅÀ¤«¤éÌá¤Ã¤Æ¤¤¿¤é
{
i_left(); //PÃÏÅÀ¤Ø
course_check = 1; //¼¡¤ÏDÃÏÅÀ¤Ø
}
else //DÃÏÅÀ¤«¤éÌá¤Ã¤Æ¤¤¿¤é
{
i_right(); //PÃÏÅÀ¤Ø
course_check = 0; //¼¡¤ÏCÃÏÅÀ¤Ø
}
break;
case 5: //PÃÏÅÀ¤Î¸òº¹ÅÀ
i_left(); //QÃÏÅÀ¤Ø
break;
case 6: //QÃÏÅÀ¤Î¸òº¹ÅÀ
cup_down();
if(cup_count == 6) //¥³¥Ã¥×¤ò½¸¤á½ª¤ï¤Ã¤¿¤é
{
d = 1; //ưºîÄä»ß
}
break;
case 7: //pÃÏÅÀ¤Î¸òº¹ÅÀ
i_right(); //SÃÏÅÀ¤Ø
c = 1; //case 2¤ËÌá¤ë
break;
¡¡}
¡¡c++;
¡¡}
¡¡Off(OUT_ABC);
}
*·ë²Ì [#uef4b412]
»ä¤¿¤Á¤ÎÈɤϡ¢1²óÌܤϥí¥Ü¥Ã¥È£±¤¬Àµ¤·¤¤¾ì½ê¤Ë¹Ô¤«¤º¡¢¤½¤Î¤º¤ì¤Ë¤è¤Ã¤Æ¥í¥Ü¥Ã¥È1¤Î¥¢¡¼¥à¤Ë¥³¥Ã¥×¤¬Åö¤¿¤ê¡¢¥³¥Ã¥×¤¬ÅÝ¤ì¤Æ¤·¤Þ¤Ã¤Æ¼ºÇÔ¤·¤¿¤¬¡¢2²óÌܤÎÄ©Àï¤Ç»æ¥³¥Ã¥×¤ò£±¤ÄCÃÏÅÀ¤«¤é±¿¤Ö¤³¤È¤ËÀ®¸ù¤·¤¿¡£¤·¤«¤·¡¢¤½¤Î¤¢¤È¥é¥¤¥ó¥È¥ì¡¼¥¹¤Ë¼ºÇÔ¤·¤¿¡£
~¤½¤Î·ë²Ì¡¢´ðËÜÅÀ¤Ï£³ÅÀ¡¢µ»½ÑÅÀ¤Ï9.2ÅÀ¤Î¹ç·×12.2ÅÀ¤ò³ÍÆÀ¤·¡¢£²°Ì¤À¤Ã¤¿¡£
*´¶ÁÛµÚ¤ÓÈ¿¾Ê [#jbbeb619]
º£²ó¤Ïº£¤Þ¤Ç¤Îµ»½Ñ¤òÁȤ߹ç¤ï¤»¤¿²ÝÂê¤À¤Ã¤¿¡£¤·¤«¤·¡¢¥×¥í¥°¥é¥à¤¬Á°²ó¤è¤ê¤â¾¯¤·Ä¹¤¯¡¦Ê£»¨²½¤¹¤ë¤À¤±¤Ç¡¢¥í¥Ü¥Ã¥È¤Ï¼«Ê¬¤ÎÁÛÁü¤È°Û¤Ê¤ëưºî¤ò¤·¡¢¾¯¤·¤Î¤º¤ì¤¬ºÇ½ªÅª¤ËÂ礤ʤº¤ì¤Ø¤È¤Ä¤Ê¤¬¤Ã¤Æ¤·¤Þ¤¦¡£º£²ó¤Ï»æ¥³¥Ã¥×¤ò±¿¤Ö¤À¤±¤À¤Ã¤¿¤¬¡¢¹Ò¶õµ¡¤Ê¤É¤Î¥×¥í¥°¥é¥à¤Ê¤é¤Ð¼ºÇԤϵö¤µ¤ì¤Ê¤¤¡£¤³¤Î¹ÖµÁ¤òÄ̤¸¤Æ¥×¥í¥°¥é¥à¤ÎÀµ³Î¤µ¡¦´Ê·é¤µ¤Î½ÅÍ×À¤È¥í¥Ü¥Ã¥È¤òÁȤßΩ¤Æ¤ëȯÁÛÎϤÎ˳¤·¤µ¤Ëµ¤¤Å¤¯¤³¤È¤¬¤Ç¤¤¿¡£
½ªÎ»¹Ô:
[[2016a/Member]]
*Ìܼ¡ [#t6aa239e]
#contents
*²ÝÂꣳ¤ÎÀâÌÀ [#xeb46890]
**´ðËܥ롼¥ë [#h818305c]
¥í¥Ü¥Ã¥È¥³¥ó¥Æ¥¹¥È¡Ê²ÝÂꣳ¡Ë¤Ï²ÝÂꣲ¤ÇºîÀ®¤·¤¿¥³¡¼¥¹¤òÍѤ¤¤Æ¥¿¥¤¥à¥ì¡¼¥¹¤ò¹Ô¤¤¡¢ºÇ½ªÆÀÅÀ¤Ç¾¡É餹¤ë¡£º£²ó¤Ï£²Âæ°Ê²¼¤Î¥í¥Ü¥Ã¥È¤ò»ÈÍѤ·¤Æ¡¢CÃÏÅÀ¡Ê£³¸Ä¡Ë¤ÈDÃÏÅÀ¡Ê£³¸Ä¡Ë¤Î£²²Õ½ê¤ËÀßÃÖ¤µ¤ì¤¿»æ¥³¥Ã¥×¤ò¥³¡¼¥¹Ãæ±û¤ÎÎØ¤ÎÃæ¤Ë¸ò¸ß¤Ë½Å¤Í¤ë¡£ºÇ½ªÅª¤ÊÅÀ¿ô¤Ï»æ¥³¥Ã¥×¤Î¸Ä¿ô¤Ë±þ¤¸¤¿´ðËÜÅÀ¤Èưºî¤ÎÀºÅÙ¡¦¥¹¥Ô¡¼¥É¡¦³Î¼ÂÀ¤Ê¤É¤ò´Þ¤á¤¿µ»½ÑŪ¤Ê¹©Éפä·Ý½ÑÀ¤Ë¤Ä¤¤¤Æ¤Îµ»½ÑÅÀ¤Î¹ç·×¤È¤¹¤ë¡£
**Ãí°ÕÅÀ [#h405738f]
-£²Âæ¤Î¥í¥Ü¥Ã¥È¤ÏAÃÏÅÀ¤ÈBÃÏÅÀ¤«¤é¥¹¥¿¡¼¥È¤¹¤ë¡£
-»æ¥³¥Ã¥×¤Ï¡ÊCÃÏÅÀ¤Î¥³¥Ã¥×¡Ë¢ª¡ÊDÃÏÅÀ¤Î¥³¥Ã¥×¡Ë¤Î½ç¤Ë½Å¤Í¤ë¡£
-ºÇ½ªÅª¤Ë»æ¥³¥Ã¥×¤Ï¥í¥Ü¥Ã¥È¤¬¿¨¤ì¤Æ¤¤¤Ê¤¤¾õÂ֤Ǽ«Î©¤·¤Æ¤¤¤ë¤³¤È¡£
-¶¥µ»»þ´Ö¤Ï»æ¥³¥Ã¥×¤ò¤¹¤Ù¤Æ¡ÊºÇÂ磶¸Ä¡Ë½Å¤Í¤ë¤«¡¢¿³È½¤¬Â³¹ÔÉÔǽ¤ÈȽÃǤ¹¤ë¤Þ¤Ç¡£
-¶¥µ»¤¬½ª¤ï¤ë¤Þ¤Ç¥í¥Ü¥Ã¥È¤Ë¿¨¤ì¤Æ¤Ï¤¤¤±¤Ê¤¤¡£
~²ÝÂꣳ¤Î¥ë¡¼¥ë¤Î¾ÜºÙ¤Ï[[¤³¤Á¤é:http://yakushi.shinshu-u.ac.jp/robotics/?2016a%2FMission3]]¤ò»²¾È
~²ÝÂꣲ¤Î¾ÜºÙ¤Ï[[¤³¤Á¤é:http://yakushi.shinshu-u.ac.jp/robotics/?2016a%2FMember%2Ffujison%2FMission2]]¤ò»²¾È
**»æ¥³¥Ã¥×¤ÎÇÛÃÖ [#y9f21e8b]
º£²ó¤Î²ÝÂê¤Ç¤Ï³ÆÃÏÅÀ¤ÎÏÈÆâ¤Ç¤¢¤ì¤Ð¼«Í³¤Ë»æ¥³¥Ã¥×¤òÇÛÃÖ¤·¤Æ¤è¤¤¡£
~»ä¤¿¤Á¤ÎÈɤϼ¡¤Î¿Þ¤Î¤è¤¦¤Ë»æ¥³¥Ã¥×¤òÇÛÃÖ¤·¤¿¡£
#ref(./»æ¥³¥Ã¥×ÇÛÃÖ.png,50%,»æ¥³¥Ã¥×¤ÎÇÛÃÖ)
*¥í¥Ü¥Ã¥È£± [#jaa4c235]
**Ìò³ä [#y6ef6d56]
¤³¤Î¥í¥Ü¥Ã¥È¤ÏAÃÏÅÀ¤«¤é¥¹¥¿¡¼¥È¤·¡¢¥³¡¼¥¹Ãæ±û¤ÇÂÔµ¡¤¹¤ë¡£¤½¤Î¸å¡¢¥í¥Ü¥Ã¥È2¤¬±¿¤ó¤Ç¤¤¿»æ¥³¥Ã¥×¤ò¶´¤ó¤ÇÍÞ¤¨¡¢½Å¤Í¤ë¤È¤¤ËÅݤì¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¤³¤È¤òÌÜŪ¤ËÀ©ºî¤·¤¿¡£
~¸÷¥»¥ó¥µ¤ò2¸Ä¤È¤â¥í¥Ü¥Ã¥È2¤Ë»È¤Ã¤Æ¤·¤Þ¤Ã¤¿¤Î¤Ç¡¢¥í¥Ü¥Ã¥È1¤Îưºî¤Ï¤¹¤Ù¤Æ»þ´Ö»ØÄê¤Ë¤Ê¤Ã¤¿¡£
¢¨ËÜÍè¤Ï¤½¤ÎͽÄê¤Çºî¤Ã¤¿¤¬¡¢ºÇ½é¤Î¥¹¥¿¡¼¥È°ÌÃ֤Τº¤ì¤ä¥í¥Ü¥Ã¥È¤ÎÄ´»Ò¤Ë¤è¤Ã¤Æ¡¢Àµ¤·¤¤¾ì½ê¤ÇÂÔµ¡¤Ç¤¤º¡¢¥í¥Ü¥Ã¥È2¤Îưºî¤Î¼ÙËâ¡¢»æ¥³¥Ã¥×¤ò¤¦¤Þ¤¯¸ÇÄê¤Ç¤¤Ê¤¤¤Ê¤É²ÝÂê¤ÎÀ®¸ùΨ¤¬²¼¤¬¤ë¤ÈȽÃǤ·¡¢¥í¥Ü¥³¥ó¤Î2²óÌܤÎÄ©Àï¤Ç¤Ï»ÈÍѤ·¤Ê¤«¤Ã¤¿¡£
**¹½Â¤ [#m7793056]
¡Ú¥í¥Ü¥Ã¥ÈÁ´ÂÎÁü¡Û
#ref(./image17.JPG,70%,¥í¥Ü¥Ã¥È£±Á´ÂÎÁü)
¡Ú¥í¥Ü¥Ã¥ÈÁ°Â¦¡Û
#ref(./image16.PNG,25%,¥í¥Ü¥Ã¥È£±Á°Â¦)
¡ÚÎϤθþ¤¤ÎÊÑ´¹¡Û
~º£²ó»ÈÍѤ·¤¿¥â¡¼¥¿¡¼¤Î²óž¤Ï¤â¤È¤â¤È½ÄÊý¸þ¤Ç¤¢¤ë¡£¤½¤Î¤¿¤á¡¢¤½¤Î¤Þ¤Þ¤Ç¤Ï¥â¡¼¥¿¡¼¤ÎÎϤò»ÈÍѤ·¤Æº¸±¦¤Ë¥¢¡¼¥à¤ò³«¤¤¤¿¤ê¡¢ÊĤ¸¤¿¤ê¤¹¤ë¤³¤È¤Ï¤Ç¤¤Ê¤¤¡£¤·¤«¤·¡¢¼Ì¿¿¤Î¤è¤¦¤Ë»õ¼Ö¡Ê¿å¿§¤Ç°Ï¤Ã¤¿¤â¤Î¡Ë¤ò»ÈÍѤ¹¤ë¤³¤È¤Ç¡¢½Ä¸þ¤¤ÎÎÏ(ÀÖ¤¤Ìð°õ¡Ë¤ò²£¸þ¤¤ÎÎÏ¡ÊÀĤ¤Ìð°õ¡Ë¤Ø¤ÈÊÑ´¹¤·¤Æ¤¤¤ë¡£
#ref(./image19.PNG,70%,ÎϤÎÊÑ´¹)
¡Ú²þÎÉÅÀ¡Û
-ÎФÎÏȡĥí¥Ü¥Ã¥È£²¤¬¥³¥Ã¥×¤ò²¼¤¹¤È¤¤Ë¥í¥Ü¥Ã¥È1¤Î¥¢¡¼¥à¤¬¼ÙËâ¤Ë¤Ê¤é¤Ê¤¤¤è¤¦¤Ë¡¢¤Ç¤¤ë¤À¤±¥¢¡¼¥à¤Î°ÌÃÖ¤ò²¼¤²¤¿¡£
-ÀĤÎÏȡĥ¿¥¤¥ä¤ò¾®¤µ¤¯¤·¡¢¥í¥Ü¥Ã¥È2¤Îưºî¤Î¼ÙËâ¤Ë¤Ê¤é¤Ê¤¤¤è¤¦¤Ë¤·¤¿¡£¤¿¤À¾®¤µ¤¯¤¹¤ë¤Î¤Ç¤Ï¤Ê¤¯¡¢¥³¥Ã¥×¤ò¤Ä¤«¤ó¤À»þ¤Î°ÂÄêÀ¤â³Îǧ¤·¤Ä¤Ä¡¢¥¿¥¤¥ä¤Î¥µ¥¤¥º¤ò·è¤á¤¿¡£
-ÀÖ¤ÎÏÈ¡Äα¤á¶ñ¤Ï¤Ç¤¤ë¤À¤±¾®¤µ¤¤¤â¤Î¤òÁª¤Ó¡¢¹â¤µ¤ò¤Ê¤¯¤¹¤³¤È¤Ç¡¢¥í¥Ü¥Ã¥È2¤¬¥³¥Ã¥×¤ò²¼¤¹¤È¤¤Ë°ú¤Ã¤«¤«¤ê¡¢¥³¥Ã¥×¤¬Å¾Åݤ·¤Ê¤¤¤è¤¦¤Ë¤·¤¿¡£
#ref(./image20.JPG,100%,²þÎÉÅÀ)
**¥×¥í¥°¥é¥à [#b64112f4]
~¡ÚÄêµÁ¡Û¡¡
#define SIGNALON 121 //121¤ÎÃͤò¥í¥Ü¥Ã¥È2¤«¤é¼õ¿®¤·¤¿¤È¤¡¢¼¡¤Î»ØÄꤵ¤ì¤¿Æ°ºî¤ò¹Ô¤¦¡£
~¢¨ÃͤÏ0¡Á255¤Þ¤Ç¤ÎÃͤò¥á¥Ã¥»¡¼¥¸¤È¤·¤ÆÁ÷¼õ¿®¤Ç¤¤ë¡£
~¡Ú´ðËÜÆ°ºî¡Û
ClearMessage //¥á¥Ã¥»¡¼¥¸(¡¡)¤ÎÃͤò0¤Ë½é´ü²½¤¹¤ë
ClearTimer(0) //Timer(0)¤ò¥ê¥»¥Ã¥È
OnFwd(OUT_A) //A¤Î¥â¡¼¥¿¤òÀµ²óž¤µ¤»¤ë
OnRev(OUT_AC) //A¤ÈC¤Î¥â¡¼¥¿¤òµÕ²óž¤µ¤»¤ë
Wait(t) //Á°¤Îưºî¤òtÉôֹԤ¤¡¢¤½¤Î´Ö¼¡¤Îưºî¤Ë¤Ï¿Ê¤Þ¤Ê¤¤
Off //¥â¡¼¥¿¤òÄä»ß¤µ¤»¤ë
~¡Ú¥á¥¤¥ó¥×¥í¥°¥é¥à¡Û
task main()
{
ClearMessage();
ClearTimer(0);
OnRev(OUT_AC); //QÃÏÅÀ¤Þ¤Ç°Üư¤¹¤ë
Wait(450);
Off(OUT_AC);
OnRev(OUT_A); //¥í¥Ü¥Ã¥È1¤Î¸þ¤¤ÎÄ´À°¤ò¤¹¤ë
OnFwd(OUT_C);
Wait(5);
Off(OUT_AC);
until(Message() == SIGNALON); //until¡Ä¤¢¤ë¾ò·ï¤¬Ëþ¤¿¤µ¤ì¤ë¤Þ¤Çưºî¤òÄä»ß¤¹¤ë
Wait(150); //¥í¥Ü¥Ã¥È2¤¬±¿¤ó¤Ç¤¤¿»æ¥³¥Ã¥×¤Î°ÌÃÖ¤òÄ´À°
OnFwd(OUT_B);
Wait(10);
Off(OUT_B);
Wait(30000); //»æ¥³¥Ã¥×¤¬¤¹¤Ù¤Æ½Å¤Í½ª¤ï¤ë¤Þ¤ÇÄä»ß
OnRev(OUT_B); //¥¢¡¼¥à¤ò¹¤²¡¢»æ¥³¥Ã¥×¤òÎ¥¤¹
Wait(20);
Off(OUT_B);
OnRev(OUT_AC); //»æ¥³¥Ã¥×¤«¤éÎ¥¤ì¤ë
Wait(30);
Off(OUT_AC);
}
*¥í¥Ü¥Ã¥È£²(¤Ä¤«¤à¡¦½Å¤Í¤ë) [#je00e591]
**Ìò³ä [#r1389d1c]
¤³¤Î¥í¥Ü¥Ã¥È¤ÏBÃÏÅÀ¤«¤é¥¹¥¿¡¼¥È¤·¡¢¥é¥¤¥ó¥È¥ì¡¼¥¹¤ò¹Ô¤Ã¤Æ¡¢»æ¥³¥Ã¥×¤Î¤¢¤ëÃÏÅÀ¤Ø¹Ô¤¯¡£¤µ¤é¤Ë¡¢»æ¥³¥Ã¥×¤ò¤Ä¤«¤àÌò³ä¤È½Å¤Í¤ëÌò³ä¤ò»ý¤Ã¤Æ¤¤¤ë¡£
**¹½Â¤ [#d57fe889]
¡Ú¥í¥Ü¥Ã¥È2Á´ÂÎÁü²£Â¦¡Û
#ref(./image25.jpg,90%,Á´ÂÎÁü²£Â¦)
¡Ú¥í¥Ü¥Ã¥È2Á´ÂÎÁüÁ°Â¦¡Û
¸÷¥»¥ó¥µ¡¼¤ò¥¢¡¼¥à¤ÈƱ¤¸Ì̤ËÉÕ¤±¤ë¤³¤È¤Ç¡¢»æ¥³¥Ã¥×¤ò¤Ä¤«¤à»þ¤ËÀ¸¤¸¤ë¡¢¥í¥Ü¥Ã¥È¤È»æ¥³¥Ã¥×¤Î´Ö¹ç¤¤¤Î¤º¤ì¤ò¤Ç¤¤ë¤À¤±ÍÞ¤¨¤¿¡£
¤³¤Î¥í¥Ü¥Ã¥È¤Ï»æ¥³¥Ã¥×¤ò½Å¤Í¤ëºÝ¤Ë¥í¥Ü¥Ã¥È1¤È¤Î¾×ÆÍ¤ò¸º¤é¤¹¤¿¤á¤Ë¡¢³Æ¥¢¡¼¥à¤Ë¥¿¥¤¥ä¤ò1¤Ä¤·¤«¼è¤êÉÕ¤±¤Æ¤¤¤Ê¤¤¡£¤Ä¤Þ¤ê¡¢»æ¥³¥Ã¥×¤ò»ý¤Á¾å¤²¤¿¤ê¡¢±¿¤ó¤À¤ê¤¹¤ë¤È¤¤Î°ÂÄêÀ¤¬Ä㤤¤Î¤Ç¡¢³ÆÆ°ºî¤ò¹Ô¤¦¤È¤¤ËÊ̤ÎÍýͳ¤Ç»æ¥³¥Ã¥×¤¬¤º¤ì¤¿¤ê¡¢Íî¤È¤·¤¿¤ê¤¹¤ë¤³¤È¤ò¸º¤é¤·¤Æ¤¤¤ë¡£
#ref(./image26.jpg,90%,Á´ÂÎÁüÁ°Â¦)
¡Ú¸÷¥»¥ó¥µ¡¼¡Û
¥¿¥Ã¥Á¥»¥ó¥µ¡¼¤Ç¤Ï»æ¥³¥Ã¥×¤ËÈ¿±þ¤·¤Ê¤¤¡¦»æ¥³¥Ã¥×¤¬¤º¤ì¤ë²ÄǽÀ¤¬¹Í¤¨¤é¤ì¤¿¤Î¤Ç¸÷¥»¥ó¥µ¡¼¤ò»ÈÍѤ·¤¿¡£
¾å¦¡ÊÀÖ¿§¤ÎÏȤǰϤޤ줿¡Ë¸÷¥»¥ó¥µ¡¼¤Ï»æ¥³¥Ã¥×¤Î¼±Ê̤Τ¿¤á¤Ë»ÈÍÑ¡£
²¼Â¦¡ÊÀÄ¿§¤ÎÏȤǰϤޤ줿¡Ë¸÷¥»¥ó¥µ¡¼¤Ï¥é¥¤¥ó¥È¥ì¡¼¥¹¤Î¤¿¤á¤Ë»ÈÍÑ¡£
¢¨¾å¦¤Ë»æ¥³¥Ã¥×ÍÑ¡¢²¼Â¦¤Ë¥é¥¤¥ó¥È¥ì¡¼¥¹ÍѤòÉÕ¤±¤¿¡£¤³¤Î·Á¡ÊÁ´ÂÎÁüÁ°Â¦µÚ¤Ó²¼¤Î¸÷¥»¥ó¥µ¡¼¤Î¼Ì¿¿»²¾È¡Ë¤Ë¤·¤¿¤Î¤Ï¡¢¸÷¥»¥ó¥µ¡¼¤¬¿¿¤óÃæ¤Ë¤¢¤ë¤³¤È¤Ç¡¢¶´¤à»þ¤Ë¥¢¡¼¥à¤¬»æ¥³¥Ã¥×¤ËÂФ·¤Æ¡¢Æ±»þ¤ËÎϤò²Ã¤¨¤ë¤³¤È¤¬¤Ç¤¤ë¤è¤¦¤Ë¤¹¤ë¤¿¤á¤Ç¤¢¤ë¡£¤½¤Î·ë²Ì¡¢¥¢¡¼¥à¤ÎÎϤΤĤê¹ç¤¤¤¬¼è¤ì¤º¥³¥Ã¥×¤¬Å¾Åݤ·¤¿¤ê¡¢¤Ä¤«¤á¤Ê¤«¤Ã¤¿¤ê¤¹¤ë¤³¤È¤òËɤ¤¤Ç¤¤¤ë¡£
#ref(./image21.jpg,50%,¸÷¥»¥ó¥µ¡¼)
**¤Ä¤«¤à¡¦½Å¤Í¤ë»ÅÁÈ¤ß [#v8827f28]
»æ¥³¥Ã¥×¤ò½Å¤Í¤ë¤Þ¤Ç¤Î¼ê½ç¤Ï°Ê²¼¤ÎÄ̤ê¤Ç¤¢¤ë¡£
+¥¢¡¼¥à¤¬(¥¢¡¼¥à¼Ì¿¿¡¤ÎÀÖ¤¤Ìð°õ¤ÎÊý¸þ¤Ë)ÊĤ¸¤ë¡£
+»æ¥³¥Ã¥×¤ò¤Ä¤«¤à¡£
~¢¨»æ¥³¥Ã¥×¾å¦¤ÎÊ¥¤¬¥¢¡¼¥à¤Î¥¿¥¤¥äÉôʬ¤Ë°ú¤Ã¤«¤«¤ë¤³¤È¤Ç»æ¥³¥Ã¥×¤ò»ý¤Á¾å¤²¤Æ¤¤¤ë¡£
#ref(./image24.png,50%,¤Ä¤«¤ßÊý)
+¸Â³¦¤Þ¤Ç»æ¥³¥Ã¥×¤ò¤Ä¤«¤à¡£¤Ä¤Þ¤ê¡¢¥¢¡¼¥à¼Ì¿¿¡¤ÎÀÖ¤¤Ìð°õ¤ÎÊý¸þ¤Ë¤½¤ì°Ê¾åÎϤò²Ã¤¨¤ë¤³¤È¤¬¤Ç¤¤Ê¤¤¾õÂÖ¤Ë㤹¤ë¡£
+¤½¤ì¤Þ¤Ç¡¢¥¢¡¼¥à¤òÊĤ¸¤ëÊý¸þ¤Ë¤«¤«¤Ã¤Æ¤¤¤¿ÎϤ¬¡¢¾å¸þ¤¡Ê¥¢¡¼¥à¼Ì¿¿¢¤ÎÀÖ¤¤Ìð°õ¤ÎÊý¸þ¡Ë¤ËÎϤ¬¤«¤«¤ê»Ï¤á¤ë¡£
+¥¢¡¼¥à¤Ï¾å¤Ø¤Èư¤»æ¥³¥Ã¥×¤¬»ý¤Á¾å¤¬¤ë¡£
+²¼¤¹¤È¤¤Ï¥â¡¼¥¿¡¼¤òµÕ¸þ¤¤Ë²ó¤»¤Ð¡¢¼«Æ°Åª¤Ë²¼¤ê¡¢¥¢¡¼¥à¤¬³«¤¯¤Î¤Ç¡¢½Å¤Í¤ë¤³¤È¤¬¤Ç¤¤ë¡£
~¢¨¥â¡¼¥¿¡¼¤ÎÎϤÎÊÑ´¹ÊýË¡¡Ê¥¢¡¼¥à¼Ì¿¿¡¤ÎÀĤ¤ÏȡˤϾå¦(¥í¥Ü¥Ã¥È1/¹½Â¤)¤ËµºÜ¤·¤Æ¤¤¤ë¡£
~¡Ú¥¢¡¼¥à¼Ì¿¿¡¡Û
#ref(./image23.jpg,50%,¥¢¡¼¥àÁ°Â¦)
¡Ú¥¢¡¼¥à¼Ì¿¿¢¡Û
#ref(./image11.JPG,50%,¥¢¡¼¥à²£Â¦)
¡ÚÌäÂêÅÀ¡Û
~¥¢¡¼¥à¤ò¾å²¼¤Ëư¤«¤¹¤È¤¤Î¥¹¥Ô¡¼¥É¤Ï¥¢¡¼¥à¤Î¥®¥¢Èæ(³Æ¥®¥¢¤ÎÂ礤µ¤È¥®¥¢Æ±»Î¤Î¥µ¥¤¥º¤Î°ã¤¤)¤Ë¤è¤Ã¤Æ·è¤Þ¤ë¡£¤·¤«¤·¡¢¤½¤Î¤³¤È¤ò¤¢¤Þ¤ê¾Ü¤·¤¯ÃΤé¤Ê¤«¤Ã¤¿¤³¤È¤â¤¢¤ê¡¢²þÎɤ¹¤ë¤³¤È¤¬¤Ç¤¤Ê¤«¤Ã¤¿¡£¼¡¤Îµ¡²ñ¤Çº¤¤é¤Ê¤¤¤è¤¦¤ËÄ´¤Ù¤Æ¤ª¤¤¿¤¤¡£
**¥×¥í¥°¥é¥à [#n60595f3]
¡ÚÄêµÁ¡Û
#define SIGNALON 121 //ÄÌ¿®ÍÑ
#define MIDDLE 50 //¥é¥¤¥ó¥È¥ì¡¼¥¹¤ò¤¹¤ë¤¿¤á¤ÎÃÍ
#define WHITE 50 //»æ¥³¥Ã¥×¤òȽÃǤ¹¤ë¤¿¤á¤ÎÃÍ
#define turn_left1 SetPower(OUT_AC,2); Off(OUT_A); OnFwd(OUT_C); //º¸ÀÞ
#define turn_left2 SetPower(OUT_A,1); OnRev(OUT_A); OnFwd(OUT_C); //º¸Àû²ó
#define turn_right1 SetPower(OUT_AC,2); OnFwd(OUT_A); Off(OUT_C); //±¦ÀÞ
#define turn_right2 SetPower(OUT_C,1); OnFwd(OUT_A); OnRev(OUT_C); //±¦Àû²ó
#define go_forward SetPower(OUT_AC,7); OnFwd(OUT_AC); //Á°¿Ê
int cup_count=0; //¥³¥Ã¥×¤Î¥«¥¦¥ó¥È
¡Ú¥µ¥Ö¥ë¡¼¥Á¥ó¡Û
MIDDLE+3 //¾å¤ÇMIDDLE¤Ï50¤ÈÄêµÁ¤µ¤ì¤Æ¤¤¤ë¤Î¤Ç¡¢50+3=53¤È¤Ê¤ë
While(¾ò·ï¼°) //³ç¸ÌÆâ¤Î¾ò·ï¤¬Ëþ¤¿¤µ¤ì¤Æ¤¤¤ë´Ö¡¢»ØÄꤵ¤ì¤¿Æ°ºî¤ò³¤±¤ë
if(¾ò·ï¼°)¡¡¡¡¡¡¡¡ //³ç¸ÌÆâ¤Î¾ò·ï¤¬À®¤êΩ¤Ä¤È¤¡¢»ØÄꤵ¤ì¤¿Æ°ºî¤ò¹Ô¤¦
else if(¾ò·ï¼°)¡¡¡¡ //if°Ê³°¤Î¾ò·ï¤ò·è¤á¤ë¤³¤È¤¬¤Ç¤¤ë
~¡¥é¥¤¥ó¥È¥ì¡¼¥¹
~²ÝÂê2¤Ç¹Ô¤Ã¤¿¥é¥¤¥ó¥È¥ì¡¼¥¹¤òÍøÍѤ·¤Æ¤¤¤ë¡£¥é¥¤¥ó¥È¥ì¡¼¥¹¤È¤Ï¸÷¥»¥ó¥µ¤òÍѤ¤¤Æ¡¢¥í¥Ü¥Ã¥È¤Ë¹õ¤¤Àþ¤òǧ¼±¤µ¤»¡¢¥È¥ì¡¼¥¹¤µ¤»¤ë¤³¤È¤Ç¤¢¤ë¡£
sub trace() //¥é¥¤¥ó¥È¥ì¡¼¥¹
{
while(FastTimer(0) < 26) //º¸Àû²ó¤¬°ìÄê»þ´Ö³¤¯¤Þ¤Ç¥ë¡¼¥×
{
¡¡if(SENSOR_2 < MIDDLE-5) //¹õ
¡¡{
turn_left2; //º¸Àû²ó
¡¡}
¡¡else
¡¡{
¡¡if(SENSOR_2 < MIDDLE-2) //Ãæ´Ö¤Ë¶á¤¤¹õ
¡¡{
turn_left1; //º¸¶Ê¤¬¤ê
¡¡}
¡¡else if(SENSOR_2 < MIDDLE+3) //Ãæ´Ö
¡¡{
¡¡¡¡¡¡¡¡¡¡ go_forward; //ľ¿Ê
¡¡}
¡¡else if(SENSOR_2 < MIDDLE+6) //Ãæ´Ö¤Ë¶á¤¤Çò
¡¡{
turn_right1; //±¦¶Ê¤¬¤ê
¡¡}
¡¡else //Çò
¡¡{
turn_right2; //±¦Àû²ó
¡¡}
ClearTimer(0);
}
¡Ñ
}
~¢Ä¾¿Ê¤¹¤ë
sub i_forward() //ľ¿Ê
{
turn_right2;
Wait(30);
go_forward;
Wait(50);
Off(OUT_AC);
}
£º¸ÀÞ¤¹¤ë
sub i_left() //º¸ÀÞ
{¡¡
turn_left2;
Wait(45);
Off(OUT_AC);
}
¤±¦ÀÞ¤¹¤ë
sub i_right() //±¦ÀÞ
{
turn_right2;
Wait(30);
go_forward;
Wait(30);
turn_right2;
Wait(80);
Off(OUT_AC);
}
¥C¤ÈD¤Î1¤ÄÌܤΥ³¥Ã¥×¤ò¤Ä¤«¤ß¥é¥¤¥ó¥È¥ì¡¼¥¹¤Ç¤¤ë°ÌÃÖ¤Ë°ÜÆ°¤¹¤ë
»æ¥³¥Ã¥×¤ÎÇÛÃÖ¤ÈÈÖ¹æ¤Ï¾å¤ËµºÜ¤·¤Æ¤¤¤ë¡£
sub cup1() //C¤ÈD¤Î¤½¤ì¤¾¤ì¤Î1¤ÄÌܤΥ³¥Ã¥×
{
turn_right2; //»æ¥³¥Ã¥×¤Þ¤ÇÊý¸þÄ´À°
Wait(25);
SetPower(OUT_AC,1); //»æ¥³¥Ã¥×¤Þ¤Ç°Üư
OnFwd(OUT_AC);
while(SENSOR_3 <= WHITE);
Off(OUT_AC);
OnRev(OUT_B); //»æ¥³¥Ã¥×¤ò¤Ä¤«¤à
Wait(150);
Off(OUT_B);
turn_right2; //¥é¥¤¥ó¤Þ¤Ç°Üư
Wait(180);
go_forward;
Wait(20);
}
¦C¤ÈD¤Î2¤ÄÌܤΥ³¥Ã¥×¤ò¤ò¤Ä¤«¤ß¥é¥¤¥ó¥È¥ì¡¼¥¹¤Ç¤¤ë°ÌÃÖ¤Ë°ÜÆ°¤¹¤ë
sub cup2() //2¤ÄÌܤΥ³¥Ã¥×
{
SetPower(OUT_AC,1); //»æ¥³¥Ã¥×¤Þ¤Ç°Üư
OnFwd(OUT_AC);
OnFwd(OUT_AC);
while(SENSOR_3 <= WHITE);
Off(OUT_AC);
OnRev(OUT_B); //»æ¥³¥Ã¥×¤ò¤Ä¤«¤à
Wait(150);
Off(OUT_B);
turn_right2; //¥é¥¤¥ó¤Þ¤Ç°Üư
Wait(180);
go_forward;
Wait(120);
}
§C¤ÈD¤Î3¤ÄÌܤΥ³¥Ã¥×¤ò¤ò¤Ä¤«¤ß¥é¥¤¥ó¥È¥ì¡¼¥¹¤Ç¤¤ë°ÌÃÖ¤Ë°ÜÆ°¤¹¤ë
sub cup3() //3¤ÄÌܤΥ³¥Ã¥×
{
turn_right2; //»æ¥³¥Ã¥×¤Þ¤ÇÊý¸þÄ´À°
Wait(45);
SetPower(OUT_AC,1); //»æ¥³¥Ã¥×¤Þ¤Ç°Üư
OnFwd(OUT_AC);
while(SENSOR_3 <= WHITE);
Off(OUT_AC);
OnRev(OUT_B); //»æ¥³¥Ã¥×¤ò¤Ä¤«¤à
Wait(150);
Off(OUT_B);
turn_right2; //¥é¥¤¥ó¤Þ¤Ç°Üư
Wait(170);
go_forward;
Wait(100);
}
¨¥³¥Ã¥×¤ò²¼¤·¡¢¥í¥Ü¥Ã¥È1¤ÈÄÌ¿®¤¹¤ë
~¥³¥Ã¥×¤òÁ°¤Ë²¡¤¹¤³¤È¤Ç£²¤ÄÌܰʹߤΥ³¥Ã¥×¤ò½Å¤Í¤ë¤È¤¤Ë¡¢¤Ò¤Ã¤«¤«¤ê¥³¥Ã¥×¤¬Å¾Åݤ¹¤ë¤³¤È¤Î¤Ê¤¤¤è¤¦¤Ë¤·¤¿¡£
sub cup_down() //¥³¥Ã¥×¤ò²¼¤¹¤È¤¤Îưºî
{
turn_left2; //¥³¥Ã¥×¤ò²¼¤¹°ÌÃÖ¤Þ¤Ç°ÜÆ°
Wait(5);
OnRev(OUT_AC);
Wait(5);
Off(OUT_AC);
if(cup_count == 1) //ºÇ½é¤Î¥³¥Ã¥×¤òÃÖ¤¯¤È¤
{
SendMessage(SIGNALON); //¤â¤¦°ìÂæ¤Îưºî¤òºÆ³«¤¹¤ë
}
OnFwd(OUT_B);
Wait(50);
Off(OUT_B);
if(cup_count == 1) //ºÇ½é¤Î¥³¥Ã¥×¤òÃÖ¤¤¤¿¤È¤
{
OnFwd(OUT_AC); //¥³¥Ã¥×¤ò¾¯¤·Á°¤Ë²¡¤¹
Wait(10);
}
OnRev(OUT_AC); //¥é¥¤¥ó¤Þ¤Ç°Üư
Wait(60);
turn_left2;
Wait(120);
go_forward;
Wait(50);
}
¡Ú¥á¥¤¥ó¥×¥í¥°¥é¥à¡Û
~¥í¥Ü¥Ã¥È¤¬¸òº¹ÅÀ¤òȽÃǤ¹¤ë¤¿¤Ó¤ËÊÑ¿ô£ã¤ÎÃͤòÁý¤ä¤·¤Æ¤¤¤¡¢Àµ¤·¤¤½çÈÖ¤ÇÆ°ºî¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£course_check¤Ï£ÃÃÏÅÀ¤È£ÄÃÏÅÀ¤Î¤É¤Á¤é¤Ë¹Ô¤¯¤«¤ò¸ò¸ß¤ËȽÃǤǤ¤ë¤è¤¦¤Ë¤·¡¢cup_count¤Ï¤É¤Î»æ¥³¥Ã¥×¤Ç¤É¤Îưºî¤ò¹Ô¤¦¤Î¤«¶èÊ̤·¤¿¡£ÊÑ¿ô£ä¤Ï¤¹¤Ù¤Æ¤Î¥³¥Ã¥×¤ò²ó¼ý¤·¤¿¤È¤1¤Ë¤Ê¤ê¡¢Æ°ºî¤òÄä»ß¤¹¤ë¡£
task main()
{
SetSensor(SENSOR_2, SENSOR_LIGHT);
SetSensor(SENSOR_3, SENSOR_LIGHT);
int c=1; //¸òº¹ÅÀ¤Î³Îǧ
int d=0; //1¤Ë¤Ê¤Ã¤¿¤éưºîÄä»ß
int course_check=0; //0¤Ê¤éCÃÏÅÀ¤Ø¡¢1¤Ê¤éDÃÏÅÀ¤Ø
SetPower(OUT_B,1); //¥³¥Ã¥×¤ò¤Ä¤«¤à¤È¤¤Î¥â¡¼¥¿¶¯¤µ¤ò¼å¤¯¤¹¤ë
go_forward; //¥é¥¤¥ó¤Þ¤Çľ¿Ê
Wait(80);
while(d == 0)
{
ClearTimer(0);
trace(); //¥é¥¤¥ó¥È¥ì¡¼¥¹
Off(OUT_AC); //¸òº¹ÅÀ³Îǧ
PlaySound(SOUND_UP);
Wait(100);
switch(c)
{
case 1: //ºÇ½é¤Î¸òº¹ÅÀ
i_left(); //SÃÏÅÀ¤Ø
break;
case 2: //SÃÏÅÀ¤Î¸òº¹ÅÀ
if(course_check == 0)
{
i_right(); //CÃÏÅÀ¤Ø
}
else
{
i_left(); //DÃÏÅÀ¤Ø
i_left(); //DÃÏÅÀ¤Ø
}
break;
case 3: //CÃÏÅÀ¤«DÃÏÅÀ
if(cup_count < 2) //½¸¤á¤¿¥³¥Ã¥×¤¬2¤Ä¤è¤ê¾¯¤Ê¤¤¤Ê¤é
{
cup1();
}
else if(cup_count < 4) //½¸¤á¤¿¥³¥Ã¥×¤¬4¤Ä¤è¤ê¾¯¤Ê¤¤¤Ê¤é
{
cup2();
}
else //½¸¤á¤¿¥³¥Ã¥×¤¬4¤Ä°Ê¾å¤Ê¤é
{
cup3();
}
cup_count++;
break;
case 4:
if(course_check == 0) //CÃÏÅÀ¤«¤éÌá¤Ã¤Æ¤¤¿¤é
{
i_left(); //PÃÏÅÀ¤Ø
course_check = 1; //¼¡¤ÏDÃÏÅÀ¤Ø
}
else //DÃÏÅÀ¤«¤éÌá¤Ã¤Æ¤¤¿¤é
{
i_right(); //PÃÏÅÀ¤Ø
course_check = 0; //¼¡¤ÏCÃÏÅÀ¤Ø
}
break;
case 5: //PÃÏÅÀ¤Î¸òº¹ÅÀ
i_left(); //QÃÏÅÀ¤Ø
break;
case 6: //QÃÏÅÀ¤Î¸òº¹ÅÀ
cup_down();
if(cup_count == 6) //¥³¥Ã¥×¤ò½¸¤á½ª¤ï¤Ã¤¿¤é
{
d = 1; //ưºîÄä»ß
}
break;
case 7: //pÃÏÅÀ¤Î¸òº¹ÅÀ
i_right(); //SÃÏÅÀ¤Ø
c = 1; //case 2¤ËÌá¤ë
break;
¡¡}
¡¡c++;
¡¡}
¡¡Off(OUT_ABC);
}
*·ë²Ì [#uef4b412]
»ä¤¿¤Á¤ÎÈɤϡ¢1²óÌܤϥí¥Ü¥Ã¥È£±¤¬Àµ¤·¤¤¾ì½ê¤Ë¹Ô¤«¤º¡¢¤½¤Î¤º¤ì¤Ë¤è¤Ã¤Æ¥í¥Ü¥Ã¥È1¤Î¥¢¡¼¥à¤Ë¥³¥Ã¥×¤¬Åö¤¿¤ê¡¢¥³¥Ã¥×¤¬ÅÝ¤ì¤Æ¤·¤Þ¤Ã¤Æ¼ºÇÔ¤·¤¿¤¬¡¢2²óÌܤÎÄ©Àï¤Ç»æ¥³¥Ã¥×¤ò£±¤ÄCÃÏÅÀ¤«¤é±¿¤Ö¤³¤È¤ËÀ®¸ù¤·¤¿¡£¤·¤«¤·¡¢¤½¤Î¤¢¤È¥é¥¤¥ó¥È¥ì¡¼¥¹¤Ë¼ºÇÔ¤·¤¿¡£
~¤½¤Î·ë²Ì¡¢´ðËÜÅÀ¤Ï£³ÅÀ¡¢µ»½ÑÅÀ¤Ï9.2ÅÀ¤Î¹ç·×12.2ÅÀ¤ò³ÍÆÀ¤·¡¢£²°Ì¤À¤Ã¤¿¡£
*´¶ÁÛµÚ¤ÓÈ¿¾Ê [#jbbeb619]
º£²ó¤Ïº£¤Þ¤Ç¤Îµ»½Ñ¤òÁȤ߹ç¤ï¤»¤¿²ÝÂê¤À¤Ã¤¿¡£¤·¤«¤·¡¢¥×¥í¥°¥é¥à¤¬Á°²ó¤è¤ê¤â¾¯¤·Ä¹¤¯¡¦Ê£»¨²½¤¹¤ë¤À¤±¤Ç¡¢¥í¥Ü¥Ã¥È¤Ï¼«Ê¬¤ÎÁÛÁü¤È°Û¤Ê¤ëưºî¤ò¤·¡¢¾¯¤·¤Î¤º¤ì¤¬ºÇ½ªÅª¤ËÂ礤ʤº¤ì¤Ø¤È¤Ä¤Ê¤¬¤Ã¤Æ¤·¤Þ¤¦¡£º£²ó¤Ï»æ¥³¥Ã¥×¤ò±¿¤Ö¤À¤±¤À¤Ã¤¿¤¬¡¢¹Ò¶õµ¡¤Ê¤É¤Î¥×¥í¥°¥é¥à¤Ê¤é¤Ð¼ºÇԤϵö¤µ¤ì¤Ê¤¤¡£¤³¤Î¹ÖµÁ¤òÄ̤¸¤Æ¥×¥í¥°¥é¥à¤ÎÀµ³Î¤µ¡¦´Ê·é¤µ¤Î½ÅÍ×À¤È¥í¥Ü¥Ã¥È¤òÁȤßΩ¤Æ¤ëȯÁÛÎϤÎ˳¤·¤µ¤Ëµ¤¤Å¤¯¤³¤È¤¬¤Ç¤¤¿¡£
¥Ú¡¼¥¸Ì¾: