[[2019a/Member]] *²ÝÂꣲ [#a5b9a302] ²¼¤Î¿Þ¤Î¤è¤¦¤Ê¥³¡¼¥¹¤ò³Æ¥Á¡¼¥à¤ÇºîÀ®¤·¡¢¡Ö¥ß¥Ã¥·¥ç¥ó¡×¤ò¿ë¹Ô¤¹¤ë¤¿¤á¤Î¥í¥Ü¥Ã¥È¤òºîÀ®¤»¤è¡£ http://yakushi.shinshu-u.ac.jp/robotics/?plugin=attach&refer=2019a%2FMission2&openfile=2019a-mission2.png AÃÏÅÀ¤«¤é½Ðȯ ¢ª M ¢ª K(ľ¿Ê) ¢ª L(¥Ô¥ó¥Ý¥ó¶Ì¤ò¤Ä¤«¤à) ¢ª K(±¦ÀÞ) ¢ª J(°ì»þÄä»ß¤Î¸å¡¢º¸ÀÞ) ¢ª I(ľ¿Ê) ¢ª H(ľ¿Ê) ¢ª G(º¸ÀÞ) ¢ª F ¢ª E ¢ª D(°ì»þÄä»ß¤Î¸å¡¢Ä¾¿Ê) ¢ª C(ľ¿Ê) ¢ª B(°ì»þÄä»ß) ¢ª ¥·¥å¡¼¥È¢ª AÃÏÅÀ¤ËÆþ¤ë(¥´¡¼¥ë) »ä¤Ï¾åµ¤Î¥³¡¼¥¹¤Ç¥í¥Ü¥Ã¥È¤òư¤«¤·¤Ê¤¬¤é¡¤¥Ô¥ó¥Ý¥ó¶Ì¤ò²ó¼ý¤·¡¢¤½¤ì¤ò¥´¡¼¥ë¤Þ¤Ç±¿¤Ó¤Þ¤·¤¿¡£ *¥í¥Ü¥Ã¥È¤Î¹½Â¤ [#ae476dc8] ¥í¥Ü¥Ã¥È¤òºî¤ë¾å¤Ç¤³µ¤¤òÉÕ¤±¤¿¤³¤È¤Ï¾®²ó¤ê¤¬Íø¤¯¤È¤¤¤¦ÅÀ¤Ç¤¹¡¥ ¥í¥Ü¥Ã¥È¤¬Â礤¯¤Ê¤ê¤¹¤®¤Æ¸÷¥»¥ó¥µ¡¼¤È¥¿¥¤¥ä¤Îµ÷Î¥¤¬Î¥¤ì¤¹¤®¤Æ¤·¤Þ¤Ã¤¿¤é¼´¤¬¤Ö¤ì¤Æ¤·¤Þ¤¤¥×¥í¥°¥é¥à¤¬ÁÛÄꤷ¤Æ¤¤¤¿¤è¤¦¤Ëư¤«¤Ê¤Ã¤Æ¤·¤Þ¤¤¤Þ¤¹¡¥ ¤Þ¤¿¡¤»ä¤¿¤Á¤Ï¥Ô¥ó¥Ý¥ó¶Ì¤ò±¿¤Ö¤¿¤á¤ÎÊýË¡¤È¤·¤Æ¥¢¡¼¥à¤ò¼è¤êÆþ¤ì¤Þ¤·¤¿¡¥ ¥¢¡¼¥à¤ò¾å¤²²¼¤²¤¹¤ë¤³¤È¤Ç¥Ô¥ó¥Ý¥ó¶Ì¤ò°Üư¤µ¤»¤ë¤Î¤ËÀ®¸ù¤·¤Þ¤·¤¿¡¥ Á´ÂÎÁü¤Ï°Ê²¼¤Î¼Ì¿¿¤ÎÄ̤ê¤Ç¤¹¡¥ &ref(2019a/Member/Asahi/Mission2/IMG_1785.jpg,50%,¡µ¡¹½); *¥×¥í¥°¥é¥à¤ÎÀâÌÀ [#c41805fa] **ÄêµÁ¤·¤¿¥×¥í¥°¥é¥à [#rba811eb] ²¿²ó¤âƱ¤¸¥×¥í¥°¥é¥à¤ò½ñ¤¯¤³¤È¤Ï̵Â̤Ǥ¢¤ë¤¿¤áÄêµÁ¤·¤Þ¤·¤¿¡¥ #define black 30 #define white 50 #define speedH 30 #define speedL 10 #define mae OnFwd(OUT_BC,speedH);//ľ¿Ê #define turnRRR OnFwd(OUT_C,speedH);OnRev(OUT_B,speedH);//Èù¡¹±¦Àû²ó #define turnLLL OnFwd(OUT_B,speedH);OnRev(OUT_C,speedH);//Èù¡¹º¸Àû²ó #define turnRR OnFwd(OUT_C,speedH);Off(OUT_B);//Èù±¦Àû²ó #define turnLL OnFwd(OUT_B,speedH);Off(OUT_C);//Èùº¸Àû²ó #define turnR OnFwd(OUT_C,speedH);OnFwd(OUT_B,speedL);//±¦Àû²ó #define turnL OnFwd(OUT_B,speedH);OnFwd(OUT_C,speedL);//º¸Àû²ó #define step 1 #define jikan 100 #define teishi Off(OUT_BC);Wait(300) **¥µ¥Ö¥ë¡¼¥Á¥ó [#s20991b8] ¥é¥¤¥ó¥È¥ì¡¼¥¹¤ä¸òº¹ÅÀ¤Ç»ß¤Þ¤Ã¤¿¸å¤Ëľ¿Ê¤¹¤ë¤¿¤á¤Î¥×¥í¥°¥é¥à¤Ê¤É¤Ï¾å¤Î¤è¤¦¤ËÄêµÁ¤Ç¤¤Ê¤¤¤¿¤á¥µ¥Ö¥ë¡¼¥Á¥ó¤È¤·¤ÆÄêµÁ¤·¤Þ¤·¤¿¡¥ ***¥é¥¤¥ó¥È¥ì¡¼¥¹ [#q5d05bf3] ¥é¥¤¥ó¥È¥ì¡¼¥¹¤Ï£´¤ÄÍѰդ·¤Þ¤·¤¿¡¥¤½¤ì¤Ïľ¿Ê¤¹¤ë¤È¤¤Îº¸Â¦¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹¡¤Ä¾¿Ê¤¹¤ë¤È¤¤Î±¦Â¦¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹¡¤¥«¡¼¥Ö¤òÅϤë»þ¤Îº¸Â¦¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹¡¤¥«¡¼¥Ö¤òÅϤë»þ¤Î±¦Â¦¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹¤Ç¤¹¡¥¤Þ¤¿¤³¤é¤é¤ÏÁ´¤Æ¸òº¹ÅÀ¤Ç»ß¤Þ¤ë¤è¤¦¤ËÀßÄꤷ¤Æ¤¤¤Þ¤¹¡¥ ¡¡¤½¤ì¤ò°Ê²¼¤ËºÜ¤»¤Þ¤¹¡¥ ¡¡¸òº¹ÅÀ¤Ç»ß¤Þ¤ê¡¤Ä¾¿Ê¤¹¤ë¤È¤¤Îº¸Â¦¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹ ¸÷¥»¥ó¥µ¡¼¤¬»ØÄꤷ¤¿»þ´Ö°Ê¾å¡¤¹õ¤È¬Äꤷ¤¿¤é»ß¤Þ¤ë¤è¤¦¤Ë¥×¥í¥°¥é¥à¤µ¤ì¤Æ¤¤¤ë¡¥ ¤³¤ì¤¬¸òº¹ÅÀ¤Ç»ß¤Þ¤ë¤Ç»ß¤Þ¤ë¤¿¤á¤Î¥×¥í¥°¥é¥à¤Ç¤¢¤ë¡¥ void linetraceSL()//¸òº¹ÅÀ¤Ç»ß¤Þ¤ë { long t0=0,t_black=0,t_max=jikan; t0=CurrentTick();//t0¤Ï¸½ºß¤Î»þ´Ö while(t_black<t_max){//t_black¤¬t_max¤òͤ¨¤ë¤Þ¤Ç³¤±¤ë if(SENSOR_3>white){//¤â¤·¸÷¥»¥ó¥µ¡¼¤ÇÇò¤¬¤¬Â¬Äꤵ¤ì¤ë¤È turnRR; } else if(SENSOR_3>white-5){//¤â¤·¸÷¥»¥ó¥µ¡¼¤ÇÇò-5¤¬Â¬Äꤵ¤ì¤ë¤È turnR; } else if(SENSOR_3>black+5){//¤â¤·¸÷¥»¥ó¥µ¡¼¤Ç¹õ+5¤¬Â¬Äꤵ¤ì¤ë¤È mae; } else if(SENSOR_3>black){//¤â¤·¸÷¥»¥ó¥µ¡¼¤Ç¹õ¤¬Â¬Äꤵ¤ì¤ë¤È turnL; } else{ turnLL; t0=CurrentTick();//t0¤Ï¸½ºß¤Î»þ´Ö until((SENSOR_3<black+5)&&(SENSOR_3>black));//¹õ+5¤«¹õ¤Ë¤Ê¤ë¤Þ¤Ç t_black=CurrentTick()-t0; } Wait(step); } } ¸òº¹ÅÀ¤Ç»ß¤Þ¤ê¡¤Ä¾¿Ê¤¹¤ë¤È¤¤Î±¦Â¦¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹ void linetraceSR()//¸òº¹ÅÀ¤Ç»ß¤Þ¤ë { long t0=0,t_black=0,t_max=jikan; t0=CurrentTick();//t0¤Ï¸½ºß¤Î»þ´Ö while(t_black<t_max){//t_black¤¬t_max¤òͤ¨¤ë¤Þ¤Ç³¤±¤ë if(SENSOR_3>white){//¤â¤·¸÷¥»¥ó¥µ¡¼¤ÇÇò¤¬¤¬Â¬Äꤵ¤ì¤ë¤È turnLL; } else if(SENSOR_3>white-5){//¤â¤·¸÷¥»¥ó¥µ¡¼¤ÇÇò-5¤¬Â¬Äꤵ¤ì¤ë¤È turnL; } else if(SENSOR_3>black+5){//¤â¤·¸÷¥»¥ó¥µ¡¼¤Ç¹õ+5¤¬Â¬Äꤵ¤ì¤ë¤È mae; } else if(SENSOR_3>black){//¤â¤·¸÷¥»¥ó¥µ¡¼¤Ç¹õ¤¬Â¬Äꤵ¤ì¤ë¤È turnR; } else{ turnRR; t0=CurrentTick();//t0¤Ï¸½ºß¤Î»þ´Ö until((SENSOR_3<black+5)&&(SENSOR_3>black));//¹õ+5¤«¹õ¤Ë¤Ê¤ë¤Þ¤Ç t_black=CurrentTick()-t0; } Wait(step); } } ¸òº¹ÅÀ¤Ç»ß¤Þ¤ê¡¤¥«¡¼¥Ö¤òÅϤë»þ¤Îº¸Â¦¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹ void linetraceCL()//¸òº¹ÅÀ¤Ç»ß¤Þ¤ë { long t0=0,t_black=0,t_max=jikan; t0=CurrentTick();//t0¤Ï¸½ºß¤Î»þ´Ö while(t_black<t_max){//t_black¤¬t_max¤òͤ¨¤ë¤Þ¤Ç³¤±¤ë if(SENSOR_3>white){//¤â¤·¸÷¥»¥ó¥µ¡¼¤ÇÇò¤¬¤¬Â¬Äꤵ¤ì¤ë¤È turnRRR; } else if(SENSOR_3>white-5){//¤â¤·¸÷¥»¥ó¥µ¡¼¤ÇÇò-5¤¬Â¬Äꤵ¤ì¤ë¤È turnRR; } else if(SENSOR_3>black+5){//¤â¤·¸÷¥»¥ó¥µ¡¼¤Ç¹õ+5¤¬Â¬Äꤵ¤ì¤ë¤È mae; } else if(SENSOR_3>black){//¤â¤·¸÷¥»¥ó¥µ¡¼¤Ç¹õ¤¬Â¬Äꤵ¤ì¤ë¤È turnLL; } else{ turnLLL; t0=CurrentTick();//t0¤Ï¸½ºß¤Î»þ´Ö until((SENSOR_3<black+5)&&(SENSOR_3>black));//¹õ+5¤«¹õ¤Ë¤Ê¤ë¤Þ¤Ç t_black=CurrentTick()-t0; } Wait(step); } } ¸òº¹ÅÀ¤Ç»ß¤Þ¤ê¡¤¥«¡¼¥Ö¤òÅϤë»þ¤Î±¦Â¦¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹ void linetraceCR()//¸òº¹ÅÀ¤Ç»ß¤Þ¤ë { long t0=0,t_black=0,t_max=jikan; t0=CurrentTick();//t0¤Ï¸½ºß¤Î»þ´Ö while(t_black<t_max){//t_black¤¬t_max¤òͤ¨¤ë¤Þ¤Ç³¤±¤ë if(SENSOR_3>white){ turnLL; } else if(SENSOR_3>white-5){//¤â¤·¸÷¥»¥ó¥µ¡¼¤ÇÇò-5¤¬Â¬Äꤵ¤ì¤ë¤È turnL; } else if(SENSOR_3>black+5){//¤â¤·¸÷¥»¥ó¥µ¡¼¤Ç¹õ+5¤¬Â¬Äꤵ¤ì¤ë¤È mae; } else if(SENSOR_3>black){//¤â¤·¸÷¥»¥ó¥µ¡¼¤Ç¹õ¤¬Â¬Äꤵ¤ì¤ë¤È turnR; } else{ turnRR; t0=CurrentTick();//t0¤Ï¸½ºß¤Î»þ´Ö until((SENSOR_3<black+5)&&(SENSOR_3>black));//¹õ+5¤«¹õ¤Ë¤Ê¤ë¤Þ¤Ç t_black=CurrentTick()-t0; } Wait(step); } } ***¸òº¹ÅÀ¤Çľ¿Ê¤¹¤ë¥×¥í¥°¥é¥à [#kb17e0b6] ¤Þ¤º¡¤¸÷¥»¥ó¥µ¡¼¤¬Çò-5¤òͤ¨¤ë¤Þ¤Ç¤Þ¤Ã¤¹¤°¿Ê¤ß¡¤¼¡¤Ë¸÷¥»¥ó¥µ¡¼¤¬¸÷¥»¥ó¥µ¡¼¤¬¹õ+5¤òͤ¨¤ë¤Þ¤Ç±¦¤Ë¶Ê¤¬¤ë¡¥¤³¤ì¤¬¸òº¹ÅÀ¤Çľ¿Ê¤¹¤ë¥×¥í¥°¥é¥à¤Ç¤¢¤ë¡¥ void crossline()//¸òº¹ÅÀ¤òÅϤë { mae; until(SENSOR_3>white-5);//¸÷¥»¥ó¥µ¡¼¤¬Çò-5¤òͤ¨¤ë¤Þ¤Ç turnR until(SENSOR_3>black+5);//¸÷¥»¥ó¥µ¡¼¤¬¹õ+5¤òͤ¨¤ë¤Þ¤Ç } ***±¦¤Ë¶Ê¤¬¤ë¥×¥í¥°¥é¥à [#e1ec5902] void Rcurve()//±¦¤Ë¶Ê¤¬¤ë { turnRRR; until(SENSOR_3>white-5);//¸÷¥»¥ó¥µ¡¼¤¬Çò-5¤òͤ¨¤ë¤Þ¤Ç } ***º¸¤Ë¶Ê¤¬¤ë¥×¥í¥°¥é¥à [#q94d9624] void Lcurve()//º¸¤Ë¶Ê¤¬¤ë { turnLLL until(SENSOR_3>white);//¸÷¥»¥ó¥µ¡¼¤¬Çò¤òͤ¨¤ë¤Þ¤Ç } ***¥í¥Ü¥Ã¥È¤Î¸þ¤¤òÊѤ¨¤ë¥×¥í¥°¥é¥à [#y70b7bfe] void kaiten()//¥í¥Ü¥Ã¥È¤ò180Åٲ󞤵¤»¤ë { mae; Wait(900) OnFwd(OUT_B,20);OnRev(OUT_C,10); until(SENSOR_3<black+5); } **¥á¥¤¥ó¥×¥í¥°¥é¥à [#td3fc862] ¥á¥¤¥ó¥×¥í¥°¥é¥à¤Ï¡¢ÄêµÁ¤·¤¿¤â¤Î¤òÁȤ߹ç¤ï¤»¤Þ¤¹¡¥ task main() { SetSensorLight(S3); linetraceCL();//M¢ªK crossline();//¸òº¹ÅÀ¤òÅϤë OnFwd(OUT_BC,30);Wait(2900);Off(OUT_BC);//K¢ªL OnFwd(OUT_A,30);Wait(1000);Off(OUT_A);//¥¢¡¼¥à¤ò²¼¤²¤Æ¥Ô¥ó¥Ý¥ó¶Ì¤ò¼è¤ë kaiten();//¥í¥Ü¥Ã¥È¤Î¸þ¤¤òÊѤ¨¤ë linetraceSR();L¢ªK Rcurve();//±¦¤Ë¶Ê¤¬¤ë linetreceSL();//K¢ªJ ¡¡¡¡teishi;//°ì»þÄä»ß Lcurve();//º¸¤Ë¶Ê¤¬¤ë linetraceCL();//J¢ªI croseline();//¸òº¹ÅÀ¤òÅϤë linetraceCL();//J¢ªH croseline();//¸òº¹ÅÀ¤òÅϤë linetraceCL();//H¢ªG Lcurve();//º¸¤Ë¶Ê¤¬¤ë linetraceSL();//G¢ªF Lcurve();//º¸¤Ë¶Ê¤¬¤ë linetraceSL();//F¢ªE Lcurve();//º¸¤Ë¶Ê¤¬¤ë linetraceSL();//E¢ªD teishi;//°ì»þÄä»ß crossline();//¸òº¹ÅÀ¤òÅϤë linetraceCR();//D¢ªB teishi;//°ì»þÄä»ß OnRev(OUT_A,30);Wait(1000);Off(OUT_A);//¥¢¡¼¥à¤ò¾å¤²¤Æ¥Ô¥ó¥Ý¥ó¶Ì¤ò½Ð¤¹ } *¤Þ¤È¤á [#b322ee94] º£²ó¤Î¥×¥í¥°¥é¥à¤Ï¥µ¥Ö¥ë¡¼¥Á¥ó¤ò¿¤¯ÍѤ¤¤Þ¤·¤¿¡¥»Ï¤á¤Ï¥é¥¤¥ó¥È¥ì¡¼¥¹¤ò¤¹¤ë¤À¤±¤Ç¤â¥í¥Ü¥Ã¥È¤¬»×¤¦¤è¤¦¤Ëư¤«¤ºÂçÊѶìÏ«¤·¤Þ¤·¤¿¡¥¤·¤«¤·¡¤·ë²Ì¤È¤·¤ÆÇ¼ÆÀ¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¥×¥í¥°¥é¥à¤¬¤Ç¤¤¿¤Î¤ÇÎɤ«¤Ã¤¿¤Ç¤¹¡¥¤¿¤À¡¤¥Ü¡¼¥ë¤ò¼è¤ë¤È¤³¤í¤Ç»ß¤Þ¤ë¤¿¤á¤Î¸úΨŪ¤Ê¥×¥í¥°¥é¥à¤¬»×¤¤¤Ä¤«¤Ê¤«¤Ã¤¿¤Î¤Ç¡¤¼¡¤Ï¤½¤³¤ò²þÎɤ·¤Æ¤¤¤¤¿¤¤¤Ç¤¹¡¥