2017a/Member/tsukuzin/Mission3
¤ò¥Æ¥ó¥×¥ì¡¼¥È¤Ë¤·¤ÆºîÀ®
[
¥È¥Ã¥×
] [
¿·µ¬
|
°ìÍ÷
|
¸¡º÷
|
ºÇ½ª¹¹¿·
|
¥Ø¥ë¥×
|
¥í¥°¥¤¥ó
]
³«»Ï¹Ô:
[[2017a/Member]]
#contents
*Mission3 [#t26ce7e0]
ºÇ¸å¤Î²ÝÂê¤ÏMission2¤Ç»ÈÍѤ·¤¿¥³¡¼¥È¤Î³Æ½ê¤Ë²èÁü¤Î¤è¤¦¤Ë¶õ¤´Ì¡¢¤Þ¤¿¤ÏÃæ¿È¤ÎÆþ¤Ã¤¿´Ì¤òÇÛÃÖ¤·¡¢¥´¡¼¥ë¤Þ¤Ç±¿¤Ö¶¥µ»¤Ç¤¢¤ë¡£¾Ü¤·¤¯¤Ï¤³¤Á¤é¤Ë[[Mission3:http://yakushi.shinshu-u.ac.jp/robotics/?2017a%2FMission3]]½ñ¤¤¤Æ¤¢¤ë¤Î¤Ç»²¾È´ê¤¤¤¿¤¤¡£
&ref(2017a/Mission3/2017a-mission3.png,100%,);
*ưºî¤Î¹½ÁۤˤĤ¤¤Æ [#c580d2fe]
¤³¤Î¶¥µ»¤Ç¤É¤Î¤è¤¦¤Ë¥Ý¥¤¥ó¥È¤ò²Ô¤°¤«¥Á¡¼¥àÆâ¤ÇÏä·¹ç¤Ã¤¿·ë²Ì
¡°ìÂæ¤Ï´Ì¤Î¼ý½¸¤«¤éÀ°Îó
#ref(2017a/Member/tsukuzin/Mission3/¹½ÁÛ£±.gif,40%,);
¢¤â¤¦°ìÂæ¤¬¤½¤í¤¨¤¿´Ì¤òÀѤà
#ref(2017a/Member/tsukuzin/Mission3/¹½ÁÛ2.gif,40%,);
¤È¤¤¤¦Æ°ºî¤ò¤µ¤»¤ë¤³¤È¤Ç¹çÃפ·¤¿¡£¤³¤Î¹½ÁۤǤ¢¤ì¤ÐMission2¤Ç¶ìÀ路¤¿¥é¥¤¥ó¥È¥ì¡¼¥¹¤ò¹Ô¤¦É¬Íפ¬¤Ê¤¯¡¢¥·¥ó¥×¥ë¤Êưºî¤Ç¥Ý¥¤¥ó¥È¤ò²Ô¤°¤³¤È¤¬½ÐÍè¤ë¤È¹Í¤¨¤¿¡£
¤·¤«¤·¤Ê¤¬¤é¡¢&color(white,red){RISƱ»Î¤ÎÄÌ¿®¤ÎÀÖ³°Àþ¤¬»×¤Ã¤¿¤è¤ê¤â¼å¤¯};¡¢·ë¶É2Âæ¤òÊÌ¡¹¤Ëư¤«¤¹¤Î¤Ç¤Ï¤Ê¤¯¡¢¤³¤ì¤é¤Îµ¡¹½¤ò°ìÂæ¤Î¥í¥Ü¥Ã¥È¤Ë¹çÂΤµ¤»¤ë¤³¤È¤Ë¤Ê¤Ã¤¿¡£
*µ¡¹½ÀâÌÀ [#p73a8461]
µ¡¹½¤Ï¤ª¤ª¤Þ¤«¤Ë¤Ë´Ì¤ò½¸¤á¤ëµ¡¹½¡¢´Ì¤òÀѤൡ¹½¤Ëʬ¤«¤ì¤Æ¤¤¤ë¡£
**´Ì¤ò½¸¤á¤ëµ¡¹½ [#t661736c]
#ref(2017a/Member/tsukuzin/Mission3/¥¢¡¼¥à¤Îµ¡¹½.gif,120%,);
²èÁü¤Ï¥¢¡¼¥à¤Î¶îưÉôʬ¤Ç¤¢¤ë¡£¥¦¥©¡¼¥à¥®¥¢¤ò»È¤¦¤³¤È¤Ç¿¤¯¤Î¶õ¤´Ì¤ò½¸¤á¤Æ¤â¡¢»ß¤Þ¤é¤Ê¤¤¤¯¤é¤¤¤ÎưÎϤòÆÀ¤ë¤³¤È¤¬¤Ç¤¡¢Æ±»þ¤Ëº¸±¦ÂÐ¾Î¤ÊÆ°¤¤â²Äǽ¤Ë¤·¤¿¡£
¼ÂºÝ¤Ë¥¢¡¼¥à¤ò¼è¤êÉÕ¤±¤ÆÆ°¤«¤·¤¿²èÁü¤Ï²¼¤Î¤è¤¦¤Ë¤Ê¤ë
#ref(2017a/Member/tsukuzin/Mission3/´ÌÀ°Íý.gif,120%,);
**´Ì¤òÀѤൡ¹½ [#z596b55b]
´Ì¤òÀѤൡ¹½¤Ï´Ì¤ò¤Ä¤«¤à¥Ï¥ó¥É¤È´Ì¤Î¾å²¼¤ò¤µ¤»¤ëµ¡¹½¤Ëʬ¤«¤ì¤ë¡£
***¥Ï¥ó¥É¤Îµ¡¹½¤Ë¤Ä¤¤¤Æ [#yc1d374d]
#ref(2017a/Member/tsukuzin/Mission3/¥Ï¥ó¥É¤Îµ¡¹½1.JPG,20%,);
¥Ï¥ó¥É¤Îµ¡¹½¤â¥¢¡¼¥à¤Îµ¡¹½Æ±Íͤˡ¢º¸±¦ÂÐ¾Î¤ËÆ°¤¯¡£´Ì¤ò»ý¤Á¾å¤²¤Æ¤¤¤ëºÝ¤Ë¤â¥â¡¼¥¿¤Ï¶îư¤·Â³¤±¤ë¤Î¤Ç¡¢¥¯¥é¥Ã¥Á¥®¥¢¤òÍѤ¤¤ë¤³¤È¤Ç̵Íý¤Êưºî¤ò¤·¤Ê¤¤¤è¤¦¤Ë¤·¤¿¡£¤Þ¤¿¥¿¥¤¥ä¤ä¥Á¥å¡¼¥Ö¤òÉÕ¤±¤ë¤³¤È¤Ç¿¾¯¤Î¿¶Æ°¤¬¤¢¤Ã¤Æ¤â´Ì¤¬Åݤì¤Ê¤¤¤è¤¦¤Ë¤·¤¿¡£
***¾å²¼¤Îµ¡¹½ [#d08ba183]
#ref(2017a/Member/tsukuzin/Mission3/¾å²¼¤Îµ¡¹½1.JPG,100%,);
Àèü¤Ë¤Ï²óž¥»¥ó¥µ¡¼¤¬¼è¤êÉÕ¤±¤Æ¤¢¤ë¡£»þ´ÖÀ©¸æ¤Ë¤¹¤ë¤È¤½¤ÎÅÔÅÙÃͤòÄ´À°¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£¤½¤ÎÂçÊѤµ¤ÏMission1¤Ç·Ð¸³¤·¤¿¤¿¤á¡¢¥á¥ó¥Æ¥Ê¥ó¥¹¤Î¤·¤ä¤¹¤µ¤â¹Í¤¨¤¿¤¦¤¨¤Ç¥»¥ó¥µ¡¼¤ò¼è¤êÉÕ¤±¤¿¡£¤·¤«¤·¶õ¤´Ì°ì´Ì¤Ç¤â¡¢¥í¥Ü¥Ã¥È¤Ë¤Ï½Å¤«¤Ã¤¿¤è¤¦¤Ç1ÃÊ¡¢2ÃÊ¡¢3ÃʤÈÀѤि¤á¤Ë¤Ï²óž¥»¥ó¥µ¡¼¤ÎÃͤϾ¯¤·¤º¤ÄÊѤ¨¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤«¤Ã¤¿¡£
#ref(2017a/Member/tsukuzin/Mission3/¾å²¼¤Îµ¡¹½4.JPG,100%,);
#ref(2017a/Member/tsukuzin/Mission3/¾å²¼¤Îµ¡¹½2.gif,120%,);
µ¡¹½ÆâÉô¤Ï²èÁü¤Î¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤Æ¶¯¤¤Æ°ÎϤòÆÀ¤ë¤¿¤á¤Ë¥¦¥©¡¼¥à¥®¥¢¤òÍѤ¤¤Æ¤¤¤ë¡£
2ËçÌܤβèÁü¤Î¤è¤¦¤Ë¥®¥¢ÉÕ¤¤Î¥·¥ã¥Õ¥È¤òÉÕ¤±¤Æ¡¢º¸Â¦¤Î¥é¥Ã¥¯¥®¥¢¤ÈϢư¤µ¤»¡¢¾å²¼¤¹¤ë¤è¤¦¤Ë¤·¤Æ¤¤¤ë¡£¼ÂºÝ¤Ëư¤«¤¹¤È3ËçÌܤβèÁü¤Î¤è¤¦¤Ë¤Ê¤ë¡£
**¼ÂºÝ¤Îưºî [#u228c778]
¤³¤Î¥Ï¥ó¥É¤È¾å²¼¤Îµ¡¹½¤Ç3ÃʤޤǴ̤òÀѤळ¤È¤¬½ÐÍ褿¡£
[[&ref(2017a/Member/tsukuzin/Mission3/´Ì3ÃÊ.png,80%,¥¯¥ê¥Ã¥¯¤¹¤ë¤Èyoutube¤Îư²è¥Ú¡¼¥¸¤ËÈô¤Ó¤Þ¤¹¡£);>https://www.youtube.com/watch?v=tje0arvAjDE]]
*¥×¥í¥°¥é¥à¤Ë¤Ä¤¤¤Æ [#s59ea93f]
¥×¥í¥°¥é¥ß¥ó¥°¤Ë¤Ä¤¤¤Æ¤Ïºî¶È¤Î¸úΨ¤òÍ¥À褷¤¿¤Î¤ÇôÅö¼Ô¤Ï°ì¿Í¤Ç¤¢¤ë¡£
ËÜÂΤξܤ·¤¤ÀâÌÀ¤Ï[[Kenty:http://yakushi.shinshu-u.ac.jp/robotics/?2017a%2FMember%2FKenty%2FMission3]]¤µ¤ó¤ÎÊý¤Ç¤µ¤ì¤Æ¤¤¤ë¤Î¤Ç¤³¤Á¤é¤ò»²¹Í¤Ë¤·¤Æ¤Û¤·¤¤¡£
¥í¥Ü¥Ã¥È¤Îưºî¤Ï
¡¥í¥Ü¥Ã¥È¤Ï¥´¡¼¥ëÃÏÅÀ¤È°ìľÀþ¾å¤Ë¤Ê¤ë¤è¤¦¤ËÃÖ¤¯¡£
¢¥í¥Ü¥Ã¥È¤¬¥¢¡¼¥à¤ò³«¤¡¢±ßPQRS¤ÎÊ¥¤Ë¤¯¤ë¤Þ¤ÇÁ°¿Ê¤ò¤¹¤ë¡£¡Ê¤³¤Îưºî¤ÎȽÃǤˤϸ÷¥»¥ó¥µ¡¼¤òÍøÍѤ·¤Æ¤¤¤ë¡Ë¤³¤Îưºî¤ÇÃÏÅÀEG¤Ë¤¢¤ë¶õ¤´Ì¤Ï´¬¤¹þ¤Þ¤ì¤Æ²ó¼ý¤µ¤ì¤ë¡£
£¤³¤³¤Ç¥í¥Ü¥Ã¥È¤¬¥¢¡¼¥à¤òÊĤ¸¤ë¤È¾¤Î¶õ¤´Ì¤â²ó¼ý¤µ¤ì¤ë¡£¤Þ¤¿¤³¤Î»þ¡¢¼ÖÂΤòº¸±¦¤ËÍɤ餷¤Æ¶õ¤´Ì¤ò°ìÎó¤Ë¤½¤í¤¨¤ë¡£
¤¸åÂष¤¿¸å¡¢180ÅÙÀû²ó¤·¤Æ¡¢¥Ï¥ó¥É¦¤Î½àÈ÷¤ò¤¹¤ë¡£
¥¥Ï¥ó¥É¤ËÉÕ¤¤¤Æ¤¤¤ë¸÷¥»¥ó¥µ¡¼¤ÎÃͤòÆÉ¤ß¼è¤Ã¤Æ¡¢¶õ¤´Ì¤Ë¶á¤Å¤¡¢²ó¼ý¤·¤Æ3ÃʤËÀѤࡣ
¦¥í¥Ü¥Ã¥È¤Î³«»ÏÃÏÅÀ¤Ï¥´¡¼¥ë¤È°ìľÀþ¾å¤Ê¤Î¤Ç¡¢Á°¿Ê¤·¤Æ¶õ¤´Ì¤òÃÖ¤±¤Ð¡¢ÆÀÅÀ¤Ë¤Ê¤ë¡£
**´Ì²ó¼ýÍÑ¥×¥í¥°¥é¥à [#be5d1605]
***´Ø¿ô¤ÈÄêµÁ [#df71293f]
´ðËÜŪ¤Êưºî¤ä¥í¥Ü¥Ã¥È´Ö¤ÇÁ÷¼õ¿®¤¹¤ëºÝ¤ËÍøÍѤ¹¤ë¿ô»ú¤ò¤ï¤«¤ê¤ä¤¹¤¯¡¢»È¤¤¤ä¤¹¤¯¤¹¤ë¤¿¤á¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡£¤½¤ì¤¾¤ì¤ÎÄêµÁ¤ÎÍÑÅӤϥ³¥á¥ó¥Èʸ¤ÎÄ̤ê¤Ç¤¢¤ë¡£
#define LINE_BLACK 35 //¹õÀþÈ¿±þ»þ¤Î¸÷¥»¥ó¥µ¡Ê¥é¥¤¥óȽÄêÍѡˤÎÃÍ
#define CAN_SHORT 46 //´Ì¤ËÀܶᤷ¤¿¤È¤¤Î¡¡¸÷¥»¥ó¥µ¡Ê´ÌÍѡˤÎÃÍ
#define TURN_TIME 145 //£±£¸£°¡ëȿž¤Þ¤Ç¤Î»þ´Ö
#define APP_TIME 75 //´ÌÀܶá¤Þ¤Ç¤Î»þ´Ö
#define ARM_TIME 200 //¥¢¡¼¥à¤¬¿¿²£¤ò¸þ¤¯¤Þ¤Ç¤Î»þ´Ö
#define FOWORD OnFwd(OUT_AC); //ľ¿Ê
#define BACK OnRev(OUT_AC); //¸åÂà
#define STOP Off(OUT_AC); //Ää»ß
#define TURN_LEFT OnFwd(OUT_C); OnRev(OUT_A); //º¸Àû²ó
#define TURN_RIGHT OnFwd(OUT_A); OnRev(OUT_C); //±¦Àû²ó
#define ARM_OPEN OnFwd(OUT_B); //¥¢¡¼¥à³«
#define ARM_CLOSE OnRev(OUT_B); //¥¢¡¼¥àÊÄ
#define ARM_STOP Off(OUT_B); //¥¢¡¼¥àÄä»ß
#define ROGER 1 //¡ã¼õ¿®¡¦Á÷¿®¡ä¡¡¡Úλ²ò¡Û
#define GO_AHEAD 10 //¡ãÁ÷¿®¡ä¡¡¡Ú¹Ôư³«»Ï¡Û
#define MOTION_END 20 //¡ã¼õ¿®¡ä¡¡¡Úưºî´°Î»¡Û
***¥°¥í¡¼¥Ð¥ëÊÑ¿ô [#w6a1cd68]
°ì¤ÄÌܤϴ̤¬¥í¥Ü¥Ã¥È¤Ë½½Ê¬¤ËÀܶᤷ¡¢¥Ï¥ó¥É¦¤Ëưºî¤Î³«»Ï¤Î¿®¹æ¤òÁ÷¤ëºÝ¤ËÍøÍѤ¹¤ëÊÑ¿ô¤Ç¡¢Æó¤ÄÌܤϴ̤ò1ÃÊ¡¢2ÃÊ¡¢3ÃʤÈÀѤ߾夲¤ëºÝ¤ËÊÌ¤ÎÆ°ºî¤ò¤µ¤»¤ë¤¿¤á¤Ë»ÈÍѤ¹¤ë¡£
int trans_sign = 0; //¡ãÄÌ¿®¡ä¡¡Á÷¿®¿®¹æ¡¡³ÊǼÍÑ
int can_cnt = 0; //´Ì¡¡ÀѤ߾夲ËÜ¿ô¥«¥¦¥ó¥ÈÍÑ
***¥µ¥Ö¥ë¡¼¥Á¥ó [#y1c26230]
°Ê²¼¤ÎÆó¤Ä¤Ï¡ÖÃͤνé´ü²½¢ª¼õ¿®¤¹¤ë¤Þ¤ÇÂÔµ¡¡Ê°ì¤ÄÌܤΤߡˢª¿®¹æ¤òȯ¿®¡×¤Îưºî¤ò¥µ¥Ö¥ë¡¼¥Á¥ó²½¤µ¤ì¤Æ¤¤¤ë¡£
sub Reception()
{
ClearMessage(); //¡ãÄÌ¿®¡ä¡¡½é´ü²½¡ÊºÇ¸å¤Ë¼õ¿®¤·¤¿ÃÍ¡¡¢ª¡¡£°¡Ë
until(Message() == MOTION_END); //¡ãÄÌ¿®¡ä¡¡¡Ø£²£°¡Úưºî´°Î»¡Û¡Ù¤ò¼õ¿®¤¹¤ë¤Þ¤ÇÂÔµ¡
SendMessage(ROGER); //¡ãÄÌ¿®¡ä¡¡¡Ø£±¡Úλ²ò¡Û¡Ù¤òÁ÷¿®
}
sub Transmission()
{
ClearMessage(); //¡ãÄÌ¿®¡ä¡¡½é´ü²½¡ÊºÇ¸å¤Ë¼õ¿®¤·¤¿ÃÍ¡¡¢ª¡¡£°¡Ë
SendMessage(trans_sign); //¡ãÄÌ¿®¡ä¡¡¡Ø"trans_sign"¤ÎÃ͡٤òÁ÷¿®
until(Message() == ROGER); //¡ãÄÌ¿®¡ä¡¡¡Ø£±¡Úλ²ò¡Û¡Ù¤ò¼õ¿®¤¹¤ë¤Þ¤ÇÁ÷¿®¤·Â³¤±¤ë
}
**¥á¥¤¥ó¥¿¥¹¥¯ [#h306100f]
¥á¥¤¥ó¥¿¥¹¥¯¤Ë¤Ä¤¤¤Æ¤Ï¥³¥á¥ó¥Èʸ¤Ç¾Ü¤·¤¯ÀâÌÀ¤µ¤ì¤Æ¤¤¤ë¤¬¡¢kenty¤µ¤ó¤Î¥Ú¡¼¥¸¤Ç¤è¤ê¾Ü¤·¤¯ÀâÌÀ¤µ¤ì¤Æ¤¤¤ë¤Î¤Ç»²¹Í¤Ë¤·¤ÆÍߤ·¤¤¡£
task main()
{
/*---------- ¥â¡¼¥¿¥Ñ¥ï¡¼¡¦¥»¥ó¥µ¡¡ÀßÄê ----------*/
SetPower(OUT_AC , 3);
SetSensor(SENSOR_3 , SENSOR_LIGHT); //¹õÀþ¡¡Ç§¼±ÍÑ
SetSensor(SENSOR_1 , SENSOR_LIGHT); //´Ì¡¡¡¡Ç§¼±ÍÑ
/*---------- ¥¢¡¼¥à¤òÁ´³« ----------*/
ARM_CLOSE; //¥¢¡¼¥àÊÄ
Wait(ARM_TIME); //¥¢¡¼¥à¤¬¿¿²£¤ò¸þ¤¯¤Þ¤ÇÊĤ¸¤ë
ARM_STOP;
Wait(100);
/*---------- ´Ì¡¡²ó¼ý ----------*/
FOWORD; //¡¡¥¢¡¼¥à¦¤òÁ°Êý¸þ¤È¤·¤Æ
until(SENSOR_3 < LINE_BLACK); //¡¡£²¤ÄÌܤιõÀþ¤Þ¤ÇÁ°¿Ê
until(SENSOR_3 > LINE_BLACK); //
until(SENSOR_3 < LINE_BLACK); //
STOP; //Ää»ß
Wait(100);
ARM_CLOSE; //¥¢¡¼¥àÊÄ
Wait(ARM_TIME + 50); //¥¢¡¼¥à¤¬Ê¿¹Ô¤Ë¤Ê¤ë¤Þ¤ÇÊĤ¸¤ë
ARM_STOP;
Wait(100);
BACK; //¡¡¡¡´Ì¤ò·¤¨¤ë¤¿¤á¤Ë
Wait(50); //¡¡¡¡¾¯¤·²¼¤¬¤ë
STOP;
ARM_CLOSE; //¡¡¥¢¡¼¥àÊÄ
Wait(30); //¡¡´Ì¤ò°ìÎó¤Ë¤¹¤ë¤¿¤á¤Ë¤µ¤é¤Ë¾¯¤·ÊĤ¸¤ë
ARM_STOP;
ARM_OPEN; //¡¡¡¡¥¢¡¼¥à¤ò³«¤¡¢
Wait(ARM_TIME*2 + 80); //¡¡¡¡¥¹¥¿¡¼¥È»þ¤Ë¤¢¤Ã¤¿¾ì½ê¤Þ¤ÇÌ᤹
ARM_STOP;
/*---------- ´ÌÀѤ߾夲¤Î¤¿¤á¤Î½àÈ÷ ----------*/
BACK; //¡¡¸åÂष¤Æ¡¢
until(SENSOR_3 > LINE_BLACK); //¡¡£²¤ÄÌܤιõÀþ¤Þ¤ÇÁ°¿Ê
until(SENSOR_3 < LINE_BLACK); //
STOP;
SetPower(OUT_AC , 7);
TURN_LEFT; //¡¡±¦Êý¸þ¤Ø
Wait(TURN_TIME); //¡¡£±£¸£°¡ëÀû²ó
STOP;
SetPower(OUT_AC , 3);
BACK; //¡¡¥Ï¥ó¥É¦¤òÁ°Êý¸þ¤È¤·¤Æ
until(SENSOR_1 > CAN_SHORT); //¡¡´Ì¤Î¼êÁ°¤Þ¤ÇÁ°¿Ê
Wait(20); //¡¡¡Ê¤³¤³¤«¤é²¼¤Ï¡¢¥Ï¥ó¥ÉÊý¸þ¤òÁ°Êý¸þ¤È¤¹¤ë¡Ë
STOP;
/*---------- ´Ì¤òÀѤ߾夲³«»Ï (£³²ó·«¤êÊÖ¤·¡¢£´Ãʤˤ¹¤ë) ----------*/
while(pile_up_cnt < 3){
trans_sign = GO_AHEAD; //¡ãÄÌ¿®¡ä¡¡¡Ø£±£°¡Ú¹Ôư³«»Ï¡Û¡Ù
Transmission(); //¡¡↳Á÷¿®
/* - - - - - - - - - - - - - - - - -*/
/* ¥Ï¥ó¥É¦¤¬´Ì¤Î»ý¤Á¾å¤²¤ò¼Â¹Ô */
/* - - - - - - - - - - - - - - - - -*/
Reception(); //¡ãÄÌ¿®¡ä¡¡¡Ø£²£°¡Úưºî´°Î»¡Û¡Ù¤¬Á÷¤é¤ì¤Æ¤¯¤ë¤Þ¤ÇÂÔµ¡
BACK; //¡¡¡¡´Ì°ì¤Äʬ¤À¤±¡Ê¼¡¤Î´Ì¤Î¼êÁ°¤Þ¤Ç¡Ë
until(SENSOR_1 > CAN_SHORT); //¡¡¡¡Á°¿Ê¤¹¤ë
Wait(20);
STOP;
trans_sign = GO_AHEAD; //¡ãÄÌ¿®¡ä¡¡¡Ø£±£°¡Ú¹Ôư³«»Ï¡Û¡Ù
Transmission(); //¡¡
/* ¥Ï¥ó¥É¤¬´Ì¤òÃÖ¤¡¢½é´ü°ÌÃÖ¤ËÌá¤ë */
Reception(); //¡ãÄÌ¿®¡ä¡¡¡Ø£²£°¡Úưºî´°Î»¡Û¡Ù¤¬Á÷¤é¤ì¤Æ¤¯¤ë¤Þ¤ÇÂÔµ¡
can_cnt++; //´Ì¤ÎËÜ¿ô¡¡¡Ü£±
}
}
**´ÌÀѤ߾夲ÍÑ [#b0cd2fe7]
***´Ø¿ô¤ÈÄêµÁ [#v580aaf1]
ÀѤ߾夲ÍѤâ´Ì²ó¼ýÍÑÆ±ÍÍ¡¢´ðËÜŪ¤Êưºî¡¢¥á¥Ã¥»¡¼¥¸¤ò¤ï¤«¤ê¤ä¤¹¤¯¤¹¤ë¤¿¤áÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡£
#define HAND_TIME 50 //¥Ï¥ó¥É³«ÊÄ¡¡»þ´Ö
#define ELEVATE_UP OnFwd(OUT_C); //¡ã¥Ï¥ó¥É¾º¹ß¡ä¾å¾º
#define ELEVATE_DOWN OnRev(OUT_C); //¡ã¥Ï¥ó¥É¾º¹ß¡ä¹ß²¼
#define ELEVATE_STOP Off(OUT_C); //¡ã¥Ï¥ó¥É¾º¹ß¡äÄä»ß
#define HAND_OPEN OnRev(OUT_B); //¡ã¥Ï¥ó¥É³«Êġ䳫
#define HAND_CLOSE OnFwd(OUT_B); //¡ã¥Ï¥ó¥É³«ÊÄ¡äÊÄ
#define HAND_STOP Off(OUT_B); //¡ã¥Ï¥ó¥É³«ÊÄ¡äÄä»ß
#define ROGER 1 //¡ã¼õ¿®¡¦Á÷¿®¡ä¡¡¡Úλ²ò¡Û
#define GO_AHEAD 10 //¡ã¼õ¿®¡ä¡¡¡Ú¹Ôư³«»Ï¡Û
#define MOTION_END 20 //¡ãÁ÷¿®¡ä¡¡¡Úưºî´°Î»¡Û
***¥°¥í¡¼¥Ð¥ëÊÑ¿ô [#s1a66063]
¾å2¤Ä¤Ï´Ì²ó¼ýÍÑ¤ÈÆ±Íͤǡ¢²¼2¤Ä¤Ï´Ì¤ò1ÃÊ¡¢2ÃÊ¡¢3ÃʤÈÀѤó¤Ç¤¤¤¯ºÝ¤Ë°Û¤Ê¤Ã¤¿Æ°ºî¤ò¤µ¤»¤ë¤¿¤á¤ËÍøÍѤ¹¤ë¡£
int can_cnt = 0; //ÀѤ߾夲¤¿´Ì¤ÎËÜ¿ô
int trans_sign = 0; //Á÷¿®ÍÑ¡¡¿®¹æ¡¡³ÊǼÊÑ¿ô
int hand_flag = 0; //¡ã¥Ï¥ó¥É¡ä³«ÊÄ¡¡È½ÃÇÍÑ
int elevate_flag = 0; //¡ã¥Ï¥ó¥É¡ä¾º¹ß¡¡È½ÃÇÍÑ
**¥µ¥Ö¥ë¡¼¥Á¥ó [#c1a38ef4]
¥Ï¥ó¥É¤ò¾å²¼¤µ¤»¤ë¥×¥í¥°¥é¥à¤Ç¤¢¤ë¡£ÊÑ¿ô¤ÎÃͤÇifʸ¤¬Ê¬´ô¤µ¤ì¤Æ¤¤¤Æ¡¢°Û¤Ê¤Ã¤¿Æ°ºî¤ò¤¹¤ë¤³¤È¤¬½ÐÍè¤ë¡£
sub Hand_Elevate()
{
if(elevate_flag == 0){ //¥Ï¥ó¥É¾å¾º
ELEVATE_UP;
until(SENSOR_1 > 385);
ELEVATE_STOP;
elevate_flag = 1; //¥Ï¥ó¥É¾å¾º½ªÎ»¡¡¼¡¡§¹ß²¼¤ò¼Â¹Ô
}
else if(elevate_flag == 1){ //¥Ï¥ó¥É¹ß²¼¡Ê´Ì¤ò¤Î¤»¤ë¡Ë
ELEVATE_DOWN;
until(SENSOR_1 < 360);
ELEVATE_STOP;
elevate_flag = 2; //¥Ï¥ó¥É¹ß²¼½ªÎ»¡¡¼¡¡§²¼¹ß¤ò¼Â¹Ô
}
else if(elevate_flag == 2){ //¥Ï¥ó¥É½é´ü°ÌÃ֡ʰìÈÖ²¼¡Ë¤Ø°Üư
ELEVATE_DOWN;
until(SENSOR_1 < 3);
ELEVATE_STOP;
elevate_flag = 0; //¥Ï¥ó¥É²¼¹ß½ªÎ»¡¡¼¡¡§¾å¾º¤ò¼Â¹Ô
}
}
°ìÏ¢¤Îưºî¤Ï¡ÖÄϤࢪ²¡¤µ¤¨¤ë¢ªÎ¥¤¹¡×¤Î¤è¤¦¤Ë¹Ô¤ï¤ì¤Æ¤¤¤¯¡£¡Öhand_flag¡×¤ÎÊÑ¿ô¤ÎÃͤǹԤï¤ì¤ëưºî¤¬ÊѲ½¤¹¤ë¡£
sub Hand_OC()
{
if(hand_flag == 0){
SetPower(OUT_C , 3);
HAND_CLOSE;
Wait(100);
SetPower(OUT_C , 6);
hand_flag = 1; //¥Ï¥ó¥ÉÊÄ¡¡¼¡¡§¥Ï¥ó¥É¤ò³«¤¯
}
else{
HAND_OPEN;
Wait(HAND_TIME);
HAND_STOP;
hand_flag = 0; //¥Ï¥ó¥É³«¡¡¼¡¡§¥Ï¥ó¥É¤òÊĤ¸¤ë
}
}
°Ê²¼Æó¤Ä¤Ï¥¢¡¼¥à¦¤ÈƱ¤¸µ¡Ç½¤Ç¤¢¤ë¡£
sub Reception()
{
ClearMessage(); //¡ãÄÌ¿®¡ä¡¡½é´ü²½¡ÊºÇ¸å¤Ë¼õ¿®¤·¤¿ÃÍ¡¡¢ª¡¡£°¡Ë
until(Message() == GO_AHEAD); //¡ãÄÌ¿®¡ä¡¡¡Ø£±£°¡Ú¹Ôư³«»Ï¡Û¡Ù¤ò¼õ¿®¤¹¤ë¤Þ¤ÇÂÔµ¡
SendMessage(ROGER); //¡ãÄÌ¿®¡ä¡¡¡Ø£±¡Úλ²ò¡Û¡Ù¤òÁ÷¿®
}
sub Transmission()
{
ClearMessage(); //¡ãÄÌ¿®¡ä¡¡½é´ü²½¡¡¡ÊºÇ¸å¤Ë¼õ¿®¤·¤¿ÃÍ ¢ª £°¡Ë
SendMessage(trans_sign); //¡ãÄÌ¿®¡ä¡¡¡Ø"trans_sign"¤ÎÃ͡٤òÁ÷¿®
until(Message() == ROGER); //¡ãÄÌ¿®¡ä¡¡¡Ø£±¡Úλ²ò¡Û¡Ù¤ò¼õ¿®¤¹¤ë¤Þ¤ÇÁ÷¿®¤·Â³¤±¤ë
}
**¥á¥¤¥ó¥¿¥¹¥¯ [#q6038d22]
¥á¥¤¥ó¥¿¥¹¥¯¤ÎÀâÌÀ¤Ï¥³¥á¥ó¥Èʸ¤ÇÀâÌÀ¤µ¤ì¤Æ¤¤¤ë¤¬¡¢kenty¤µ¤ó¤Î¥Ú¡¼¥¸¤Ç¤è¤ê¾Ü¤·¤¯ÀâÌÀ¤µ¤ì¤Æ¤¤¤ë¤Î¤Ç»²¹Í¤Ë¤·¤Æ¤Û¤·¤¤¡£
task main()
{
/*---------- ¥â¡¼¥¿¥Ñ¥ï¡¼¡¦¥»¥ó¥µ¡¡ÀßÄê ----------*/
SetSensor(SENSOR_1 , SENSOR_ROTATION); //²óž¥»¥ó¥µÀßÄê
ClearSensor(SENSOR_1); //²óž¥»¥ó¥µ½é´ü²½
/*---------- ´Ì¡¡ÀѤ߾夲¡Ê£³²ó·«¤êÊÖ¤·¡¢£´Ãʤˤ¹¤ë¡Ë----------*/
while(can_cnt < 3){
Reception(); //¡ãÄÌ¿®¡ä¡¡¡Ø£±£°¡Ú¹Ôư³«»Ï¡Û¡Ù¤ò¼õ¿®¤¹¤ë¤Þ¤ÇÂÔµ¡
Hand_OC(); //´Ì¤ò¤Ä¤«¤à
Hand_Elevate(); //¥Ï¥ó¥É¾å¾º
trans_sign = MOTION_END; //¡ãÄÌ¿®¡ä¡¡¡Ø£²£°¡Úưºî´°Î»¡Û¡Ù
Transmission(); //Á÷¿®
/* - - - - - - - - - - - - - - - - - - -*/
/* ¶îư¦¤¬´Ì¤Î¼êÁ°¤Þ¤Ç°Üư */
/* - - - - - - - - - - - - - - - - - - -*/
Reception(); //¡ãÄÌ¿®¡ä¡¡¡Ø£±£°¡Ú¹Ôư³«»Ï¡Û¡Ù¤ò¼õ¿®¤¹¤ë¤Þ¤ÇÂÔµ¡
Hand_Elevate(); //¥Ï¥ó¥É²¼¹ß
Hand_OC(); //´Ì¤òÊü¤¹
Hand_Elevate(); //°ìÈÖ²¼¤Þ¤Ç¥Ï¥ó¥É¤ò²¼¤í¤¹
trans_sign = MOTION_END; //¡ã¿®¹æ¡ä¡Ø£²£°¡Úưºî´°Î»¡Û¡Ù
Transmission(); //¡¡↳Á÷¿®
can_cnt++; //´Ì¤ÎËÜ¿ô¡¡¡Ü£±
}
Reception();
}
*È¿¾Ê [#y555790c]
º£²ó¤ÎMission3¤Ï¸Ä¡¹¤Îµ¡¹½¤Îưºî¤Ï»×¤¤Ä̤ê¤Ëư¤¤¤¿¤¬¡¢¤¤¤¶¤½¤ì¤é¤ò°ì¤Ä¤Î¥í¥Ü¥Ã¥È¤Ë¤¹¤ë¤È¡¢¤½¤ì¤é¤ò¤¯¤Ã¤Ä¤±¤ë¥Ö¥í¥Ã¥¯¤¬ÉÔ¤·¤¿¤ê¡¢¥³¡¼¥É¤ÎŤµ¤¬Â¤ê¤Ê¤«¤Ã¤¿¤ê¤·¤¿¡£Îý½¬¤Ç½Å¤¤µ¡¹½¤ò²¿Å٤ⲿÅÙ¤â¾å²¼¤¹¤ë¤Î¤Ç¡¢Å۵¤Ë¤è¤Ã¤ÆÆ°ºî¤¬ÊѲ½¤·¤Æ¤·¤Þ¤¦¤³¤È¤â¤ä¤Ï¤ê¤¢¤Ã¤¿¡£À¤¤ÎÃæ¤Î»ñ¸»¤Ï̵¸Â¤Ë¤¢¤ë¤ï¤±¤Ç¤Ê¤¯¡¢¤½¤ì¤é¤òºÇŬ¤ÊÊýË¡¤ÇÍøÍѤ·¤Æ¤¤¤¯ÂçÀÚ¤µ¤òº£²ó¤Ï³Ø¤Ö¤³¤È¤¬½ÐÍ褿¡£
½ªÎ»¹Ô:
[[2017a/Member]]
#contents
*Mission3 [#t26ce7e0]
ºÇ¸å¤Î²ÝÂê¤ÏMission2¤Ç»ÈÍѤ·¤¿¥³¡¼¥È¤Î³Æ½ê¤Ë²èÁü¤Î¤è¤¦¤Ë¶õ¤´Ì¡¢¤Þ¤¿¤ÏÃæ¿È¤ÎÆþ¤Ã¤¿´Ì¤òÇÛÃÖ¤·¡¢¥´¡¼¥ë¤Þ¤Ç±¿¤Ö¶¥µ»¤Ç¤¢¤ë¡£¾Ü¤·¤¯¤Ï¤³¤Á¤é¤Ë[[Mission3:http://yakushi.shinshu-u.ac.jp/robotics/?2017a%2FMission3]]½ñ¤¤¤Æ¤¢¤ë¤Î¤Ç»²¾È´ê¤¤¤¿¤¤¡£
&ref(2017a/Mission3/2017a-mission3.png,100%,);
*ưºî¤Î¹½ÁۤˤĤ¤¤Æ [#c580d2fe]
¤³¤Î¶¥µ»¤Ç¤É¤Î¤è¤¦¤Ë¥Ý¥¤¥ó¥È¤ò²Ô¤°¤«¥Á¡¼¥àÆâ¤ÇÏä·¹ç¤Ã¤¿·ë²Ì
¡°ìÂæ¤Ï´Ì¤Î¼ý½¸¤«¤éÀ°Îó
#ref(2017a/Member/tsukuzin/Mission3/¹½ÁÛ£±.gif,40%,);
¢¤â¤¦°ìÂæ¤¬¤½¤í¤¨¤¿´Ì¤òÀѤà
#ref(2017a/Member/tsukuzin/Mission3/¹½ÁÛ2.gif,40%,);
¤È¤¤¤¦Æ°ºî¤ò¤µ¤»¤ë¤³¤È¤Ç¹çÃפ·¤¿¡£¤³¤Î¹½ÁۤǤ¢¤ì¤ÐMission2¤Ç¶ìÀ路¤¿¥é¥¤¥ó¥È¥ì¡¼¥¹¤ò¹Ô¤¦É¬Íפ¬¤Ê¤¯¡¢¥·¥ó¥×¥ë¤Êưºî¤Ç¥Ý¥¤¥ó¥È¤ò²Ô¤°¤³¤È¤¬½ÐÍè¤ë¤È¹Í¤¨¤¿¡£
¤·¤«¤·¤Ê¤¬¤é¡¢&color(white,red){RISƱ»Î¤ÎÄÌ¿®¤ÎÀÖ³°Àþ¤¬»×¤Ã¤¿¤è¤ê¤â¼å¤¯};¡¢·ë¶É2Âæ¤òÊÌ¡¹¤Ëư¤«¤¹¤Î¤Ç¤Ï¤Ê¤¯¡¢¤³¤ì¤é¤Îµ¡¹½¤ò°ìÂæ¤Î¥í¥Ü¥Ã¥È¤Ë¹çÂΤµ¤»¤ë¤³¤È¤Ë¤Ê¤Ã¤¿¡£
*µ¡¹½ÀâÌÀ [#p73a8461]
µ¡¹½¤Ï¤ª¤ª¤Þ¤«¤Ë¤Ë´Ì¤ò½¸¤á¤ëµ¡¹½¡¢´Ì¤òÀѤൡ¹½¤Ëʬ¤«¤ì¤Æ¤¤¤ë¡£
**´Ì¤ò½¸¤á¤ëµ¡¹½ [#t661736c]
#ref(2017a/Member/tsukuzin/Mission3/¥¢¡¼¥à¤Îµ¡¹½.gif,120%,);
²èÁü¤Ï¥¢¡¼¥à¤Î¶îưÉôʬ¤Ç¤¢¤ë¡£¥¦¥©¡¼¥à¥®¥¢¤ò»È¤¦¤³¤È¤Ç¿¤¯¤Î¶õ¤´Ì¤ò½¸¤á¤Æ¤â¡¢»ß¤Þ¤é¤Ê¤¤¤¯¤é¤¤¤ÎưÎϤòÆÀ¤ë¤³¤È¤¬¤Ç¤¡¢Æ±»þ¤Ëº¸±¦ÂÐ¾Î¤ÊÆ°¤¤â²Äǽ¤Ë¤·¤¿¡£
¼ÂºÝ¤Ë¥¢¡¼¥à¤ò¼è¤êÉÕ¤±¤ÆÆ°¤«¤·¤¿²èÁü¤Ï²¼¤Î¤è¤¦¤Ë¤Ê¤ë
#ref(2017a/Member/tsukuzin/Mission3/´ÌÀ°Íý.gif,120%,);
**´Ì¤òÀѤൡ¹½ [#z596b55b]
´Ì¤òÀѤൡ¹½¤Ï´Ì¤ò¤Ä¤«¤à¥Ï¥ó¥É¤È´Ì¤Î¾å²¼¤ò¤µ¤»¤ëµ¡¹½¤Ëʬ¤«¤ì¤ë¡£
***¥Ï¥ó¥É¤Îµ¡¹½¤Ë¤Ä¤¤¤Æ [#yc1d374d]
#ref(2017a/Member/tsukuzin/Mission3/¥Ï¥ó¥É¤Îµ¡¹½1.JPG,20%,);
¥Ï¥ó¥É¤Îµ¡¹½¤â¥¢¡¼¥à¤Îµ¡¹½Æ±Íͤˡ¢º¸±¦ÂÐ¾Î¤ËÆ°¤¯¡£´Ì¤ò»ý¤Á¾å¤²¤Æ¤¤¤ëºÝ¤Ë¤â¥â¡¼¥¿¤Ï¶îư¤·Â³¤±¤ë¤Î¤Ç¡¢¥¯¥é¥Ã¥Á¥®¥¢¤òÍѤ¤¤ë¤³¤È¤Ç̵Íý¤Êưºî¤ò¤·¤Ê¤¤¤è¤¦¤Ë¤·¤¿¡£¤Þ¤¿¥¿¥¤¥ä¤ä¥Á¥å¡¼¥Ö¤òÉÕ¤±¤ë¤³¤È¤Ç¿¾¯¤Î¿¶Æ°¤¬¤¢¤Ã¤Æ¤â´Ì¤¬Åݤì¤Ê¤¤¤è¤¦¤Ë¤·¤¿¡£
***¾å²¼¤Îµ¡¹½ [#d08ba183]
#ref(2017a/Member/tsukuzin/Mission3/¾å²¼¤Îµ¡¹½1.JPG,100%,);
Àèü¤Ë¤Ï²óž¥»¥ó¥µ¡¼¤¬¼è¤êÉÕ¤±¤Æ¤¢¤ë¡£»þ´ÖÀ©¸æ¤Ë¤¹¤ë¤È¤½¤ÎÅÔÅÙÃͤòÄ´À°¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£¤½¤ÎÂçÊѤµ¤ÏMission1¤Ç·Ð¸³¤·¤¿¤¿¤á¡¢¥á¥ó¥Æ¥Ê¥ó¥¹¤Î¤·¤ä¤¹¤µ¤â¹Í¤¨¤¿¤¦¤¨¤Ç¥»¥ó¥µ¡¼¤ò¼è¤êÉÕ¤±¤¿¡£¤·¤«¤·¶õ¤´Ì°ì´Ì¤Ç¤â¡¢¥í¥Ü¥Ã¥È¤Ë¤Ï½Å¤«¤Ã¤¿¤è¤¦¤Ç1ÃÊ¡¢2ÃÊ¡¢3ÃʤÈÀѤि¤á¤Ë¤Ï²óž¥»¥ó¥µ¡¼¤ÎÃͤϾ¯¤·¤º¤ÄÊѤ¨¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤«¤Ã¤¿¡£
#ref(2017a/Member/tsukuzin/Mission3/¾å²¼¤Îµ¡¹½4.JPG,100%,);
#ref(2017a/Member/tsukuzin/Mission3/¾å²¼¤Îµ¡¹½2.gif,120%,);
µ¡¹½ÆâÉô¤Ï²èÁü¤Î¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤Æ¶¯¤¤Æ°ÎϤòÆÀ¤ë¤¿¤á¤Ë¥¦¥©¡¼¥à¥®¥¢¤òÍѤ¤¤Æ¤¤¤ë¡£
2ËçÌܤβèÁü¤Î¤è¤¦¤Ë¥®¥¢ÉÕ¤¤Î¥·¥ã¥Õ¥È¤òÉÕ¤±¤Æ¡¢º¸Â¦¤Î¥é¥Ã¥¯¥®¥¢¤ÈϢư¤µ¤»¡¢¾å²¼¤¹¤ë¤è¤¦¤Ë¤·¤Æ¤¤¤ë¡£¼ÂºÝ¤Ëư¤«¤¹¤È3ËçÌܤβèÁü¤Î¤è¤¦¤Ë¤Ê¤ë¡£
**¼ÂºÝ¤Îưºî [#u228c778]
¤³¤Î¥Ï¥ó¥É¤È¾å²¼¤Îµ¡¹½¤Ç3ÃʤޤǴ̤òÀѤळ¤È¤¬½ÐÍ褿¡£
[[&ref(2017a/Member/tsukuzin/Mission3/´Ì3ÃÊ.png,80%,¥¯¥ê¥Ã¥¯¤¹¤ë¤Èyoutube¤Îư²è¥Ú¡¼¥¸¤ËÈô¤Ó¤Þ¤¹¡£);>https://www.youtube.com/watch?v=tje0arvAjDE]]
*¥×¥í¥°¥é¥à¤Ë¤Ä¤¤¤Æ [#s59ea93f]
¥×¥í¥°¥é¥ß¥ó¥°¤Ë¤Ä¤¤¤Æ¤Ïºî¶È¤Î¸úΨ¤òÍ¥À褷¤¿¤Î¤ÇôÅö¼Ô¤Ï°ì¿Í¤Ç¤¢¤ë¡£
ËÜÂΤξܤ·¤¤ÀâÌÀ¤Ï[[Kenty:http://yakushi.shinshu-u.ac.jp/robotics/?2017a%2FMember%2FKenty%2FMission3]]¤µ¤ó¤ÎÊý¤Ç¤µ¤ì¤Æ¤¤¤ë¤Î¤Ç¤³¤Á¤é¤ò»²¹Í¤Ë¤·¤Æ¤Û¤·¤¤¡£
¥í¥Ü¥Ã¥È¤Îưºî¤Ï
¡¥í¥Ü¥Ã¥È¤Ï¥´¡¼¥ëÃÏÅÀ¤È°ìľÀþ¾å¤Ë¤Ê¤ë¤è¤¦¤ËÃÖ¤¯¡£
¢¥í¥Ü¥Ã¥È¤¬¥¢¡¼¥à¤ò³«¤¡¢±ßPQRS¤ÎÊ¥¤Ë¤¯¤ë¤Þ¤ÇÁ°¿Ê¤ò¤¹¤ë¡£¡Ê¤³¤Îưºî¤ÎȽÃǤˤϸ÷¥»¥ó¥µ¡¼¤òÍøÍѤ·¤Æ¤¤¤ë¡Ë¤³¤Îưºî¤ÇÃÏÅÀEG¤Ë¤¢¤ë¶õ¤´Ì¤Ï´¬¤¹þ¤Þ¤ì¤Æ²ó¼ý¤µ¤ì¤ë¡£
£¤³¤³¤Ç¥í¥Ü¥Ã¥È¤¬¥¢¡¼¥à¤òÊĤ¸¤ë¤È¾¤Î¶õ¤´Ì¤â²ó¼ý¤µ¤ì¤ë¡£¤Þ¤¿¤³¤Î»þ¡¢¼ÖÂΤòº¸±¦¤ËÍɤ餷¤Æ¶õ¤´Ì¤ò°ìÎó¤Ë¤½¤í¤¨¤ë¡£
¤¸åÂष¤¿¸å¡¢180ÅÙÀû²ó¤·¤Æ¡¢¥Ï¥ó¥É¦¤Î½àÈ÷¤ò¤¹¤ë¡£
¥¥Ï¥ó¥É¤ËÉÕ¤¤¤Æ¤¤¤ë¸÷¥»¥ó¥µ¡¼¤ÎÃͤòÆÉ¤ß¼è¤Ã¤Æ¡¢¶õ¤´Ì¤Ë¶á¤Å¤¡¢²ó¼ý¤·¤Æ3ÃʤËÀѤࡣ
¦¥í¥Ü¥Ã¥È¤Î³«»ÏÃÏÅÀ¤Ï¥´¡¼¥ë¤È°ìľÀþ¾å¤Ê¤Î¤Ç¡¢Á°¿Ê¤·¤Æ¶õ¤´Ì¤òÃÖ¤±¤Ð¡¢ÆÀÅÀ¤Ë¤Ê¤ë¡£
**´Ì²ó¼ýÍÑ¥×¥í¥°¥é¥à [#be5d1605]
***´Ø¿ô¤ÈÄêµÁ [#df71293f]
´ðËÜŪ¤Êưºî¤ä¥í¥Ü¥Ã¥È´Ö¤ÇÁ÷¼õ¿®¤¹¤ëºÝ¤ËÍøÍѤ¹¤ë¿ô»ú¤ò¤ï¤«¤ê¤ä¤¹¤¯¡¢»È¤¤¤ä¤¹¤¯¤¹¤ë¤¿¤á¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡£¤½¤ì¤¾¤ì¤ÎÄêµÁ¤ÎÍÑÅӤϥ³¥á¥ó¥Èʸ¤ÎÄ̤ê¤Ç¤¢¤ë¡£
#define LINE_BLACK 35 //¹õÀþÈ¿±þ»þ¤Î¸÷¥»¥ó¥µ¡Ê¥é¥¤¥óȽÄêÍѡˤÎÃÍ
#define CAN_SHORT 46 //´Ì¤ËÀܶᤷ¤¿¤È¤¤Î¡¡¸÷¥»¥ó¥µ¡Ê´ÌÍѡˤÎÃÍ
#define TURN_TIME 145 //£±£¸£°¡ëȿž¤Þ¤Ç¤Î»þ´Ö
#define APP_TIME 75 //´ÌÀܶá¤Þ¤Ç¤Î»þ´Ö
#define ARM_TIME 200 //¥¢¡¼¥à¤¬¿¿²£¤ò¸þ¤¯¤Þ¤Ç¤Î»þ´Ö
#define FOWORD OnFwd(OUT_AC); //ľ¿Ê
#define BACK OnRev(OUT_AC); //¸åÂà
#define STOP Off(OUT_AC); //Ää»ß
#define TURN_LEFT OnFwd(OUT_C); OnRev(OUT_A); //º¸Àû²ó
#define TURN_RIGHT OnFwd(OUT_A); OnRev(OUT_C); //±¦Àû²ó
#define ARM_OPEN OnFwd(OUT_B); //¥¢¡¼¥à³«
#define ARM_CLOSE OnRev(OUT_B); //¥¢¡¼¥àÊÄ
#define ARM_STOP Off(OUT_B); //¥¢¡¼¥àÄä»ß
#define ROGER 1 //¡ã¼õ¿®¡¦Á÷¿®¡ä¡¡¡Úλ²ò¡Û
#define GO_AHEAD 10 //¡ãÁ÷¿®¡ä¡¡¡Ú¹Ôư³«»Ï¡Û
#define MOTION_END 20 //¡ã¼õ¿®¡ä¡¡¡Úưºî´°Î»¡Û
***¥°¥í¡¼¥Ð¥ëÊÑ¿ô [#w6a1cd68]
°ì¤ÄÌܤϴ̤¬¥í¥Ü¥Ã¥È¤Ë½½Ê¬¤ËÀܶᤷ¡¢¥Ï¥ó¥É¦¤Ëưºî¤Î³«»Ï¤Î¿®¹æ¤òÁ÷¤ëºÝ¤ËÍøÍѤ¹¤ëÊÑ¿ô¤Ç¡¢Æó¤ÄÌܤϴ̤ò1ÃÊ¡¢2ÃÊ¡¢3ÃʤÈÀѤ߾夲¤ëºÝ¤ËÊÌ¤ÎÆ°ºî¤ò¤µ¤»¤ë¤¿¤á¤Ë»ÈÍѤ¹¤ë¡£
int trans_sign = 0; //¡ãÄÌ¿®¡ä¡¡Á÷¿®¿®¹æ¡¡³ÊǼÍÑ
int can_cnt = 0; //´Ì¡¡ÀѤ߾夲ËÜ¿ô¥«¥¦¥ó¥ÈÍÑ
***¥µ¥Ö¥ë¡¼¥Á¥ó [#y1c26230]
°Ê²¼¤ÎÆó¤Ä¤Ï¡ÖÃͤνé´ü²½¢ª¼õ¿®¤¹¤ë¤Þ¤ÇÂÔµ¡¡Ê°ì¤ÄÌܤΤߡˢª¿®¹æ¤òȯ¿®¡×¤Îưºî¤ò¥µ¥Ö¥ë¡¼¥Á¥ó²½¤µ¤ì¤Æ¤¤¤ë¡£
sub Reception()
{
ClearMessage(); //¡ãÄÌ¿®¡ä¡¡½é´ü²½¡ÊºÇ¸å¤Ë¼õ¿®¤·¤¿ÃÍ¡¡¢ª¡¡£°¡Ë
until(Message() == MOTION_END); //¡ãÄÌ¿®¡ä¡¡¡Ø£²£°¡Úưºî´°Î»¡Û¡Ù¤ò¼õ¿®¤¹¤ë¤Þ¤ÇÂÔµ¡
SendMessage(ROGER); //¡ãÄÌ¿®¡ä¡¡¡Ø£±¡Úλ²ò¡Û¡Ù¤òÁ÷¿®
}
sub Transmission()
{
ClearMessage(); //¡ãÄÌ¿®¡ä¡¡½é´ü²½¡ÊºÇ¸å¤Ë¼õ¿®¤·¤¿ÃÍ¡¡¢ª¡¡£°¡Ë
SendMessage(trans_sign); //¡ãÄÌ¿®¡ä¡¡¡Ø"trans_sign"¤ÎÃ͡٤òÁ÷¿®
until(Message() == ROGER); //¡ãÄÌ¿®¡ä¡¡¡Ø£±¡Úλ²ò¡Û¡Ù¤ò¼õ¿®¤¹¤ë¤Þ¤ÇÁ÷¿®¤·Â³¤±¤ë
}
**¥á¥¤¥ó¥¿¥¹¥¯ [#h306100f]
¥á¥¤¥ó¥¿¥¹¥¯¤Ë¤Ä¤¤¤Æ¤Ï¥³¥á¥ó¥Èʸ¤Ç¾Ü¤·¤¯ÀâÌÀ¤µ¤ì¤Æ¤¤¤ë¤¬¡¢kenty¤µ¤ó¤Î¥Ú¡¼¥¸¤Ç¤è¤ê¾Ü¤·¤¯ÀâÌÀ¤µ¤ì¤Æ¤¤¤ë¤Î¤Ç»²¹Í¤Ë¤·¤ÆÍߤ·¤¤¡£
task main()
{
/*---------- ¥â¡¼¥¿¥Ñ¥ï¡¼¡¦¥»¥ó¥µ¡¡ÀßÄê ----------*/
SetPower(OUT_AC , 3);
SetSensor(SENSOR_3 , SENSOR_LIGHT); //¹õÀþ¡¡Ç§¼±ÍÑ
SetSensor(SENSOR_1 , SENSOR_LIGHT); //´Ì¡¡¡¡Ç§¼±ÍÑ
/*---------- ¥¢¡¼¥à¤òÁ´³« ----------*/
ARM_CLOSE; //¥¢¡¼¥àÊÄ
Wait(ARM_TIME); //¥¢¡¼¥à¤¬¿¿²£¤ò¸þ¤¯¤Þ¤ÇÊĤ¸¤ë
ARM_STOP;
Wait(100);
/*---------- ´Ì¡¡²ó¼ý ----------*/
FOWORD; //¡¡¥¢¡¼¥à¦¤òÁ°Êý¸þ¤È¤·¤Æ
until(SENSOR_3 < LINE_BLACK); //¡¡£²¤ÄÌܤιõÀþ¤Þ¤ÇÁ°¿Ê
until(SENSOR_3 > LINE_BLACK); //
until(SENSOR_3 < LINE_BLACK); //
STOP; //Ää»ß
Wait(100);
ARM_CLOSE; //¥¢¡¼¥àÊÄ
Wait(ARM_TIME + 50); //¥¢¡¼¥à¤¬Ê¿¹Ô¤Ë¤Ê¤ë¤Þ¤ÇÊĤ¸¤ë
ARM_STOP;
Wait(100);
BACK; //¡¡¡¡´Ì¤ò·¤¨¤ë¤¿¤á¤Ë
Wait(50); //¡¡¡¡¾¯¤·²¼¤¬¤ë
STOP;
ARM_CLOSE; //¡¡¥¢¡¼¥àÊÄ
Wait(30); //¡¡´Ì¤ò°ìÎó¤Ë¤¹¤ë¤¿¤á¤Ë¤µ¤é¤Ë¾¯¤·ÊĤ¸¤ë
ARM_STOP;
ARM_OPEN; //¡¡¡¡¥¢¡¼¥à¤ò³«¤¡¢
Wait(ARM_TIME*2 + 80); //¡¡¡¡¥¹¥¿¡¼¥È»þ¤Ë¤¢¤Ã¤¿¾ì½ê¤Þ¤ÇÌ᤹
ARM_STOP;
/*---------- ´ÌÀѤ߾夲¤Î¤¿¤á¤Î½àÈ÷ ----------*/
BACK; //¡¡¸åÂष¤Æ¡¢
until(SENSOR_3 > LINE_BLACK); //¡¡£²¤ÄÌܤιõÀþ¤Þ¤ÇÁ°¿Ê
until(SENSOR_3 < LINE_BLACK); //
STOP;
SetPower(OUT_AC , 7);
TURN_LEFT; //¡¡±¦Êý¸þ¤Ø
Wait(TURN_TIME); //¡¡£±£¸£°¡ëÀû²ó
STOP;
SetPower(OUT_AC , 3);
BACK; //¡¡¥Ï¥ó¥É¦¤òÁ°Êý¸þ¤È¤·¤Æ
until(SENSOR_1 > CAN_SHORT); //¡¡´Ì¤Î¼êÁ°¤Þ¤ÇÁ°¿Ê
Wait(20); //¡¡¡Ê¤³¤³¤«¤é²¼¤Ï¡¢¥Ï¥ó¥ÉÊý¸þ¤òÁ°Êý¸þ¤È¤¹¤ë¡Ë
STOP;
/*---------- ´Ì¤òÀѤ߾夲³«»Ï (£³²ó·«¤êÊÖ¤·¡¢£´Ãʤˤ¹¤ë) ----------*/
while(pile_up_cnt < 3){
trans_sign = GO_AHEAD; //¡ãÄÌ¿®¡ä¡¡¡Ø£±£°¡Ú¹Ôư³«»Ï¡Û¡Ù
Transmission(); //¡¡↳Á÷¿®
/* - - - - - - - - - - - - - - - - -*/
/* ¥Ï¥ó¥É¦¤¬´Ì¤Î»ý¤Á¾å¤²¤ò¼Â¹Ô */
/* - - - - - - - - - - - - - - - - -*/
Reception(); //¡ãÄÌ¿®¡ä¡¡¡Ø£²£°¡Úưºî´°Î»¡Û¡Ù¤¬Á÷¤é¤ì¤Æ¤¯¤ë¤Þ¤ÇÂÔµ¡
BACK; //¡¡¡¡´Ì°ì¤Äʬ¤À¤±¡Ê¼¡¤Î´Ì¤Î¼êÁ°¤Þ¤Ç¡Ë
until(SENSOR_1 > CAN_SHORT); //¡¡¡¡Á°¿Ê¤¹¤ë
Wait(20);
STOP;
trans_sign = GO_AHEAD; //¡ãÄÌ¿®¡ä¡¡¡Ø£±£°¡Ú¹Ôư³«»Ï¡Û¡Ù
Transmission(); //¡¡
/* ¥Ï¥ó¥É¤¬´Ì¤òÃÖ¤¡¢½é´ü°ÌÃÖ¤ËÌá¤ë */
Reception(); //¡ãÄÌ¿®¡ä¡¡¡Ø£²£°¡Úưºî´°Î»¡Û¡Ù¤¬Á÷¤é¤ì¤Æ¤¯¤ë¤Þ¤ÇÂÔµ¡
can_cnt++; //´Ì¤ÎËÜ¿ô¡¡¡Ü£±
}
}
**´ÌÀѤ߾夲ÍÑ [#b0cd2fe7]
***´Ø¿ô¤ÈÄêµÁ [#v580aaf1]
ÀѤ߾夲ÍѤâ´Ì²ó¼ýÍÑÆ±ÍÍ¡¢´ðËÜŪ¤Êưºî¡¢¥á¥Ã¥»¡¼¥¸¤ò¤ï¤«¤ê¤ä¤¹¤¯¤¹¤ë¤¿¤áÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡£
#define HAND_TIME 50 //¥Ï¥ó¥É³«ÊÄ¡¡»þ´Ö
#define ELEVATE_UP OnFwd(OUT_C); //¡ã¥Ï¥ó¥É¾º¹ß¡ä¾å¾º
#define ELEVATE_DOWN OnRev(OUT_C); //¡ã¥Ï¥ó¥É¾º¹ß¡ä¹ß²¼
#define ELEVATE_STOP Off(OUT_C); //¡ã¥Ï¥ó¥É¾º¹ß¡äÄä»ß
#define HAND_OPEN OnRev(OUT_B); //¡ã¥Ï¥ó¥É³«Êġ䳫
#define HAND_CLOSE OnFwd(OUT_B); //¡ã¥Ï¥ó¥É³«ÊÄ¡äÊÄ
#define HAND_STOP Off(OUT_B); //¡ã¥Ï¥ó¥É³«ÊÄ¡äÄä»ß
#define ROGER 1 //¡ã¼õ¿®¡¦Á÷¿®¡ä¡¡¡Úλ²ò¡Û
#define GO_AHEAD 10 //¡ã¼õ¿®¡ä¡¡¡Ú¹Ôư³«»Ï¡Û
#define MOTION_END 20 //¡ãÁ÷¿®¡ä¡¡¡Úưºî´°Î»¡Û
***¥°¥í¡¼¥Ð¥ëÊÑ¿ô [#s1a66063]
¾å2¤Ä¤Ï´Ì²ó¼ýÍÑ¤ÈÆ±Íͤǡ¢²¼2¤Ä¤Ï´Ì¤ò1ÃÊ¡¢2ÃÊ¡¢3ÃʤÈÀѤó¤Ç¤¤¤¯ºÝ¤Ë°Û¤Ê¤Ã¤¿Æ°ºî¤ò¤µ¤»¤ë¤¿¤á¤ËÍøÍѤ¹¤ë¡£
int can_cnt = 0; //ÀѤ߾夲¤¿´Ì¤ÎËÜ¿ô
int trans_sign = 0; //Á÷¿®ÍÑ¡¡¿®¹æ¡¡³ÊǼÊÑ¿ô
int hand_flag = 0; //¡ã¥Ï¥ó¥É¡ä³«ÊÄ¡¡È½ÃÇÍÑ
int elevate_flag = 0; //¡ã¥Ï¥ó¥É¡ä¾º¹ß¡¡È½ÃÇÍÑ
**¥µ¥Ö¥ë¡¼¥Á¥ó [#c1a38ef4]
¥Ï¥ó¥É¤ò¾å²¼¤µ¤»¤ë¥×¥í¥°¥é¥à¤Ç¤¢¤ë¡£ÊÑ¿ô¤ÎÃͤÇifʸ¤¬Ê¬´ô¤µ¤ì¤Æ¤¤¤Æ¡¢°Û¤Ê¤Ã¤¿Æ°ºî¤ò¤¹¤ë¤³¤È¤¬½ÐÍè¤ë¡£
sub Hand_Elevate()
{
if(elevate_flag == 0){ //¥Ï¥ó¥É¾å¾º
ELEVATE_UP;
until(SENSOR_1 > 385);
ELEVATE_STOP;
elevate_flag = 1; //¥Ï¥ó¥É¾å¾º½ªÎ»¡¡¼¡¡§¹ß²¼¤ò¼Â¹Ô
}
else if(elevate_flag == 1){ //¥Ï¥ó¥É¹ß²¼¡Ê´Ì¤ò¤Î¤»¤ë¡Ë
ELEVATE_DOWN;
until(SENSOR_1 < 360);
ELEVATE_STOP;
elevate_flag = 2; //¥Ï¥ó¥É¹ß²¼½ªÎ»¡¡¼¡¡§²¼¹ß¤ò¼Â¹Ô
}
else if(elevate_flag == 2){ //¥Ï¥ó¥É½é´ü°ÌÃ֡ʰìÈÖ²¼¡Ë¤Ø°Üư
ELEVATE_DOWN;
until(SENSOR_1 < 3);
ELEVATE_STOP;
elevate_flag = 0; //¥Ï¥ó¥É²¼¹ß½ªÎ»¡¡¼¡¡§¾å¾º¤ò¼Â¹Ô
}
}
°ìÏ¢¤Îưºî¤Ï¡ÖÄϤࢪ²¡¤µ¤¨¤ë¢ªÎ¥¤¹¡×¤Î¤è¤¦¤Ë¹Ô¤ï¤ì¤Æ¤¤¤¯¡£¡Öhand_flag¡×¤ÎÊÑ¿ô¤ÎÃͤǹԤï¤ì¤ëưºî¤¬ÊѲ½¤¹¤ë¡£
sub Hand_OC()
{
if(hand_flag == 0){
SetPower(OUT_C , 3);
HAND_CLOSE;
Wait(100);
SetPower(OUT_C , 6);
hand_flag = 1; //¥Ï¥ó¥ÉÊÄ¡¡¼¡¡§¥Ï¥ó¥É¤ò³«¤¯
}
else{
HAND_OPEN;
Wait(HAND_TIME);
HAND_STOP;
hand_flag = 0; //¥Ï¥ó¥É³«¡¡¼¡¡§¥Ï¥ó¥É¤òÊĤ¸¤ë
}
}
°Ê²¼Æó¤Ä¤Ï¥¢¡¼¥à¦¤ÈƱ¤¸µ¡Ç½¤Ç¤¢¤ë¡£
sub Reception()
{
ClearMessage(); //¡ãÄÌ¿®¡ä¡¡½é´ü²½¡ÊºÇ¸å¤Ë¼õ¿®¤·¤¿ÃÍ¡¡¢ª¡¡£°¡Ë
until(Message() == GO_AHEAD); //¡ãÄÌ¿®¡ä¡¡¡Ø£±£°¡Ú¹Ôư³«»Ï¡Û¡Ù¤ò¼õ¿®¤¹¤ë¤Þ¤ÇÂÔµ¡
SendMessage(ROGER); //¡ãÄÌ¿®¡ä¡¡¡Ø£±¡Úλ²ò¡Û¡Ù¤òÁ÷¿®
}
sub Transmission()
{
ClearMessage(); //¡ãÄÌ¿®¡ä¡¡½é´ü²½¡¡¡ÊºÇ¸å¤Ë¼õ¿®¤·¤¿ÃÍ ¢ª £°¡Ë
SendMessage(trans_sign); //¡ãÄÌ¿®¡ä¡¡¡Ø"trans_sign"¤ÎÃ͡٤òÁ÷¿®
until(Message() == ROGER); //¡ãÄÌ¿®¡ä¡¡¡Ø£±¡Úλ²ò¡Û¡Ù¤ò¼õ¿®¤¹¤ë¤Þ¤ÇÁ÷¿®¤·Â³¤±¤ë
}
**¥á¥¤¥ó¥¿¥¹¥¯ [#q6038d22]
¥á¥¤¥ó¥¿¥¹¥¯¤ÎÀâÌÀ¤Ï¥³¥á¥ó¥Èʸ¤ÇÀâÌÀ¤µ¤ì¤Æ¤¤¤ë¤¬¡¢kenty¤µ¤ó¤Î¥Ú¡¼¥¸¤Ç¤è¤ê¾Ü¤·¤¯ÀâÌÀ¤µ¤ì¤Æ¤¤¤ë¤Î¤Ç»²¹Í¤Ë¤·¤Æ¤Û¤·¤¤¡£
task main()
{
/*---------- ¥â¡¼¥¿¥Ñ¥ï¡¼¡¦¥»¥ó¥µ¡¡ÀßÄê ----------*/
SetSensor(SENSOR_1 , SENSOR_ROTATION); //²óž¥»¥ó¥µÀßÄê
ClearSensor(SENSOR_1); //²óž¥»¥ó¥µ½é´ü²½
/*---------- ´Ì¡¡ÀѤ߾夲¡Ê£³²ó·«¤êÊÖ¤·¡¢£´Ãʤˤ¹¤ë¡Ë----------*/
while(can_cnt < 3){
Reception(); //¡ãÄÌ¿®¡ä¡¡¡Ø£±£°¡Ú¹Ôư³«»Ï¡Û¡Ù¤ò¼õ¿®¤¹¤ë¤Þ¤ÇÂÔµ¡
Hand_OC(); //´Ì¤ò¤Ä¤«¤à
Hand_Elevate(); //¥Ï¥ó¥É¾å¾º
trans_sign = MOTION_END; //¡ãÄÌ¿®¡ä¡¡¡Ø£²£°¡Úưºî´°Î»¡Û¡Ù
Transmission(); //Á÷¿®
/* - - - - - - - - - - - - - - - - - - -*/
/* ¶îư¦¤¬´Ì¤Î¼êÁ°¤Þ¤Ç°Üư */
/* - - - - - - - - - - - - - - - - - - -*/
Reception(); //¡ãÄÌ¿®¡ä¡¡¡Ø£±£°¡Ú¹Ôư³«»Ï¡Û¡Ù¤ò¼õ¿®¤¹¤ë¤Þ¤ÇÂÔµ¡
Hand_Elevate(); //¥Ï¥ó¥É²¼¹ß
Hand_OC(); //´Ì¤òÊü¤¹
Hand_Elevate(); //°ìÈÖ²¼¤Þ¤Ç¥Ï¥ó¥É¤ò²¼¤í¤¹
trans_sign = MOTION_END; //¡ã¿®¹æ¡ä¡Ø£²£°¡Úưºî´°Î»¡Û¡Ù
Transmission(); //¡¡↳Á÷¿®
can_cnt++; //´Ì¤ÎËÜ¿ô¡¡¡Ü£±
}
Reception();
}
*È¿¾Ê [#y555790c]
º£²ó¤ÎMission3¤Ï¸Ä¡¹¤Îµ¡¹½¤Îưºî¤Ï»×¤¤Ä̤ê¤Ëư¤¤¤¿¤¬¡¢¤¤¤¶¤½¤ì¤é¤ò°ì¤Ä¤Î¥í¥Ü¥Ã¥È¤Ë¤¹¤ë¤È¡¢¤½¤ì¤é¤ò¤¯¤Ã¤Ä¤±¤ë¥Ö¥í¥Ã¥¯¤¬ÉÔ¤·¤¿¤ê¡¢¥³¡¼¥É¤ÎŤµ¤¬Â¤ê¤Ê¤«¤Ã¤¿¤ê¤·¤¿¡£Îý½¬¤Ç½Å¤¤µ¡¹½¤ò²¿Å٤ⲿÅÙ¤â¾å²¼¤¹¤ë¤Î¤Ç¡¢Å۵¤Ë¤è¤Ã¤ÆÆ°ºî¤¬ÊѲ½¤·¤Æ¤·¤Þ¤¦¤³¤È¤â¤ä¤Ï¤ê¤¢¤Ã¤¿¡£À¤¤ÎÃæ¤Î»ñ¸»¤Ï̵¸Â¤Ë¤¢¤ë¤ï¤±¤Ç¤Ê¤¯¡¢¤½¤ì¤é¤òºÇŬ¤ÊÊýË¡¤ÇÍøÍѤ·¤Æ¤¤¤¯ÂçÀÚ¤µ¤òº£²ó¤Ï³Ø¤Ö¤³¤È¤¬½ÐÍ褿¡£
¥Ú¡¼¥¸Ì¾: