2013b/Member/dtb/Mission1
¤ò¥Æ¥ó¥×¥ì¡¼¥È¤Ë¤·¤ÆºîÀ®
[
¥È¥Ã¥×
] [
¿·µ¬
|
°ìÍ÷
|
¸¡º÷
|
ºÇ½ª¹¹¿·
|
¥Ø¥ë¥×
|
¥í¥°¥¤¥ó
]
³«»Ï¹Ô:
index
#contents
*¥í¥Ü¥Ã¥È¤ÎÀâÌÀ [#l0ebd109]
&ref(2013b/Member/dtb/Mission1/mimi.gif,100%,¥í¥Ü¥Ã¥ÈÀâÌÀ);
-¥¿¥Ã¥Á¥»¥ó¥µ¡¼
»äã¤Î¹Í¤¨¤¿¥¿¥Ã¥Á¥»¥ó¥µ¡¼¤Ï·Ú¤¤¶õ¤´Ì¤ËÂФ·¤Æ¤Á¤ã¤ó¤ÈÈ¿±þ¤¹¤ë¤¿¤á¤Ë¡¢¥¿¥Ã¥Á¥»¥ó¥µ¡¼¤ÎÁ°¤Ë¥Ï¥µ¥ß¤ò¤Ä¤±¤ë¤³¤È¤ÇÉÒ´¶¤Ë¤µ¤»¤¿¡£¤³¤Î¥Ï¥µ¥ß¤Ë¤Ï¥â¡¼¥¿¡¼¤Ï¤Ä¤¤¤Æ¤ª¤é¤º¥Ï¥µ¥ß¤Î¤É¤Á¤é¤«ÊÒ°ìÊý¤Ë¶õ¤´Ì¤ò°ú¤Ã³Ý¤±¤ë¤³¤È¤Ç¤É¤«¤¹¤³¤È¤¬¤Ç¤¤ë¡£
-¥Ï¥µ¥ß
¥Ï¥µ¥ß¤Ë¤Ï¥â¡¼¥¿¡¼¤Ï¤Ä¤¤¤Æ¤ª¤é¤º¥Ï¥µ¥ß¤Î¤É¤Á¤é¤«ÊÒ°ìÊý¤Ë¶õ¤´Ì¤ò°ú¤Ã³Ý¤±¤ë¤³¤È¤Ç¤É¤«¤¹¤³¤È¤¬¤Ç¤¤ë¡£
-¸÷¥»¥ó¥µ¡¼
¤Ê¤ë¤Ù¤¯ËÜÂΤ˶á¤Å¤±¤ë¤è¤¦¤Ë¤·¤¿¡£¤½¤Î¤ª¤«¤²¤Ç¤è¤êËÜÂΤ¬¹õ¤¤¥é¥¤¥ó¤òÁö¤Ã¤Æ¤¤¤ë¤«¤Î¤è¤¦¤Ë¤Ê¤Ã¤¿¡£¤·¤«¤·¤½¤ÎÂå½þ¤È¤·¤Æ¥»¥ó¥µ¡¼¼þ¤ê¤ÎÃÏÌ̤¬°Å¤¯¤Ê¤Ã¤Æ¤·¤Þ¤¤¡¢¹õÇò¤ÎȽÄ꤬Æñ¤·¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿¡£
*¥³¡¼¥¹¹¶Î¬ [#k1b5328d]
-¥³¡¼¥¹¤ò£µÊ¬³ä¤¹¤ë¡£¾Ü¤·¤¯¤Ï¿Þ¤è¤ê¡£¤½¤ì¤Ëȼ¤¤¥×¥í¥°¥é¥à¤â¿¤¤¤¯¤¯¤ê¤Ç¸«¤ë¤È5¤Ä¤Î¹½À®¤Ë¤Ê¤Ã¤Æ¤¤¤ë(¥´¡¼¥ë¤Îưºî¤Ï¾Ê¤¯)¡£
&ref(2013b/Member/dtb/Mission1/bk201.gif,100%,·ÐÏ©ÀâÌÀ);
(¤Ê¤ªÁö¤ë½çÈ֤ϡ¢ª¢¢ª£¢ª¤¢ª¥¢ª¥´¡¼¥ë¤Ç¡¢¿á¤½Ð¤·¤ÎÃæ¤Î¿ô»ú¤Ï¸òº¹ÅÀ¤ÎÈÖ¹æ¤Ç¤¢¤ë¡£)
**¸òº¹ÅÀȽÃÇ [#d5bb0210]
¸òº¹ÅÀ£´¤Ä¤È¥´¡¼¥ë(¥³¡¼¥¹¤Î¿Þ¤ò»²¾È)¤Ëº¹¤·³Ý¤«¤ë»þ¤ÎÂçÂΤλþ´Ö¤ò¤Ï¤«¤ë¡£¤½¤³¤Ëº¹¤·³Ý¤«¤Ã¤¿¤é0.01¹ï¤ß¤ÇÇò¹õ¤òȽÃǤ¹¤ë¥×¥í¥°¥é¥à¤Ç¡¢£³Ï¢Â³¤Ç¿¿¤Ã¹õ(¸÷¥»¥ó¥µ¡¼¤ÎÃͤˤ¹¤ë¤È THRESHOLD -2)¤Î¤È¤³¤í¤Ë¤Ê¤Ã¤¿¤é¸òº¹ÅÀ¤ÈȽÃÇ¡£¤Ê¤ª¿¿¤Ã¹õ(¸÷¥»¥ó¥µ¡¼¤ÎÃͤˤ¹¤ë¤È THRESHOLD -2)¤Î¤È¤³¤Ç¤Ï¡Ö¥Ô¥Ã¡×¤È¤¤¤¦²»¤¬ÌĤꡢ0.5ÉÃÂԤĤ褦¤Ë¤·¤ÆÊ¬¤«¤ê¤ä¤¹¤¯¤·¤Æ¤¤¤ë¡£¸òº¹ÅÀ¤òÅϤë»þ¤Î¥×¥í¥°¥é¥à¤Ïcross_line(p,q)¤Çp,q¤Ï¤½¤ì¤¾¤ì±¦¤ËÀû²ó¡¢º¸¤ËÀû²ó¤¹¤ë»þ´Ö¤Î´Ø¿ô¡£
**¶õ¤´Ì¤ò¤É¤«¤¹Æ°ºî [#i05120f7]
£²¤Ä¤Î´Ì¤Î°ÌÃ֤ϥ³¡¼¥¹¤Î¿Þ¤ò»²¾È¡£¤Þ¤º´Ì¤¬ÌܤÎÁ°¤ËÍ褿»þ¤½¤ì¤¬´Ì¤Ç¤¢¤ë¤ÈȽÃǤ¹¤ë¤È¤¤ÎÊýË¡¤Ï¡¢¥¿¥Ã¥Á¥»¥ó¥µ¡¼¤Ç¹Ô¤¦¡£¥¿¥Ã¥Á¥»¥ó¥µ¡¼¤Ï¤Æ¤³¤Î¸¶Íý¤òÍøÍѤ·¤ÆÈ¿±þ¤òÎɤ¯¤·¤Æ¤¤¤ë¡£¤É¤«¤¹ÊýË¡¤Ï¥í¥Ü¥Ã¥È¤Î¥Ï¥µ¥ß¤Ç´Ì¤ò¤Ò¤Ã¤«¤±¤ë¤è¤¦¤Ë¤·¤Æ¤ä¤ë¡£»æ¤«¤é¥í¥Ü¥Ã¥È¤ä´Ì¤¬¤Ï¤ß½Ð¤Æ¤·¤Þ¤¦¡¢´Ì¤¬¥Ï¥µ¥ß¤«¤éÈ´¤±¤Æ¤·¤Þ¤¦¤Ê¤É¤ÎÌäÂ꤬¤¢¤Ã¤¿¤¿¤á¤É¤«¤¹Æ°ºî¤Ï´Ì¤Î°ÌÃÖ¤´¤È¤Ë°ã¤¦¡£
&ref(2013b/Member/dtb/Mission1/k_k_d.gif,60%,¥«¥ó¤Îư¤¤½¤Î£±);
&ref(2013b/Member/dtb/Mission1/kagero.gif,60%,¥«¥ó¤Îư¤¤½¤Î£²);
*¥×¥í¥°¥é¥à [#lcf8f042]
#define THRESHOLD 37
#define set_power_H SetPower(OUT_AC,5);//¶¯¤¤ÎϤòÀßÄê
#define set_power_L Set Power(OUT_AC,1);//¼å¤¤ÎϤòÀßÄê
#define turn_left set_power_L;Off(OUT_A);OnFwd(OUT_C);//º¸²ó¤ê
#define senkai_left set_power_L;OnRev(OUT_A);OnFwd(OUT_C);//º¸Àû²ó
#define turn_right set_power_L;Off(OUT_C);OnFwd(OUT_A);//±¦²ó¤ê
#define senkai_right set_power_L;OnRev(OUT_C);OnFwd(OUT_A);//±¦Àû²ó
#define go_forward set_power_H;OnFwd(OUT_AC);//ľ¿Ê
#define STEP 1//0.001É䴤ȤËÇò¹õ¤òȽÃÇ
#define SAIDAI 3//¸òº¹ÅÀ¤Ëº¹¤·³Ý¤«¤Ã¤¿»þ¡¢£³²ó¿¿¤Ã¹õ¤Ë¤Ê¤Ã¤¿¤é¸òº¹ÅÀ¤ÈȽÃÇ
#define short_break Off(OUT_AC);Wait(80); //¾®µÙ·Æ
#define CROSS_TIME 60 //¸òº¹ÅÀ¤òÅϤë»þ´Ö
#define cross_line(p,q) short_break;senkai_right;Wait(p);senkai_left;Wait(q);go_forward;
Wait(CROSS_TIME);Off(OUT_AC);//¸òº¹ÅÀÅϤë
#define counter3 PlaySound(SOUND_CLICK);Off(OUT_AC);Wait(50);//3²óÌĤë¤È¸òº¹ÅÀ¤ÈȽÃÇ
#define GOOL short_break;go_forward;Wait(50);senkai_left;Wait(210);go_forward;Wait(100);
Off(OUT_AC);//ºÇ¸å¤Î¥´¡¼¥ë¤Î¥×¥í¥°¥é¥à
¤³¤³¤Þ¤Ç¤¬¿ôÃͤä´ðËÜÆ°ºî¤ÎÄêµÁ¡£
sub akikan_1() //1²óÌܤ˴̤ò¤É¤«¤¹¥×¥í¥°¥é¥à
{
if(SENSOR_3==1){
Off(OUT_AC);Wait(60);
turn_right;Wait(510);
go_forward;Wait(45);
senkai_left;Wait(470);
OnRev(OUT_AC);Wait(50);
senkai_right;Wait(150);}
}
sub akikan_2() //2²óÌܤ˴̤ò¤É¤«¤¹¥×¥í¥°¥é¥à
{
if(SENSOR_3==1){
Off(OUT_AC);Wait(60);
turn_right;Wait(1400);
senkai_left;Wait(750);
go_forward;Wait(50);
OnRev(OUT_AC);Wait(50);
senkai_right;Wait(200);}
}
sub line_race() //¸òº¹ÅÀ¤¬¤Ê¤¤¤È¤³¤í¤òÁö¤ë¥×¥í¥°¥é¥à
{
if(SENSOR_2 < THRESHOLD -2){
senkai_left;
}else if(SENSOR_2 <= THRESHOLD -1){
turn_left;
}else if(SENSOR_2 <= THRESHOLD){
go_forward;
}else if(SENSOR_2 < THRESHOLD +2){
turn_right;
}else{senkai_right;}
Wait(STEP);}
}
sub before_cross_line() //¸òº¹ÅÀÉÕ¶á¤òÁö¤ë¥×¥í¥°¥é¥à
{
int nOnline=0;
while (nOnline < SAIDAI){
if(SENSOR_2 < THRESHOLD -2){
counter3;
senkai_left;
nOnline++;
}else{
if(SENSOR_2 <= THRESHOLD -1){
turn_left;
}else if(SENSOR_2 <= THRESHOLD){
go_forward;
}else if(SENSOR_2 < THRESHOLD +2){
turn_right;
}else{senkai_right;}
nOnline=0;
}
Wait(STEP);
}
}
¤³¤³¤Þ¤Ç¤¬¥µ¥Ö¥ë¡¼¥Á¥ó¡£
task main()
{
SetSensor(SENSOR_3,SENSOR_TOUCH);//¥¿¥Ã¥Á¥»¥ó¥µ¡¼¤òÀßÃÖ
SetSensor(SENSOR_2,SENSOR_LIGHT);//¸÷¥»¥ó¥µ¡¼¤òÀßÃÖ
int nCross=0;//¸òº¹ÅÀ¤òÅϤ俲ó¿ô(nCross=5,6¤ÏÎã³°)
int nOnline=0;//¹õ¤òȽÃǤ·¤¿»þ¤Î²ó¿ô
ClearTimer(0);//¥¿¥¤¥Þ¡¼(0)¤ò£°¤ËÀßÄê
while(nCross<6){
¤³¤ì°Ê¹ß¤«¤é¥í¥Ü¥Ã¥È¤Îưºî¤Î¥×¥í¥°¥é¥à¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
if(nCross==0){
while(FastTimer(0)<3000){
line_race();akikan_1();
}
if(FastTimer(0)>=3000){ //¤³¤Î»þ´Ö¤«¤é¸òº¹ÅÀ·Ù²ü
before_cross_line();
cross_line(60,0);
}
PlaySound(SOUND_DOWN);
nCross++;
nOnline=0;
ClearTimer(0);
} //nCross0½ª¤ï¤ê
¤³¤³¤Þ¤Ç¤¬°ì¸ÄÌܤζõ¤´Ì¤ò¤É¤«¤·¡¢°ì²óÌܤθòº¹ÅÀ¤òÅϤë»þ¤Î¥×¥í¥°¥é¥à¡£(¾å¤Î¿Þ¤Î¡¤ËÁêÅö)
else if(nCross==1){
while(FastTimer(0)<1200){
line_race();
}
if(FastTimer(1)>=1200){ //¤³¤Î»þ´Ö¤«¤é¸òº¹ÅÀ·Ù²ü
before_cross_line();
cross_line(0,0);
}
PlaySound(SOUND_DOWN);
nCross++;
nOnline=0;
ClearTimer(0);
} //nCross1½ª¤ï¤ê
¤³¤³¤Þ¤Ç¤¬Æó²óÌܤθòº¹ÅÀ¤òÅϤë¥×¥í¥°¥é¥à¡£(¾å¤Î¿Þ¤Î¢¤ËÁêÅö)
else if(nCross==2){
while(FastTimer(0)<170){
line_race();
}
if(FastTimer(0)>=170){ //¤³¤Î»þ´Ö¤«¤é¸òº¹ÅÀ·Ù²ü
before_cross_line();
cross_line(0,0);
}
PlaySound(SOUND_DOWN);
nCross++;
nOnline=0;
ClearTimer(0);
} //nCross2½ª¤ï¤ê
¤³¤³¤Þ¤Ç¤¬»°²óÌܤθòº¹ÅÀ¤òÅϤë¥×¥í¥°¥é¥à¡£(¾å¤Î¿Þ¤Î£¤ËÁêÅö)
else if(nCross==3){
while(FastTimer(0)<1000){
line_race();
}
if(FastTimer(1)>=1000){ //¤³¤Î»þ´Ö¤«¤é¸òº¹ÅÀ·Ù²ü
before_cross_line();
cross_line(0,20);
}
PlaySound(SOUND_DOWN);
nCross++;
nOnline=0;
ClearTimer(0);
} //nCross3½ª¤ï¤ê
¤³¤³¤Þ¤Ç¤¬»Í²óÌܤθòº¹ÅÀ¤òÅϤë¥×¥í¥°¥é¥à¡£(¾å¤Î¿Þ¤Î¤¤ËÁêÅö)
else if(nCross==4){
while(FastTimer(0)<3500){
line_race();akikan_2();
}
if(FastTimer(0)>=3500){ //¤³¤Î»þ´Ö¤«¤é¸òº¹ÅÀ·Ù²ü
before_cross_line();
}
PlaySound(SOUND_UP);
nCross++;
} //nCross4½ª¤ï¤ê
¤³¤³¤Þ¤Ç¤¬£²¸ÄÌܤζõ¤´Ì¤ò¤É¤«¤·¡¢¥´¡¼¥ë¤¹¤ëľÁ°¤Þ¤Ç¤Î¥×¥í¥°¥é¥à¡£(¾å¤Î¿Þ¤Î¥¤ËÁêÅö)
else{
GOOL;
nCross++;
} //¥´¡¼¥ë
} //while(nCross<6)¤Î½ª¤ï¤ê
} //task main()¤Î½ª¤ï¤ê
*¥×¥í¥°¥é¥à¤ÎÊä [#d7b6111a]
-nCross=5,6¤¬Îã³°¤È¤¤¤¦¤Î¤ÏnCross=5¤Ï¥´¡¼¥ë¤Èǧ¼±¤µ¤»¤ë¤â¤Î¤ÇnCross=6¤Ï¥×¥í¥°¥é¥à¤ò½ª¤ï¤ê¤ò¹ð¤²¤ë¤¿¤á¤Î¤â¤Î¡£¤Ê¤¼Â¾¤Î£´¤Ä¤È¤¯¤Ã¤Ä¤±¤¿¤Î¤«¤È¤¤¤¦¤ÈÊÑ¿ô¤Ï¤Ç¤¤ë¤À¤±¾¯¤Ê¤¯¤·¤¿¤Û¤¦¤¬¡¢¥í¥Ü¥Ã¥È¤Ë¥×¥í¥°¥é¥à¤òÆþ¤ì¤ë¤È¤¤Î»þ´Öû½Ì¤Ë¤Ê¤ê¡¢ÅÅÃӤξÃÌפòËɤ²¤ë¤È»×¤Ã¤¿¤«¤é¡£
-cross_line¤Î¥×¥í¥°¥é¥à¤¬¤½¤ì¤¾¤ì°ã¤¦¤Î¤Ï¸òº¹ÅÀ¤´¤È¤Ë¥í¥Ü¥Ã¥È¤Î¸þ¤¤¬°Û¤Ê¤ê¡¢Ä´À°¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤«¤Ã¤¿¤¿¤á¡£
*È¿¾Ê¤¹¤Ù¤ÅÀ [#eb2a5e59]
+¥Ú¥¢¡¼¤Î¿Í¤È¹ÖµÁ°Ê³°¤Î»þ´Ö¤Ë°ì½ï¤Ë¤ä¤ë¤³¤È¤¬¾¯¤Ê¤¯¡¢¸Ä¿Íºî¶È¤¬Â¿¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿¡£¤â¤Ã¤È¥Ú¥¢¡¼¤Î¿Í¤ÈÏ¢Íí¤ò¤ò¼è¤ê¹ç¤¦¤è¤¦¤Ë¤·¤¿¤¤¡£
+¥í¥Ü¥Ã¥È¤Î¥Ï¥µ¥ß¤Îºî¤ê¤¬¤¢¤Þ¤êÎɤ¯¤Ê¤¯¥×¥í¥°¥é¥à¤Ç²¿¤È¤«¤·¤è¤¦¤È¤·¤¿¤é¥×¥í¥°¥é¥à¤¬Ê£»¨¤Ë¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿¡£¥í¥Ü¥Ã¥È¤Î²þ¤¤Î»þ´Ö¤ò¤â¤Ã¤È¼è¤êÆþ¤ì¤ÐÎɤ«¤Ã¤¿¡£
+¥í¥Ü¥Ã¥È¤Î¥¹¥Ô¡¼¥É¤¬ÃÙ¤¤¡£
½ªÎ»¹Ô:
index
#contents
*¥í¥Ü¥Ã¥È¤ÎÀâÌÀ [#l0ebd109]
&ref(2013b/Member/dtb/Mission1/mimi.gif,100%,¥í¥Ü¥Ã¥ÈÀâÌÀ);
-¥¿¥Ã¥Á¥»¥ó¥µ¡¼
»äã¤Î¹Í¤¨¤¿¥¿¥Ã¥Á¥»¥ó¥µ¡¼¤Ï·Ú¤¤¶õ¤´Ì¤ËÂФ·¤Æ¤Á¤ã¤ó¤ÈÈ¿±þ¤¹¤ë¤¿¤á¤Ë¡¢¥¿¥Ã¥Á¥»¥ó¥µ¡¼¤ÎÁ°¤Ë¥Ï¥µ¥ß¤ò¤Ä¤±¤ë¤³¤È¤ÇÉÒ´¶¤Ë¤µ¤»¤¿¡£¤³¤Î¥Ï¥µ¥ß¤Ë¤Ï¥â¡¼¥¿¡¼¤Ï¤Ä¤¤¤Æ¤ª¤é¤º¥Ï¥µ¥ß¤Î¤É¤Á¤é¤«ÊÒ°ìÊý¤Ë¶õ¤´Ì¤ò°ú¤Ã³Ý¤±¤ë¤³¤È¤Ç¤É¤«¤¹¤³¤È¤¬¤Ç¤¤ë¡£
-¥Ï¥µ¥ß
¥Ï¥µ¥ß¤Ë¤Ï¥â¡¼¥¿¡¼¤Ï¤Ä¤¤¤Æ¤ª¤é¤º¥Ï¥µ¥ß¤Î¤É¤Á¤é¤«ÊÒ°ìÊý¤Ë¶õ¤´Ì¤ò°ú¤Ã³Ý¤±¤ë¤³¤È¤Ç¤É¤«¤¹¤³¤È¤¬¤Ç¤¤ë¡£
-¸÷¥»¥ó¥µ¡¼
¤Ê¤ë¤Ù¤¯ËÜÂΤ˶á¤Å¤±¤ë¤è¤¦¤Ë¤·¤¿¡£¤½¤Î¤ª¤«¤²¤Ç¤è¤êËÜÂΤ¬¹õ¤¤¥é¥¤¥ó¤òÁö¤Ã¤Æ¤¤¤ë¤«¤Î¤è¤¦¤Ë¤Ê¤Ã¤¿¡£¤·¤«¤·¤½¤ÎÂå½þ¤È¤·¤Æ¥»¥ó¥µ¡¼¼þ¤ê¤ÎÃÏÌ̤¬°Å¤¯¤Ê¤Ã¤Æ¤·¤Þ¤¤¡¢¹õÇò¤ÎȽÄ꤬Æñ¤·¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿¡£
*¥³¡¼¥¹¹¶Î¬ [#k1b5328d]
-¥³¡¼¥¹¤ò£µÊ¬³ä¤¹¤ë¡£¾Ü¤·¤¯¤Ï¿Þ¤è¤ê¡£¤½¤ì¤Ëȼ¤¤¥×¥í¥°¥é¥à¤â¿¤¤¤¯¤¯¤ê¤Ç¸«¤ë¤È5¤Ä¤Î¹½À®¤Ë¤Ê¤Ã¤Æ¤¤¤ë(¥´¡¼¥ë¤Îưºî¤Ï¾Ê¤¯)¡£
&ref(2013b/Member/dtb/Mission1/bk201.gif,100%,·ÐÏ©ÀâÌÀ);
(¤Ê¤ªÁö¤ë½çÈ֤ϡ¢ª¢¢ª£¢ª¤¢ª¥¢ª¥´¡¼¥ë¤Ç¡¢¿á¤½Ð¤·¤ÎÃæ¤Î¿ô»ú¤Ï¸òº¹ÅÀ¤ÎÈÖ¹æ¤Ç¤¢¤ë¡£)
**¸òº¹ÅÀȽÃÇ [#d5bb0210]
¸òº¹ÅÀ£´¤Ä¤È¥´¡¼¥ë(¥³¡¼¥¹¤Î¿Þ¤ò»²¾È)¤Ëº¹¤·³Ý¤«¤ë»þ¤ÎÂçÂΤλþ´Ö¤ò¤Ï¤«¤ë¡£¤½¤³¤Ëº¹¤·³Ý¤«¤Ã¤¿¤é0.01¹ï¤ß¤ÇÇò¹õ¤òȽÃǤ¹¤ë¥×¥í¥°¥é¥à¤Ç¡¢£³Ï¢Â³¤Ç¿¿¤Ã¹õ(¸÷¥»¥ó¥µ¡¼¤ÎÃͤˤ¹¤ë¤È THRESHOLD -2)¤Î¤È¤³¤í¤Ë¤Ê¤Ã¤¿¤é¸òº¹ÅÀ¤ÈȽÃÇ¡£¤Ê¤ª¿¿¤Ã¹õ(¸÷¥»¥ó¥µ¡¼¤ÎÃͤˤ¹¤ë¤È THRESHOLD -2)¤Î¤È¤³¤Ç¤Ï¡Ö¥Ô¥Ã¡×¤È¤¤¤¦²»¤¬ÌĤꡢ0.5ÉÃÂԤĤ褦¤Ë¤·¤ÆÊ¬¤«¤ê¤ä¤¹¤¯¤·¤Æ¤¤¤ë¡£¸òº¹ÅÀ¤òÅϤë»þ¤Î¥×¥í¥°¥é¥à¤Ïcross_line(p,q)¤Çp,q¤Ï¤½¤ì¤¾¤ì±¦¤ËÀû²ó¡¢º¸¤ËÀû²ó¤¹¤ë»þ´Ö¤Î´Ø¿ô¡£
**¶õ¤´Ì¤ò¤É¤«¤¹Æ°ºî [#i05120f7]
£²¤Ä¤Î´Ì¤Î°ÌÃ֤ϥ³¡¼¥¹¤Î¿Þ¤ò»²¾È¡£¤Þ¤º´Ì¤¬ÌܤÎÁ°¤ËÍ褿»þ¤½¤ì¤¬´Ì¤Ç¤¢¤ë¤ÈȽÃǤ¹¤ë¤È¤¤ÎÊýË¡¤Ï¡¢¥¿¥Ã¥Á¥»¥ó¥µ¡¼¤Ç¹Ô¤¦¡£¥¿¥Ã¥Á¥»¥ó¥µ¡¼¤Ï¤Æ¤³¤Î¸¶Íý¤òÍøÍѤ·¤ÆÈ¿±þ¤òÎɤ¯¤·¤Æ¤¤¤ë¡£¤É¤«¤¹ÊýË¡¤Ï¥í¥Ü¥Ã¥È¤Î¥Ï¥µ¥ß¤Ç´Ì¤ò¤Ò¤Ã¤«¤±¤ë¤è¤¦¤Ë¤·¤Æ¤ä¤ë¡£»æ¤«¤é¥í¥Ü¥Ã¥È¤ä´Ì¤¬¤Ï¤ß½Ð¤Æ¤·¤Þ¤¦¡¢´Ì¤¬¥Ï¥µ¥ß¤«¤éÈ´¤±¤Æ¤·¤Þ¤¦¤Ê¤É¤ÎÌäÂ꤬¤¢¤Ã¤¿¤¿¤á¤É¤«¤¹Æ°ºî¤Ï´Ì¤Î°ÌÃÖ¤´¤È¤Ë°ã¤¦¡£
&ref(2013b/Member/dtb/Mission1/k_k_d.gif,60%,¥«¥ó¤Îư¤¤½¤Î£±);
&ref(2013b/Member/dtb/Mission1/kagero.gif,60%,¥«¥ó¤Îư¤¤½¤Î£²);
*¥×¥í¥°¥é¥à [#lcf8f042]
#define THRESHOLD 37
#define set_power_H SetPower(OUT_AC,5);//¶¯¤¤ÎϤòÀßÄê
#define set_power_L Set Power(OUT_AC,1);//¼å¤¤ÎϤòÀßÄê
#define turn_left set_power_L;Off(OUT_A);OnFwd(OUT_C);//º¸²ó¤ê
#define senkai_left set_power_L;OnRev(OUT_A);OnFwd(OUT_C);//º¸Àû²ó
#define turn_right set_power_L;Off(OUT_C);OnFwd(OUT_A);//±¦²ó¤ê
#define senkai_right set_power_L;OnRev(OUT_C);OnFwd(OUT_A);//±¦Àû²ó
#define go_forward set_power_H;OnFwd(OUT_AC);//ľ¿Ê
#define STEP 1//0.001É䴤ȤËÇò¹õ¤òȽÃÇ
#define SAIDAI 3//¸òº¹ÅÀ¤Ëº¹¤·³Ý¤«¤Ã¤¿»þ¡¢£³²ó¿¿¤Ã¹õ¤Ë¤Ê¤Ã¤¿¤é¸òº¹ÅÀ¤ÈȽÃÇ
#define short_break Off(OUT_AC);Wait(80); //¾®µÙ·Æ
#define CROSS_TIME 60 //¸òº¹ÅÀ¤òÅϤë»þ´Ö
#define cross_line(p,q) short_break;senkai_right;Wait(p);senkai_left;Wait(q);go_forward;
Wait(CROSS_TIME);Off(OUT_AC);//¸òº¹ÅÀÅϤë
#define counter3 PlaySound(SOUND_CLICK);Off(OUT_AC);Wait(50);//3²óÌĤë¤È¸òº¹ÅÀ¤ÈȽÃÇ
#define GOOL short_break;go_forward;Wait(50);senkai_left;Wait(210);go_forward;Wait(100);
Off(OUT_AC);//ºÇ¸å¤Î¥´¡¼¥ë¤Î¥×¥í¥°¥é¥à
¤³¤³¤Þ¤Ç¤¬¿ôÃͤä´ðËÜÆ°ºî¤ÎÄêµÁ¡£
sub akikan_1() //1²óÌܤ˴̤ò¤É¤«¤¹¥×¥í¥°¥é¥à
{
if(SENSOR_3==1){
Off(OUT_AC);Wait(60);
turn_right;Wait(510);
go_forward;Wait(45);
senkai_left;Wait(470);
OnRev(OUT_AC);Wait(50);
senkai_right;Wait(150);}
}
sub akikan_2() //2²óÌܤ˴̤ò¤É¤«¤¹¥×¥í¥°¥é¥à
{
if(SENSOR_3==1){
Off(OUT_AC);Wait(60);
turn_right;Wait(1400);
senkai_left;Wait(750);
go_forward;Wait(50);
OnRev(OUT_AC);Wait(50);
senkai_right;Wait(200);}
}
sub line_race() //¸òº¹ÅÀ¤¬¤Ê¤¤¤È¤³¤í¤òÁö¤ë¥×¥í¥°¥é¥à
{
if(SENSOR_2 < THRESHOLD -2){
senkai_left;
}else if(SENSOR_2 <= THRESHOLD -1){
turn_left;
}else if(SENSOR_2 <= THRESHOLD){
go_forward;
}else if(SENSOR_2 < THRESHOLD +2){
turn_right;
}else{senkai_right;}
Wait(STEP);}
}
sub before_cross_line() //¸òº¹ÅÀÉÕ¶á¤òÁö¤ë¥×¥í¥°¥é¥à
{
int nOnline=0;
while (nOnline < SAIDAI){
if(SENSOR_2 < THRESHOLD -2){
counter3;
senkai_left;
nOnline++;
}else{
if(SENSOR_2 <= THRESHOLD -1){
turn_left;
}else if(SENSOR_2 <= THRESHOLD){
go_forward;
}else if(SENSOR_2 < THRESHOLD +2){
turn_right;
}else{senkai_right;}
nOnline=0;
}
Wait(STEP);
}
}
¤³¤³¤Þ¤Ç¤¬¥µ¥Ö¥ë¡¼¥Á¥ó¡£
task main()
{
SetSensor(SENSOR_3,SENSOR_TOUCH);//¥¿¥Ã¥Á¥»¥ó¥µ¡¼¤òÀßÃÖ
SetSensor(SENSOR_2,SENSOR_LIGHT);//¸÷¥»¥ó¥µ¡¼¤òÀßÃÖ
int nCross=0;//¸òº¹ÅÀ¤òÅϤ俲ó¿ô(nCross=5,6¤ÏÎã³°)
int nOnline=0;//¹õ¤òȽÃǤ·¤¿»þ¤Î²ó¿ô
ClearTimer(0);//¥¿¥¤¥Þ¡¼(0)¤ò£°¤ËÀßÄê
while(nCross<6){
¤³¤ì°Ê¹ß¤«¤é¥í¥Ü¥Ã¥È¤Îưºî¤Î¥×¥í¥°¥é¥à¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
if(nCross==0){
while(FastTimer(0)<3000){
line_race();akikan_1();
}
if(FastTimer(0)>=3000){ //¤³¤Î»þ´Ö¤«¤é¸òº¹ÅÀ·Ù²ü
before_cross_line();
cross_line(60,0);
}
PlaySound(SOUND_DOWN);
nCross++;
nOnline=0;
ClearTimer(0);
} //nCross0½ª¤ï¤ê
¤³¤³¤Þ¤Ç¤¬°ì¸ÄÌܤζõ¤´Ì¤ò¤É¤«¤·¡¢°ì²óÌܤθòº¹ÅÀ¤òÅϤë»þ¤Î¥×¥í¥°¥é¥à¡£(¾å¤Î¿Þ¤Î¡¤ËÁêÅö)
else if(nCross==1){
while(FastTimer(0)<1200){
line_race();
}
if(FastTimer(1)>=1200){ //¤³¤Î»þ´Ö¤«¤é¸òº¹ÅÀ·Ù²ü
before_cross_line();
cross_line(0,0);
}
PlaySound(SOUND_DOWN);
nCross++;
nOnline=0;
ClearTimer(0);
} //nCross1½ª¤ï¤ê
¤³¤³¤Þ¤Ç¤¬Æó²óÌܤθòº¹ÅÀ¤òÅϤë¥×¥í¥°¥é¥à¡£(¾å¤Î¿Þ¤Î¢¤ËÁêÅö)
else if(nCross==2){
while(FastTimer(0)<170){
line_race();
}
if(FastTimer(0)>=170){ //¤³¤Î»þ´Ö¤«¤é¸òº¹ÅÀ·Ù²ü
before_cross_line();
cross_line(0,0);
}
PlaySound(SOUND_DOWN);
nCross++;
nOnline=0;
ClearTimer(0);
} //nCross2½ª¤ï¤ê
¤³¤³¤Þ¤Ç¤¬»°²óÌܤθòº¹ÅÀ¤òÅϤë¥×¥í¥°¥é¥à¡£(¾å¤Î¿Þ¤Î£¤ËÁêÅö)
else if(nCross==3){
while(FastTimer(0)<1000){
line_race();
}
if(FastTimer(1)>=1000){ //¤³¤Î»þ´Ö¤«¤é¸òº¹ÅÀ·Ù²ü
before_cross_line();
cross_line(0,20);
}
PlaySound(SOUND_DOWN);
nCross++;
nOnline=0;
ClearTimer(0);
} //nCross3½ª¤ï¤ê
¤³¤³¤Þ¤Ç¤¬»Í²óÌܤθòº¹ÅÀ¤òÅϤë¥×¥í¥°¥é¥à¡£(¾å¤Î¿Þ¤Î¤¤ËÁêÅö)
else if(nCross==4){
while(FastTimer(0)<3500){
line_race();akikan_2();
}
if(FastTimer(0)>=3500){ //¤³¤Î»þ´Ö¤«¤é¸òº¹ÅÀ·Ù²ü
before_cross_line();
}
PlaySound(SOUND_UP);
nCross++;
} //nCross4½ª¤ï¤ê
¤³¤³¤Þ¤Ç¤¬£²¸ÄÌܤζõ¤´Ì¤ò¤É¤«¤·¡¢¥´¡¼¥ë¤¹¤ëľÁ°¤Þ¤Ç¤Î¥×¥í¥°¥é¥à¡£(¾å¤Î¿Þ¤Î¥¤ËÁêÅö)
else{
GOOL;
nCross++;
} //¥´¡¼¥ë
} //while(nCross<6)¤Î½ª¤ï¤ê
} //task main()¤Î½ª¤ï¤ê
*¥×¥í¥°¥é¥à¤ÎÊä [#d7b6111a]
-nCross=5,6¤¬Îã³°¤È¤¤¤¦¤Î¤ÏnCross=5¤Ï¥´¡¼¥ë¤Èǧ¼±¤µ¤»¤ë¤â¤Î¤ÇnCross=6¤Ï¥×¥í¥°¥é¥à¤ò½ª¤ï¤ê¤ò¹ð¤²¤ë¤¿¤á¤Î¤â¤Î¡£¤Ê¤¼Â¾¤Î£´¤Ä¤È¤¯¤Ã¤Ä¤±¤¿¤Î¤«¤È¤¤¤¦¤ÈÊÑ¿ô¤Ï¤Ç¤¤ë¤À¤±¾¯¤Ê¤¯¤·¤¿¤Û¤¦¤¬¡¢¥í¥Ü¥Ã¥È¤Ë¥×¥í¥°¥é¥à¤òÆþ¤ì¤ë¤È¤¤Î»þ´Öû½Ì¤Ë¤Ê¤ê¡¢ÅÅÃӤξÃÌפòËɤ²¤ë¤È»×¤Ã¤¿¤«¤é¡£
-cross_line¤Î¥×¥í¥°¥é¥à¤¬¤½¤ì¤¾¤ì°ã¤¦¤Î¤Ï¸òº¹ÅÀ¤´¤È¤Ë¥í¥Ü¥Ã¥È¤Î¸þ¤¤¬°Û¤Ê¤ê¡¢Ä´À°¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤«¤Ã¤¿¤¿¤á¡£
*È¿¾Ê¤¹¤Ù¤ÅÀ [#eb2a5e59]
+¥Ú¥¢¡¼¤Î¿Í¤È¹ÖµÁ°Ê³°¤Î»þ´Ö¤Ë°ì½ï¤Ë¤ä¤ë¤³¤È¤¬¾¯¤Ê¤¯¡¢¸Ä¿Íºî¶È¤¬Â¿¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿¡£¤â¤Ã¤È¥Ú¥¢¡¼¤Î¿Í¤ÈÏ¢Íí¤ò¤ò¼è¤ê¹ç¤¦¤è¤¦¤Ë¤·¤¿¤¤¡£
+¥í¥Ü¥Ã¥È¤Î¥Ï¥µ¥ß¤Îºî¤ê¤¬¤¢¤Þ¤êÎɤ¯¤Ê¤¯¥×¥í¥°¥é¥à¤Ç²¿¤È¤«¤·¤è¤¦¤È¤·¤¿¤é¥×¥í¥°¥é¥à¤¬Ê£»¨¤Ë¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿¡£¥í¥Ü¥Ã¥È¤Î²þ¤¤Î»þ´Ö¤ò¤â¤Ã¤È¼è¤êÆþ¤ì¤ÐÎɤ«¤Ã¤¿¡£
+¥í¥Ü¥Ã¥È¤Î¥¹¥Ô¡¼¥É¤¬ÃÙ¤¤¡£
¥Ú¡¼¥¸Ì¾: