2016b/Member/aat/Mission2
¤ò¥Æ¥ó¥×¥ì¡¼¥È¤Ë¤·¤ÆºîÀ®
[
¥È¥Ã¥×
] [
¿·µ¬
|
°ìÍ÷
|
¸¡º÷
|
ºÇ½ª¹¹¿·
|
¥Ø¥ë¥×
|
¥í¥°¥¤¥ó
]
³«»Ï¹Ô:
*Ìܼ¡ [#p29d7ff8]
#contents
*²ÝÂê [#k9798d32]
#ref(./s_2016b-mission2.png,¥³¡¼¥¹)
¼¡¤Î¤¤¤º¤ì¤«¤Î·ÐÏ©¤ò¹õ¤¤Àþ¤Ë¤½¤Ã¤ÆÆ°¤¯¥í¥Ü¥Ã¥È¤òºîÀ®¤¹¤ë (¾¤Î¥á¥ó¥Ð¡¼¤È¤ÏÊ̤ηÐÏ©¤Ë¤Ê¤ë¤è¤¦¤Ë¤¹¤ë)¡£
&br;¡¦AÃÏÅÀ¤ò¥¹¥¿¡¼¥È¤·¤ÆQÉÕ¶á¤Î3/4±ß¼þ¾å¤Ç¥Ô¥ó¥Ý¥ó¶Ì¤ò¤Ä¤«¤ß¡¢¤½¤Î¥Ô¥ó¥Ý¥ó¶Ì¤òDÃÏÅÀ¤Ë¤ª¤¤¤¿¥´¡¼¥ë¤Ø¥·¥å¡¼¥È¤¹¤ë (°ì¿ÍÌÜ)
&br;A¥¹¥¿¡¼¥È ¢ª Pľ¿Ê ¢ª Qľ¿Ê ¢ª (¥Ô¥ó¥Ý¥ó¶Ì¤ò¥¥ã¥Ã¥Á) ¢ª Qľ¿Ê ¢ª R±¦ÀÞ ¢ª Pľ¿Ê ¢ª Sº¸ÀÞ ¢ª D¤Ø¥·¥å¡¼¥È
&br;¡¦BÃÏÅÀ¤ò¥¹¥¿¡¼¥È¤·¤ÆQÉÕ¶á¤Î3/4±ß¼þ¾å¤Ç¥Ô¥ó¥Ý¥ó¶Ì¤ò¤Ä¤«¤ß¡¢¤½¤Î¥Ô¥ó¥Ý¥ó¶Ì¤òCÃÏÅÀ¤Ë¤ª¤¤¤¿¥´¡¼¥ë¤Ø¥·¥å¡¼¥È¤¹¤ë (Æó¿ÍÌÜ)
&br;B¥¹¥¿¡¼¥È ¢ª Rľ¿Ê ¢ª P±¦ÀÞ ¢ª Qľ¿Ê ¢ª (¥Ô¥ó¥Ý¥ó¶Ì¤ò¥¥ã¥Ã¥Á) ¢ª Qľ¿Ê ¢ª R±¦ÀÞ ¢ª Pľ¿Ê ¢ª S±¦ÀÞ ¢ª C¤Ø¥·¥å¡¼¥È
&br;¤¿¤À¤·¡¢
&br;¤Ê¤ë¤Ù¤¯Â®¤¯Àµ³Î¤Ëư¤¯¥í¥Ü¥Ã¥È¤Ë¤Ê¤ë¤è¤¦¤Ë¹©Éפ·¤Æ¡¢¸òº¹ÅÀ¤Ç¤Ï1ÉôÖÄä»ß¤¹¤ë¤³¤È¡£
&br;¥Ô¥ó¥Ý¥ó¶Ì¤ÏQ¶á¤¯¤Î3/4±ß¼þ¾å¤Ê¤é¤É¤³¤Ë¤ª¤¤¤Æ¤â¤è¤¤
&br;²Äǽ¤Ç¤¢¤ì¤ÐC,D¤Î¥´¡¼¥ë¥¨¥ê¥¢¥é¥¤¥ó¾å¤«¤é¥·¥å¡¼¥È¤¹¤ë
&br;»ä¤ÏAÅÀ¢ªDÅÀ¤Î¥³¡¼¥¹¤òôÅö¤·¤¿¡£
AÅÀ¢ªPľ¿Ê¢ªQľ¿Ê¢ªR±¦ÀÞ¢ªPľ¿Ê¢ªSº¸ÀÞ¢ªDÅÀ¢ª¥·¥å¡¼¥È
*¥í¥Ü¥Ã¥È¤ÎÀâÌÀ [#o3709025]
#ref(./s_12459.jpg,Á´ÂÎÁü)
#ref(./s_12462.jpg,Á´ÂÎÁü)
º£²ó¤Ï¤Ç¤¤ë¤À¤±¥³¥ó¥Ñ¥¯¥È¤Ë¤¹¤ë¤¿¤á¤Ë¥¿¥¤¥äƱ»Î¤Î´Ö³Ö¤ò¶¹¤¯¤·¤¿¡£¤Þ¤¿ºÙ¤«¤Êư¤¤¬¤Ç¤¤ë¤è¤¦¤Ë¡¢Â礤¤Êý¤Î¥¿¥¤¥ä¤òÁ°ÎؤȤ·¤¿¡£¥Ô¥ó¥Ý¥ó¶Ì¤ò¤Ä¤«¤à¤Î¤Ë¥¯¥ï¥¬¥¿¥à¥·Êý¼°¤ò¼è¤êÆþ¤ì¤¿¡£
#ref(./s_12460.jpg,50,arm)
¤³¤³¤Î¤È¤³¤í¤Ç¹©Éפ·¤¿ÅÀ¤Ï¡¢¥®¥¢¤òÁȹç¤ï¤»¤ë¤Î¤Ë¹â¤µ¤¬¤º¤ì¤Æ¤¤¤¿¤¿¤á¥®¥¢¤ò2¤Ä½Å¤Í¤¿¤³¤È¤À¡£
*¥×¥í¥°¥é¥à¤ÎÀâÌÀ [#h51302c2]
task main¤ä¥µ¥Ö¥ë¡¼¥Á¥ó¤Ç»ÈÍѤ¹¤ë¤â¤Î¤ò°Ê²¼¤Î¤è¤¦¤ËÄêµÁ¤·¤¿¡£
#define rightSENKAI OnFwd(OUT_A);OnRev(OUT_C);¡¡//±¦Àû²ó
#define rightMAGARU OnFwd(OUT_A);Off(OUT_C); //±¦¤Ë¶Ê¤¬¤ë
#define leftSENKAI OnFwd(OUT_C);OnRev(OUT_A); //º¸Àû²ó
#define leftMAGARU OnFwd(OUT_C);Off(OUT_A); //º¸¤Ë¶Ê¤¬¤ë
#define middle 47 //ïçÃÍ
#define go(got) OnFwd(OUT_AC);Wait(got);Off(OUT_AC); //gotÉÃľ¿Ê
#define TURN_RIGHT OnFwd(OUT_A);OnRev(OUT_C);until(SENSOR_2<=40);Off(OUT_AC); //¥»¥ó¥µ¡¼¤¬¹õ¤ò´¶ÃΤ¹¤ë¤Þ¤Ç±¦ÀÞ
#define TURN_LEFT OnFwd(OUT_C);OnRev(OUT_A);until(SENSOR_2>=50);Off(OUT_AC); //¥»¥ó¥µ¡¼¤¬Çò¤ò´¶ÃΤ¹¤ë¤Þ¤Çº¸ÀÞ
#define cross_stop Off(OUT_AC);Wait(100); //¸òº¹ÅÀ¤Ç1ÉÃÄä»ß
¡Öº¸±¦¤Ë¶Ê¤¬¤ë¡×¤È¡Ö±¦ÀÞº¸ÀޡפˤĤ¤¤Æ¤Ï¸å¤ËÀâÌÀ¤¹¤ë¡£
**¥é¥¤¥ó¥È¥ì¡¼¥¹¤Î¥×¥í¥°¥é¥à [#d5b3ace5]
»ä¤Ï¥í¥Ü¥Ã¥È¤¬¹õÀþ¤Îº¸Â¦¤ò¤Ê¤¾¤ë¥×¥í¥°¥é¥à¤ò¹Í¤¨¤¿¡£¤è¤Ã¤Æ¥í¥Ü¥Ã¥È¤Ï
&br;¹õ¡Ýº¸Àû²ó
&br;¹õ¤Ã¤Ý¤¤¡½º¸¤Ë¶Ê¤¬¤ë
&br;¹õ¤ÈÇò¤ÎÃæ´Ö¡½Ä¾¿Ê
&br;Çò¤Ã¤Ý¤¤¡½±¦¤Ë¶Ê¤¬¤ë
&br;Çò¡Ý±¦Àû²ó
&br;¤È¤¤¤Ã¤¿´¶¤¸¤Ëư¤¯¤È¤·¤¿¡£
¸òº¹ÅÀ¤ÎȽÊ̤ϡ¢º¸Àû²ó¤¬0.3Éðʾå¤Ç¤¢¤ë¤Ê¤é(¹õ¤¬0.3Éðʾ峤¯¤Î¤Ê¤é)Ää»ß¤¹¤ë¤È¤¤¤¦É÷¤Ë¤·¤¿¡£
¤½¤·¤Æ´ðËÜŪ¤Ê¥é¥¤¥ó¥È¥ì¡¼¥¹¤Î¥×¥í¥°¥é¥à¤ò°Ê²¼¤Î¤è¤¦¤ËÄêµÁ¤·¤¿¡£
sub Line() //¥é¥¤¥ó¥È¥ì¡¼¥¹
{
SetSensor(SENSOR_2,SENSOR_LIGHT);
ClearTimer(0);
while(FastTimer(0)<=30)¡¡//º¸Àû²ó¤¬0.3ÉÃ°ÊÆâ¤Î¾ì¹ç¤Ï¥ë¡¼¥×¤·¤Ê¤µ¤¤
{
if(SENSOR_2>middle+5)
{
rightSENKAI
ClearTimer(0);¡¡¡¡¡¡¡¡¡¡//Çò¤À¤Ã¤¿¤é±¦Àû²ó¤·¤Ê¤µ¤¤
}
else if(SENSOR_2>middle+3)
{
rightMAGARU
ClearTimer(0);¡¡¡¡¡¡¡¡¡¡//Çò¤Ã¤Ý¤¤¤Ê¤é±¦¤Ë¶Ê¤¬¤ê¤Ê¤µ¤¤
}
else if(SENSOR_2>middle)
{
OnFwd(OUT_AC);
ClearTimer(0);¡¡¡¡¡¡¡¡¡¡//Ãæ´Ö¤Ê¤éľ¿Ê¤·¤Ê¤µ¤¤
}
else if(SENSOR_2>middle-3)
{
leftMAGARU
ClearTimer(0); //¹õ¤Ã¤Ý¤¤¤Ê¤éº¸¤Ë¶Ê¤¬¤ê¤Ê¤µ¤¤
}
else
{
leftSENKAI ¡¡¡¡¡¡¡¡¡¡¡¡//¹õ¤Ê¤éÀû²ó¤·¤Ê¤µ¤¤
}
}
Off(OUT_AC);¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//¤È¤Þ¤ì
}
¤³¤ì¤ÇÂçȾ¤Ï¤Ç¤¤¿¤¬¡¢°ìÉô¤¦¤Þ¤¯¤¤¤«¤Ê¤¤¶è´Ö¤¬¤¢¤Ã¤¿¡£¤½¤³¤ÏRP´Ö¤Ç¤¢¤ê¡¢¤¦¤Þ¤¯¸òº¹ÅÀȽÊ̤¬¤Ç¤¤Ê¤«¤Ã¤¿¡£
&br;Íýͳ¤Ï¤ª¤½¤é¤¯¸òº¹ÅÀ¤Ø¤Î¿ÊÆþ³ÑÅÙ¤¬¿âľ¤Ç¤Ê¤¯¡¢¤ä¤äº¸Â¦¤Ë·¹¤¤¤Æ¤¤¤¿¤«¤é¤À¡£»ä¤Î¥×¥í¥°¥é¥à¤ÏÀþ¤Îº¸Â¦¤ò¤Ê¤¾¤ë¤¿¤á¡¢º¸¼Ð¤á¤Ë¿ÊÆþ¤¹¤ë¤Èº¸Àû²ó¤Î»þ´Ö¤¬0.3ÉÃ°ÊÆâ¤Ë¼ý¤Þ¤Ã¤Æ¤·¤Þ¤Ã¤¿¤È¹Í¤¨¤é¤ì¤¿¡£
&br;¤½¤³¤Ç¤½¤Î¶è´Ö¤À¤±ÆÃÊÌ¤Ë¥×¥í¥°¥é¥à¤òÁȤó¤À¡£
sub LineSP() //¥é¥¤¥ó¥È¥ì¡¼¥¹SP
{
SetSensor(SENSOR_2,SENSOR_LIGHT);
ClearTimer(0);
while(FastTimer(0)<=30)
{
if(SENSOR_2>middle+7)
{
rightSENKAI
ClearTimer(0);
}
else if(SENSOR_2>middle+5)
{
rightMAGARU
ClearTimer(0);
}
else if(SENSOR_2>middle)
{
OnFwd(OUT_AC);
ClearTimer(0);
}
else if(SENSOR_2>middle-6)
{
leftMAGARU
ClearTimer(0);
}
else
{
leftSENKAI
}
}
Off(OUT_AC);
}
²ò·èºö¤È¤·¤Æ¤Ï¡¸òº¹ÅÀȽÊ̤Î0.3Éäòû¤¯¤¹¤ë¢¸òº¹ÅÀ¿ÊÆþ¤ò¿âľ¤Ë¤¹¤ë¡¢¤Î2¤Ä¤¬¹Í¤¨¤é¤ì¤¿¡£¡¤Î¤Û¤¦¤Ï²¿²ó¤âtry¤·¤¿¤¬¤¦¤Þ¤¯¤¤¤«¤Ê¤«¤Ã¤¿¤¿¤á¡¢¤¢¤¤é¤á¤Æ¢¤òÁªÂò¤·¤¿¡£
&br;Ãæ¿È¤Ï¤Û¤È¤ó¤ÉÊѤ¨¤º¡¢middle¤Ë²Ã¸º¤¹¤ë¿ôÃͤò½ù¡¹¤ËÂ礤¯¤·¤Æ¤ß¤¿¤È¤³¤í¡¢¤è¤ê¿âľ¤Ë¿ÊÆþ¤¹¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£·ë²Ì¡¢¤³¤Î¿ô»ú¤Ç¤¦¤Þ¤¯¤¤¤Ã¤¿¡£
**¥Ô¥ó¥Ý¥ó¶Ì¤Î¥¥ã¥Ã¥Á¤È¥·¥å¡¼¥È [#l199736a]
¥Ô¥ó¥Ý¥óµå¤Î¥¥ã¥Ã¥Á¤Ï°Ê²¼¤ËÄêµÁ¤·¤¿¡£
void hold(int t) //µå¤Î¥¥ã¥Ã¥Á
{
OnFwd(OUT_B);
Wait(t);
Off(OUT_B);¡¡¡¡¡¡ //¥Ï¥µ¥ß¤òÊĤ¸¤ë
}
¥×¥í¥°¥é¥à¤ò³Ú¤Ë¤¹¤ë¤¿¤á¤Ë½é¤á¤ÎÃʳ¬¤«¤é¥Ï¥µ¥ß¤ò³«¤¤¤Æ¤ª¤¤¤Æ¡¢¤¢¤È¤ÏÊĤ¸¤ë¤À¤±¤Ë¤·¤¿¡£
&br;¼¡¤Ë¥·¥å¡¼¥È¤Î¥×¥í¥°¥é¥à¤Ç¤¢¤ë¡£
sub shoot() //¥·¥å¡¼¥È
{
rightSENKAI¡¡¡¡
Wait(20);¡¡¡¡¡¡ //±¦¤Ë³ÑÅÙÄ´À°
OnRev(OUT_AC);
Wait(30); //¾¯¤·¸åÂà
OnRev(OUT_B);
Wait(10);¡¡¡¡¡¡ //¥Ï¥µ¥ß¤ò³«¤¯
go(30);¡¡¡¡¡¡¡¡ //ľ¿Ê¤·¤Æ¡¢Àª¤¤¤Ç¥´¡¼¥ë
Off(OUT_ABC);¡¡ //¤¹¤Ù¤ÆÄä»ß
}
¥·¥å¡¼¥È¤ÏºÇ¸å¤Ê¤Î¤Ç¡¢¥·¥å¡¼¥È¤ÎľÁ°¤Ï¸òº¹ÅÀȽÊ̤µ¤ì¤Æ(T»úÏ©¤Ã¤Ý¤¯¤Ê¤Ã¤Æ¤¤¤ë¤«¤é)»ß¤Þ¤Ã¤Æ¤¤¤ë¤Ï¤º¤Ç¤¢¤ë¡£¤Þ¤¿¤½¤Î¤È¤¥í¥Ü¥Ã¥È¤Ï¥´¡¼¥ë¤ËÂФ·¤Æ¤ä¤äº¸Â¦¤Ø·¹¤¤¤Æ¤¤¤ë¡£
&br;¤è¤Ã¤Æ³ÑÅÙ¤ò±¦¤Ë½¤Àµ¤·¤Æ¤¢¤²¤ëɬÍפ¬¤¢¤ë¡£¤¢¤È¤Ï¾¯¤·¸åÂष¤Æ¡¢¥Ï¥µ¥ß¤ò³«¤¡¢Ä¾¿Ê¤·¤ÆÀª¤¤¤Ç¥´¡¼¥ë¤µ¤»¤ë¡£
*¥á¥¤¥ó¥×¥í¥°¥é¥à [#x63349f2]
task main()
{
Line(); //A-P´Ö
cross_stop¡¡ //°ì»þÄä»ß
go(30);¡¡¡¡¡¡//ľ¿Ê
Line(); //P-Q´Ö
cross_stop //°ì»þÄä»ß
go(30); //ľ¿Ê
hold(15);¡¡¡¡//µå¥¥ã¥Ã¥Á
Line(); //Q-Q´Ö
cross_stop //°ì»þÄä»ß
go(20); //ľ¿Ê
Line(); //Q-R´Ö
cross_stop //°ì»þÄä»ß
hold(5); //¥Ï¥µ¥ß¤Î´Ë¤ß¤ò¤Ê¤ª¤¹
go(30); //ľ¿Ê
TURN_RIGHT //¥»¥ó¥µ¡¼¤¬¹õ¤ò´¶ÃΤ¹¤ë¤Þ¤Ç±¦ÀÞ
LineSP(); //R-P´Ö
cross_stop //°ì»þÄä»ß
go(30); //ľ¿Ê
Line(); //P-S´Ö
cross_stop //°ì»þÄä»ß
TURN_LEFT //¥»¥ó¥µ¡¼¤¬Çò¤ò´¶ÃΤ¹¤ë¤Þ¤Çº¸ÀÞ
Line();¡¡¡¡¡¡//S-D´Ö
shoot(); //¥·¥å¡¼¥È
}
¸òº¹ÅÀ¤«¤é¤Îľ¿Ê¤äº¸±¦ÀÞ¤ÎÂнè¤Ë´Ø¤·¤Æ¡¢¤¢¤é¤«¤¸¤á¥³¡¼¥¹¤¬·è¤á¤é¤ì¤Æ¤¤¤ë¤¿¤á¤½¤ÎÅÔÅÙľ¿Ê¤µ¤»¤¿¤ê¤·¤Æ¤«¤é¥é¥¤¥ó¥È¥ì¡¼¥¹¤Ë¤·¤Æ¤¤¤ë¡£¤½¤Î¤¿¤á¥µ¥Ö¥ë¡¼¥Á¥ó¤Î¤â¤Î¤È¤Ï°ã¤¦¥Þ¥¯¥í¤òÍѰդ·¤¿¡£
*È¿¾ÊÅÀ¤È´¶ÁÛ [#e52ae42f]
ËÜÂμ«ÂΤδ°À®¤â¼ã´³¼ê´Ö¤¬¤«¤«¤Ã¤¿¤¿¤á¡¢¼ø¶È½ªÎ»¸å¤â»Ä¤Ã¤Æ¥×¥í¥°¥é¥à¤òºî¤Ã¤¿¡£¤Þ¤¿¥é¥¤¥ó¥È¥ì¡¼¥¹¤¬¤¦¤Þ¤¯¤¤¤«¤Ê¤¯¤Æ²¿²ó¤â¿ôÃͤò¤¤¤¸¤Ã¤¿¤ê¤Î·«¤êÊÖ¤·¤Ç¤È¤Æ¤âÂçÊѤÀ¤Ã¤¿¡£
&br;¤±¤ì¤É¤âËÜÈ֤ǤÁ¤ã¤ó¤Èư¤¤¤Æ¥´¡¼¥ë¤â¤Ç¤¤¿¤È¤¤Ï¤È¤Æ¤â´ò¤·¤¯¤Æ´¶Æ°¤·¤¿¡£
&br;º£²ó¤ÎÈ¿¾ÊÅÀ¤Ï¥×¥í¥°¥é¥à¤¬Â礤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿¤³¤È¤Ç¤¢¤ë¡£¼¡²ó¤¬ºÇ¸å¤Ê¤Î¤Çº£²ó¤Î¤³¤È¤òÀ¸¤«¤·¤Æ´èÄ¥¤ê¤¿¤¤¤È»×¤¦¡£
½ªÎ»¹Ô:
*Ìܼ¡ [#p29d7ff8]
#contents
*²ÝÂê [#k9798d32]
#ref(./s_2016b-mission2.png,¥³¡¼¥¹)
¼¡¤Î¤¤¤º¤ì¤«¤Î·ÐÏ©¤ò¹õ¤¤Àþ¤Ë¤½¤Ã¤ÆÆ°¤¯¥í¥Ü¥Ã¥È¤òºîÀ®¤¹¤ë (¾¤Î¥á¥ó¥Ð¡¼¤È¤ÏÊ̤ηÐÏ©¤Ë¤Ê¤ë¤è¤¦¤Ë¤¹¤ë)¡£
&br;¡¦AÃÏÅÀ¤ò¥¹¥¿¡¼¥È¤·¤ÆQÉÕ¶á¤Î3/4±ß¼þ¾å¤Ç¥Ô¥ó¥Ý¥ó¶Ì¤ò¤Ä¤«¤ß¡¢¤½¤Î¥Ô¥ó¥Ý¥ó¶Ì¤òDÃÏÅÀ¤Ë¤ª¤¤¤¿¥´¡¼¥ë¤Ø¥·¥å¡¼¥È¤¹¤ë (°ì¿ÍÌÜ)
&br;A¥¹¥¿¡¼¥È ¢ª Pľ¿Ê ¢ª Qľ¿Ê ¢ª (¥Ô¥ó¥Ý¥ó¶Ì¤ò¥¥ã¥Ã¥Á) ¢ª Qľ¿Ê ¢ª R±¦ÀÞ ¢ª Pľ¿Ê ¢ª Sº¸ÀÞ ¢ª D¤Ø¥·¥å¡¼¥È
&br;¡¦BÃÏÅÀ¤ò¥¹¥¿¡¼¥È¤·¤ÆQÉÕ¶á¤Î3/4±ß¼þ¾å¤Ç¥Ô¥ó¥Ý¥ó¶Ì¤ò¤Ä¤«¤ß¡¢¤½¤Î¥Ô¥ó¥Ý¥ó¶Ì¤òCÃÏÅÀ¤Ë¤ª¤¤¤¿¥´¡¼¥ë¤Ø¥·¥å¡¼¥È¤¹¤ë (Æó¿ÍÌÜ)
&br;B¥¹¥¿¡¼¥È ¢ª Rľ¿Ê ¢ª P±¦ÀÞ ¢ª Qľ¿Ê ¢ª (¥Ô¥ó¥Ý¥ó¶Ì¤ò¥¥ã¥Ã¥Á) ¢ª Qľ¿Ê ¢ª R±¦ÀÞ ¢ª Pľ¿Ê ¢ª S±¦ÀÞ ¢ª C¤Ø¥·¥å¡¼¥È
&br;¤¿¤À¤·¡¢
&br;¤Ê¤ë¤Ù¤¯Â®¤¯Àµ³Î¤Ëư¤¯¥í¥Ü¥Ã¥È¤Ë¤Ê¤ë¤è¤¦¤Ë¹©Éפ·¤Æ¡¢¸òº¹ÅÀ¤Ç¤Ï1ÉôÖÄä»ß¤¹¤ë¤³¤È¡£
&br;¥Ô¥ó¥Ý¥ó¶Ì¤ÏQ¶á¤¯¤Î3/4±ß¼þ¾å¤Ê¤é¤É¤³¤Ë¤ª¤¤¤Æ¤â¤è¤¤
&br;²Äǽ¤Ç¤¢¤ì¤ÐC,D¤Î¥´¡¼¥ë¥¨¥ê¥¢¥é¥¤¥ó¾å¤«¤é¥·¥å¡¼¥È¤¹¤ë
&br;»ä¤ÏAÅÀ¢ªDÅÀ¤Î¥³¡¼¥¹¤òôÅö¤·¤¿¡£
AÅÀ¢ªPľ¿Ê¢ªQľ¿Ê¢ªR±¦ÀÞ¢ªPľ¿Ê¢ªSº¸ÀÞ¢ªDÅÀ¢ª¥·¥å¡¼¥È
*¥í¥Ü¥Ã¥È¤ÎÀâÌÀ [#o3709025]
#ref(./s_12459.jpg,Á´ÂÎÁü)
#ref(./s_12462.jpg,Á´ÂÎÁü)
º£²ó¤Ï¤Ç¤¤ë¤À¤±¥³¥ó¥Ñ¥¯¥È¤Ë¤¹¤ë¤¿¤á¤Ë¥¿¥¤¥äƱ»Î¤Î´Ö³Ö¤ò¶¹¤¯¤·¤¿¡£¤Þ¤¿ºÙ¤«¤Êư¤¤¬¤Ç¤¤ë¤è¤¦¤Ë¡¢Â礤¤Êý¤Î¥¿¥¤¥ä¤òÁ°ÎؤȤ·¤¿¡£¥Ô¥ó¥Ý¥ó¶Ì¤ò¤Ä¤«¤à¤Î¤Ë¥¯¥ï¥¬¥¿¥à¥·Êý¼°¤ò¼è¤êÆþ¤ì¤¿¡£
#ref(./s_12460.jpg,50,arm)
¤³¤³¤Î¤È¤³¤í¤Ç¹©Éפ·¤¿ÅÀ¤Ï¡¢¥®¥¢¤òÁȹç¤ï¤»¤ë¤Î¤Ë¹â¤µ¤¬¤º¤ì¤Æ¤¤¤¿¤¿¤á¥®¥¢¤ò2¤Ä½Å¤Í¤¿¤³¤È¤À¡£
*¥×¥í¥°¥é¥à¤ÎÀâÌÀ [#h51302c2]
task main¤ä¥µ¥Ö¥ë¡¼¥Á¥ó¤Ç»ÈÍѤ¹¤ë¤â¤Î¤ò°Ê²¼¤Î¤è¤¦¤ËÄêµÁ¤·¤¿¡£
#define rightSENKAI OnFwd(OUT_A);OnRev(OUT_C);¡¡//±¦Àû²ó
#define rightMAGARU OnFwd(OUT_A);Off(OUT_C); //±¦¤Ë¶Ê¤¬¤ë
#define leftSENKAI OnFwd(OUT_C);OnRev(OUT_A); //º¸Àû²ó
#define leftMAGARU OnFwd(OUT_C);Off(OUT_A); //º¸¤Ë¶Ê¤¬¤ë
#define middle 47 //ïçÃÍ
#define go(got) OnFwd(OUT_AC);Wait(got);Off(OUT_AC); //gotÉÃľ¿Ê
#define TURN_RIGHT OnFwd(OUT_A);OnRev(OUT_C);until(SENSOR_2<=40);Off(OUT_AC); //¥»¥ó¥µ¡¼¤¬¹õ¤ò´¶ÃΤ¹¤ë¤Þ¤Ç±¦ÀÞ
#define TURN_LEFT OnFwd(OUT_C);OnRev(OUT_A);until(SENSOR_2>=50);Off(OUT_AC); //¥»¥ó¥µ¡¼¤¬Çò¤ò´¶ÃΤ¹¤ë¤Þ¤Çº¸ÀÞ
#define cross_stop Off(OUT_AC);Wait(100); //¸òº¹ÅÀ¤Ç1ÉÃÄä»ß
¡Öº¸±¦¤Ë¶Ê¤¬¤ë¡×¤È¡Ö±¦ÀÞº¸ÀޡפˤĤ¤¤Æ¤Ï¸å¤ËÀâÌÀ¤¹¤ë¡£
**¥é¥¤¥ó¥È¥ì¡¼¥¹¤Î¥×¥í¥°¥é¥à [#d5b3ace5]
»ä¤Ï¥í¥Ü¥Ã¥È¤¬¹õÀþ¤Îº¸Â¦¤ò¤Ê¤¾¤ë¥×¥í¥°¥é¥à¤ò¹Í¤¨¤¿¡£¤è¤Ã¤Æ¥í¥Ü¥Ã¥È¤Ï
&br;¹õ¡Ýº¸Àû²ó
&br;¹õ¤Ã¤Ý¤¤¡½º¸¤Ë¶Ê¤¬¤ë
&br;¹õ¤ÈÇò¤ÎÃæ´Ö¡½Ä¾¿Ê
&br;Çò¤Ã¤Ý¤¤¡½±¦¤Ë¶Ê¤¬¤ë
&br;Çò¡Ý±¦Àû²ó
&br;¤È¤¤¤Ã¤¿´¶¤¸¤Ëư¤¯¤È¤·¤¿¡£
¸òº¹ÅÀ¤ÎȽÊ̤ϡ¢º¸Àû²ó¤¬0.3Éðʾå¤Ç¤¢¤ë¤Ê¤é(¹õ¤¬0.3Éðʾ峤¯¤Î¤Ê¤é)Ää»ß¤¹¤ë¤È¤¤¤¦É÷¤Ë¤·¤¿¡£
¤½¤·¤Æ´ðËÜŪ¤Ê¥é¥¤¥ó¥È¥ì¡¼¥¹¤Î¥×¥í¥°¥é¥à¤ò°Ê²¼¤Î¤è¤¦¤ËÄêµÁ¤·¤¿¡£
sub Line() //¥é¥¤¥ó¥È¥ì¡¼¥¹
{
SetSensor(SENSOR_2,SENSOR_LIGHT);
ClearTimer(0);
while(FastTimer(0)<=30)¡¡//º¸Àû²ó¤¬0.3ÉÃ°ÊÆâ¤Î¾ì¹ç¤Ï¥ë¡¼¥×¤·¤Ê¤µ¤¤
{
if(SENSOR_2>middle+5)
{
rightSENKAI
ClearTimer(0);¡¡¡¡¡¡¡¡¡¡//Çò¤À¤Ã¤¿¤é±¦Àû²ó¤·¤Ê¤µ¤¤
}
else if(SENSOR_2>middle+3)
{
rightMAGARU
ClearTimer(0);¡¡¡¡¡¡¡¡¡¡//Çò¤Ã¤Ý¤¤¤Ê¤é±¦¤Ë¶Ê¤¬¤ê¤Ê¤µ¤¤
}
else if(SENSOR_2>middle)
{
OnFwd(OUT_AC);
ClearTimer(0);¡¡¡¡¡¡¡¡¡¡//Ãæ´Ö¤Ê¤éľ¿Ê¤·¤Ê¤µ¤¤
}
else if(SENSOR_2>middle-3)
{
leftMAGARU
ClearTimer(0); //¹õ¤Ã¤Ý¤¤¤Ê¤éº¸¤Ë¶Ê¤¬¤ê¤Ê¤µ¤¤
}
else
{
leftSENKAI ¡¡¡¡¡¡¡¡¡¡¡¡//¹õ¤Ê¤éÀû²ó¤·¤Ê¤µ¤¤
}
}
Off(OUT_AC);¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//¤È¤Þ¤ì
}
¤³¤ì¤ÇÂçȾ¤Ï¤Ç¤¤¿¤¬¡¢°ìÉô¤¦¤Þ¤¯¤¤¤«¤Ê¤¤¶è´Ö¤¬¤¢¤Ã¤¿¡£¤½¤³¤ÏRP´Ö¤Ç¤¢¤ê¡¢¤¦¤Þ¤¯¸òº¹ÅÀȽÊ̤¬¤Ç¤¤Ê¤«¤Ã¤¿¡£
&br;Íýͳ¤Ï¤ª¤½¤é¤¯¸òº¹ÅÀ¤Ø¤Î¿ÊÆþ³ÑÅÙ¤¬¿âľ¤Ç¤Ê¤¯¡¢¤ä¤äº¸Â¦¤Ë·¹¤¤¤Æ¤¤¤¿¤«¤é¤À¡£»ä¤Î¥×¥í¥°¥é¥à¤ÏÀþ¤Îº¸Â¦¤ò¤Ê¤¾¤ë¤¿¤á¡¢º¸¼Ð¤á¤Ë¿ÊÆþ¤¹¤ë¤Èº¸Àû²ó¤Î»þ´Ö¤¬0.3ÉÃ°ÊÆâ¤Ë¼ý¤Þ¤Ã¤Æ¤·¤Þ¤Ã¤¿¤È¹Í¤¨¤é¤ì¤¿¡£
&br;¤½¤³¤Ç¤½¤Î¶è´Ö¤À¤±ÆÃÊÌ¤Ë¥×¥í¥°¥é¥à¤òÁȤó¤À¡£
sub LineSP() //¥é¥¤¥ó¥È¥ì¡¼¥¹SP
{
SetSensor(SENSOR_2,SENSOR_LIGHT);
ClearTimer(0);
while(FastTimer(0)<=30)
{
if(SENSOR_2>middle+7)
{
rightSENKAI
ClearTimer(0);
}
else if(SENSOR_2>middle+5)
{
rightMAGARU
ClearTimer(0);
}
else if(SENSOR_2>middle)
{
OnFwd(OUT_AC);
ClearTimer(0);
}
else if(SENSOR_2>middle-6)
{
leftMAGARU
ClearTimer(0);
}
else
{
leftSENKAI
}
}
Off(OUT_AC);
}
²ò·èºö¤È¤·¤Æ¤Ï¡¸òº¹ÅÀȽÊ̤Î0.3Éäòû¤¯¤¹¤ë¢¸òº¹ÅÀ¿ÊÆþ¤ò¿âľ¤Ë¤¹¤ë¡¢¤Î2¤Ä¤¬¹Í¤¨¤é¤ì¤¿¡£¡¤Î¤Û¤¦¤Ï²¿²ó¤âtry¤·¤¿¤¬¤¦¤Þ¤¯¤¤¤«¤Ê¤«¤Ã¤¿¤¿¤á¡¢¤¢¤¤é¤á¤Æ¢¤òÁªÂò¤·¤¿¡£
&br;Ãæ¿È¤Ï¤Û¤È¤ó¤ÉÊѤ¨¤º¡¢middle¤Ë²Ã¸º¤¹¤ë¿ôÃͤò½ù¡¹¤ËÂ礤¯¤·¤Æ¤ß¤¿¤È¤³¤í¡¢¤è¤ê¿âľ¤Ë¿ÊÆþ¤¹¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£·ë²Ì¡¢¤³¤Î¿ô»ú¤Ç¤¦¤Þ¤¯¤¤¤Ã¤¿¡£
**¥Ô¥ó¥Ý¥ó¶Ì¤Î¥¥ã¥Ã¥Á¤È¥·¥å¡¼¥È [#l199736a]
¥Ô¥ó¥Ý¥óµå¤Î¥¥ã¥Ã¥Á¤Ï°Ê²¼¤ËÄêµÁ¤·¤¿¡£
void hold(int t) //µå¤Î¥¥ã¥Ã¥Á
{
OnFwd(OUT_B);
Wait(t);
Off(OUT_B);¡¡¡¡¡¡ //¥Ï¥µ¥ß¤òÊĤ¸¤ë
}
¥×¥í¥°¥é¥à¤ò³Ú¤Ë¤¹¤ë¤¿¤á¤Ë½é¤á¤ÎÃʳ¬¤«¤é¥Ï¥µ¥ß¤ò³«¤¤¤Æ¤ª¤¤¤Æ¡¢¤¢¤È¤ÏÊĤ¸¤ë¤À¤±¤Ë¤·¤¿¡£
&br;¼¡¤Ë¥·¥å¡¼¥È¤Î¥×¥í¥°¥é¥à¤Ç¤¢¤ë¡£
sub shoot() //¥·¥å¡¼¥È
{
rightSENKAI¡¡¡¡
Wait(20);¡¡¡¡¡¡ //±¦¤Ë³ÑÅÙÄ´À°
OnRev(OUT_AC);
Wait(30); //¾¯¤·¸åÂà
OnRev(OUT_B);
Wait(10);¡¡¡¡¡¡ //¥Ï¥µ¥ß¤ò³«¤¯
go(30);¡¡¡¡¡¡¡¡ //ľ¿Ê¤·¤Æ¡¢Àª¤¤¤Ç¥´¡¼¥ë
Off(OUT_ABC);¡¡ //¤¹¤Ù¤ÆÄä»ß
}
¥·¥å¡¼¥È¤ÏºÇ¸å¤Ê¤Î¤Ç¡¢¥·¥å¡¼¥È¤ÎľÁ°¤Ï¸òº¹ÅÀȽÊ̤µ¤ì¤Æ(T»úÏ©¤Ã¤Ý¤¯¤Ê¤Ã¤Æ¤¤¤ë¤«¤é)»ß¤Þ¤Ã¤Æ¤¤¤ë¤Ï¤º¤Ç¤¢¤ë¡£¤Þ¤¿¤½¤Î¤È¤¥í¥Ü¥Ã¥È¤Ï¥´¡¼¥ë¤ËÂФ·¤Æ¤ä¤äº¸Â¦¤Ø·¹¤¤¤Æ¤¤¤ë¡£
&br;¤è¤Ã¤Æ³ÑÅÙ¤ò±¦¤Ë½¤Àµ¤·¤Æ¤¢¤²¤ëɬÍפ¬¤¢¤ë¡£¤¢¤È¤Ï¾¯¤·¸åÂष¤Æ¡¢¥Ï¥µ¥ß¤ò³«¤¡¢Ä¾¿Ê¤·¤ÆÀª¤¤¤Ç¥´¡¼¥ë¤µ¤»¤ë¡£
*¥á¥¤¥ó¥×¥í¥°¥é¥à [#x63349f2]
task main()
{
Line(); //A-P´Ö
cross_stop¡¡ //°ì»þÄä»ß
go(30);¡¡¡¡¡¡//ľ¿Ê
Line(); //P-Q´Ö
cross_stop //°ì»þÄä»ß
go(30); //ľ¿Ê
hold(15);¡¡¡¡//µå¥¥ã¥Ã¥Á
Line(); //Q-Q´Ö
cross_stop //°ì»þÄä»ß
go(20); //ľ¿Ê
Line(); //Q-R´Ö
cross_stop //°ì»þÄä»ß
hold(5); //¥Ï¥µ¥ß¤Î´Ë¤ß¤ò¤Ê¤ª¤¹
go(30); //ľ¿Ê
TURN_RIGHT //¥»¥ó¥µ¡¼¤¬¹õ¤ò´¶ÃΤ¹¤ë¤Þ¤Ç±¦ÀÞ
LineSP(); //R-P´Ö
cross_stop //°ì»þÄä»ß
go(30); //ľ¿Ê
Line(); //P-S´Ö
cross_stop //°ì»þÄä»ß
TURN_LEFT //¥»¥ó¥µ¡¼¤¬Çò¤ò´¶ÃΤ¹¤ë¤Þ¤Çº¸ÀÞ
Line();¡¡¡¡¡¡//S-D´Ö
shoot(); //¥·¥å¡¼¥È
}
¸òº¹ÅÀ¤«¤é¤Îľ¿Ê¤äº¸±¦ÀÞ¤ÎÂнè¤Ë´Ø¤·¤Æ¡¢¤¢¤é¤«¤¸¤á¥³¡¼¥¹¤¬·è¤á¤é¤ì¤Æ¤¤¤ë¤¿¤á¤½¤ÎÅÔÅÙľ¿Ê¤µ¤»¤¿¤ê¤·¤Æ¤«¤é¥é¥¤¥ó¥È¥ì¡¼¥¹¤Ë¤·¤Æ¤¤¤ë¡£¤½¤Î¤¿¤á¥µ¥Ö¥ë¡¼¥Á¥ó¤Î¤â¤Î¤È¤Ï°ã¤¦¥Þ¥¯¥í¤òÍѰդ·¤¿¡£
*È¿¾ÊÅÀ¤È´¶ÁÛ [#e52ae42f]
ËÜÂμ«ÂΤδ°À®¤â¼ã´³¼ê´Ö¤¬¤«¤«¤Ã¤¿¤¿¤á¡¢¼ø¶È½ªÎ»¸å¤â»Ä¤Ã¤Æ¥×¥í¥°¥é¥à¤òºî¤Ã¤¿¡£¤Þ¤¿¥é¥¤¥ó¥È¥ì¡¼¥¹¤¬¤¦¤Þ¤¯¤¤¤«¤Ê¤¯¤Æ²¿²ó¤â¿ôÃͤò¤¤¤¸¤Ã¤¿¤ê¤Î·«¤êÊÖ¤·¤Ç¤È¤Æ¤âÂçÊѤÀ¤Ã¤¿¡£
&br;¤±¤ì¤É¤âËÜÈ֤ǤÁ¤ã¤ó¤Èư¤¤¤Æ¥´¡¼¥ë¤â¤Ç¤¤¿¤È¤¤Ï¤È¤Æ¤â´ò¤·¤¯¤Æ´¶Æ°¤·¤¿¡£
&br;º£²ó¤ÎÈ¿¾ÊÅÀ¤Ï¥×¥í¥°¥é¥à¤¬Â礤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿¤³¤È¤Ç¤¢¤ë¡£¼¡²ó¤¬ºÇ¸å¤Ê¤Î¤Çº£²ó¤Î¤³¤È¤òÀ¸¤«¤·¤Æ´èÄ¥¤ê¤¿¤¤¤È»×¤¦¡£
¥Ú¡¼¥¸Ì¾: