#author("2019-11-22T13:51:58+09:00","kurisuke","kurisuke") #author("2019-11-22T13:53:55+09:00","kurisuke","kurisuke") [[2019b/Member]] Ìܼ¡ #contents *²ÝÂê1 [#ldb3275f] ¥Á¡¼¥à¥á¥¤¥È¤Î»÷´é³¨¤ò¼«Æ°¤ÇÉÁ¤¯¥í¥Ü¥Ã¥È¤òÀ½ºî¤»¤è¡£»÷´é³¨¤ÏA4¤Î»æ¤Ë¼ý¤Þ¤ëÂ礤µ¤Ë¤¹¤ë¤³¤È¡£ **º£²ó¤Î¥Ý¥¤¥ó¥È [#s04e08cc] ¥Á¡¼¥à¥á¥¤¥È¤Î´é¤ÎÆÃħ¤Ç¤¢¤ë´Ý´é¤ÈºÙÌܤ¬ºÝΩ¤Ä¤è¤¦¤Ê¥×¥í¥°¥é¥à¤ò½ñ¤±¤ë¤«¤É¤¦¤«¡£ *¥í¥Ü¥Ã¥È¤ÎÀâÌÀ [#s6bb2e6f] **Á´ÂΤι½Â¤ [#e7fe3ca4] Èæ³ÓŪ´Êñ¤Ë¥×¥í¥°¥é¥à¤ò½ñ¤±¤ë¤È¤¤¤¦¤³¤È¤Ç¡¢xyz¼´¤òÍѤ¤¤¿¥í¥Ü¥Ã¥È¤òÀ½ºî¤·¤¿¡£ ²¼¤Î¼Ì¿¿¤¬¥í¥Ü¥Ã¥È¤ÎÁ´ÂΤǤ¢¤ê¡¢ÀÖÀþ¤Î¤è¤¦¤Ëxyz¼´¤ò¤È¤Ã¤¿¡£ &ref(2019b/Member/kurisuke/Mission1/S__4702236_LI.jpg,50%,¥í¥Ü¥Ã¥È¤ÎÁ´ÂοÞ); **¡¥Ú¥ó¤ò½Ä²£¤Ëư¤«¤¹(x¼´y¼´Êý¸þ)µ¡¹½ [#q0249d7e] x¼´y¼´¤Ëư¤«¤¹µ¡¹½¤ÏƱ¤¸¤è¤¦¤ËÀ½ºî¤·¤¿¡£²¼¤Î¼Ì¿¿¤Î¤è¤¦¤Êµ¡¹½¤òºî¤Ã¤¿¡£»ÅÁȤߤȤ·¤Æ¤Ï¡¢µ¡´Ø¼Ö¤Î¼ÖÎØ¤ò»×¤¤É⤫¤Ù¤Æ¤â¤é¤¦¤È¤ï¤«¤ê¤ä¤¹¤È»×¤¦¡£ &ref(2019b/Member/kurisuke/Mission1/S__4702232_LI.jpg,25%,xy¼´¤Îµ¡¹½); **£¥Ú¥ó¤ò¾å¤Ëư¤«¤¹(z¼´Êý¸þ)µ¡¹½ [#m273ff41] ¥Ú¥ó¤Ï²¼¤Î¼Ì¿¿¤Î¤è¤¦¤Ë¼è¤êÉÕ¤±¤¿¡£¤³¤³¤Ç¤Ï¡¢¥Ú¥ó¤È»æ¤Î´Ö¤ÎË໤¤ò¸º¤é¤¹¤¿¤á¤Ë¥Ú¥óÀè¤ò»æ¤¹¤ì¤¹¤ì¤Ë¼è¤êÉÕ¤±¤ë¤³¤È¤ËÃí°Õ¤·¤¿¡£ &ref(2019b/Member/kurisuke/Mission1/S__4702233.jpg,25%,¥Ú¥ó¤Î¼è¤êÉÕ¤±Êý); &ref(2019b/Member/kurisuke/Mission1/S__4702235 (2)_LI.jpg,50%,¥Ú¥ó¤ò¾å¤²²¼¤²¤¹¤ëµ¡¹½); ¥Ú¥ó¤Î¾å¤²²¼¤²¤Î»ÅÁȤߤȤ·¤Æ¤Ï¡¢¥â¡¼¥¿¡¼¤ÇËÀ¤ò¹ß¤í¤¹¤³¤È¤Ç(¡)¥Ú¥ó¤ò¼è¤êÉÕ¤±¤¿¤â¤¦°ì¤Ä¤ÎËÀ¤ò²¡¤·¾å¤²¤Æ°ì½ï¤Ë¥Ú¥ó¤â¾å¤¬¤ë(¢)¤È¤¤¤¦´Êñ¤Ê»ÅÁȤߤˤ·¤¿¡£ *¥×¥í¥°¥é¥à¤ÎÀâÌÀ [#hc0fec57] ¤³¤ì¤¬¡¢º£²ó»ÈÍѤ·¤¿¥×¥í¥°¥é¥à¤Ç¤¹¡£ #define SPEED 10 #define P 40 #define I 40 #define D 90 #define gf(x,y,z) gt(x-log_x,y-log_y,z);log_x=x;log_y=y; //(¹Ô¤Àè¤ÎºÂɸ , ·«¤êÊÖ¤· ¤Î²ó ¿ô) #define pu OnFwd(OUT_A,20);Wait(500);Off(OUT_A); //¥Ú¥ó¤ò¾å¤²¤ë #define pd OnFwd(OUT_A,-SPEED);Wait(300);Off(OUT_A);Wait(600); //¥Ú¥ó¤ò²¼¤²¤ë #define gh gf(0,0,1); //¥Û¡¼¥à¥Ý¥¸¥·¥ç¥ó (0,0) ¤ËÌá¤ë sub gt(float x,float y,float z) //(¹Ô¤Àè¤ÎºÂɸ , ·«¤êÊÖ¤·¤Î²ó¿ô) { const float axis = 100.0; //¼´ const int rep = z; //·«¤êÊÖ¤·²ó¿ô const float rotation = 180.0; //¼´¤òü¤«¤éü¤Þ¤Çư¤«¤¹¤Î¤ËɬÍפʳÑÅÙ const float correction = 0.5; //ÊäÀµ float angle_x = ((rotation/axis)*x)/rep + sign(x)*correction; float angle_y = ((rotation/axis)*y)/rep + sign(y)*correction; repeat(rep) { //RotateMotor(OUT_B,SPEED,angle_x); RotateMotorPID(OUT_B,SPEED,angle_x,P,I,D); //RotateMotor(OUT_C,SPEED,angle_y); RotateMotorPID(OUT_C,SPEED,angle_y,P,I,D); } Wait(400); } task main() { ResetTachoCount(OUT_BC); float log_x = 0; float log_y = 0; //ÎØ³Ô pu; gf(40.0,100.0,2); pd; gf(0.0,50.0,30); gf(30.0,0.0,30); gf(100.0,50.0,30); gf(10.0,100.0,30); pu; //ÌÜ gf(15.0,45.0,2); pd; gf(30.0,45.0,1); pu; gf(50.0,45.0,1); pd; gf(70.0,45.0,1); pu; //É¡ gf(30.0,35.0,2); pd; gf(25.0,25.0,10); gf(35.0,28.0,1); pu; //¸ý gf(15.0,15.0,2); pd; gf(40.0,15.0,2); pu; gh; } ¤³¤ì¤«¤é¡¢¾Ü¤·¤¯¸«¤Æ¤¤¤¯¡£ **¥Ú¥ó¤òư¤«¤¹¥×¥í¥°¥é¥à [#a9aeac64] x¼´y¼´¤ò100Åùʬ¤·¤ÆÆ°¤«¤¹¤³¤È¤Ë¤·¤¿¡£¤½¤·¤Æ¡¢´Ø¿ô¡Èlog¡É¤òÍѤ¤¤ë¤³¤È¤Ë¤è¤Ã¤Æ¡¢¥Ú¥ó¤¬Á°¤Ë¤¤¤¿ºÂɸ¤òµ²±¤¹¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£¤³¤Î¤³¤È¤Ç¡¢°Üư¤·¤¿¤¤ºÂɸ¤ògt¤Î()¤ÎÃæ¤Ë½ñ¤¯¤È¤½¤ÎÅÀ¤Þ¤Ç°Üư¤Ç¤¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£ rep(repeat)¤ò·×»»¤ËÆþ¤ì¤ë¤³¤È¤Ç¼Ð¤á¤ÎÀþ¤ò³¬ÃʤΤ褦¤ËºÙ¤«¤¯½ñ¤±¤ë¤è¤¦¤Ë¤·¤¿¡£¤½¤Î¤³¤È¤Ç¡¢rep¤ÎÃͤòÂ礤¯¤¹¤ë¤³¤È¤ÇľÀþ¤ò³ê¤é¤«¤Ê¶ÊÀþ¤Ë¤¹¤ë¤³¤È¤¬²Äǽ¤Ë¤Ê¤Ã¤¿¡£ ¥â¡¼¥¿¡¼¤¬Æ°¤½Ð¤·¤Æ¥Ú¥ó¤¬°Üư¤¹¤ë¤Þ¤Ç¤Î´Ö¤ò¥×¥í¥°¥é¥àÆâ¤ËÊäÀµ¤òÆþ¤ì¤ë¤³¤È¤Ç¸íº¹¤ò¸º¤é¤·¤¿¡£ #define SPEED 10 #define P 40 #define I 40 #define D 90 #define gf(x,y,z) gt(x-log_x,y-log_y,z);log_x=x;log_y=y; //(¹Ô¤Àè¤ÎºÂɸ , ·«¤êÊÖ¤·¤Î²ó ¿ô) #define gh gf(0,0,1); //¥Û¡¼¥à¥Ý¥¸¥·¥ç¥ó (0,0) ¤ËÌá¤ë sub gt(float x,float y,float z) //(¹Ô¤Àè¤ÎºÂɸ , ·«¤êÊÖ¤·¤Î²ó¿ô) { const float axis = 100.0; //¼´ const int rep = z; //·«¤êÊÖ¤·²ó¿ô const float rotation = 180.0; //¼´¤òü¤«¤éü¤Þ¤Çư¤«¤¹¤Î¤ËɬÍפʳÑÅÙ const float correction = 0.5; //ÊäÀµ float angle_x = ((rotation/axis)*x)/rep + sign(x)*correction; float angle_y = ((rotation/axis)*y)/rep + sign(y)*correction; repeat(rep) { //RotateMotor(OUT_B,SPEED,angle_x); RotateMotorPID(OUT_B,SPEED,angle_x,P,I,D); //RotateMotor(OUT_C,SPEED,angle_y); RotateMotorPID(OUT_C,SPEED,angle_y,P,I,D); } Wait(400); } **¥Ú¥ó¤Î¾å¤²²¼¤²¤ò¹Ô¤¦¥×¥í¥°¥é¥à [#n64bb548] #define pu OnFwd(OUT_A,20);Wait(500);Off(OUT_A); //¥Ú¥ó¤ò¾å¤²¤ë #define pd OnFwd(OUT_A,-SPEED);Wait(300);Off(OUT_A);Wait(600); //¥Ú¥ó¤ò²¼¤²¤ë ²¿²ó¤â»È¤¦¤Î¤Ç¡¢¥Þ¥¯¥í¤ò»ÈÍѤ·¤Æ´Êά²½¤·¤¿¡£ pu: put up pd: put down ¤È¤¤¤¦°ÕÌ£¤Ç¤Ä¤±¤¿¡£ **¹©Éפ·¤¿¥×¥í¥°¥é¥à [#jd8ffa5d] //ÎØ³Ô pu; gf(40.0,100.0,2); pd; gf(0.0,50.0,30); gf(30.0,0.0,30); gf(100.0,50.0,30); gf(10.0,100.0,30); pu; ¤³¤Î¥×¥í¥°¥é¥à¤Ç¤Ï¡¢rep¤ÎÃͤò30¤ÈÂ礤¯¤¹¤ë¤³¤È¤Ç¡¢³ê¤é¤«¤Ê¶ÊÀþ¤òÉÁ¤¡¢¤·¤Ã¤«¤ê¤·¤¿±ß¤Ë¤Ê¤ë¤è¤¦¤ËºÂɸ¤ÎÄ´À°¤ò¤·¤¿¡£ *´°À®¤·¤¿»÷´é³¨ [#m072fd5e] ¤³¤ì¤¬´°À®¤·¤¿»÷´é³¨¤Ç¤¢¤ë(ȯɽ²ñ¤Ç¤Î»÷´é³¨¤è¤ê»î±¿Å¾»þ¤Î¤Û¤¦¤¬¤¦¤Þ¤¯½ñ¤±¤¿¤Î¤Ç¤½¤Á¤é¤òºÜ¤»¤¿)¡£´Ý´é¤ÈºÙÌܤò¤¦¤Þ¤¯É½¸½¤Ç¤¤¿¡£¤·¤«¤·¡¢È±¤ÎÌӤޤǤÏɽ¸½¤¹¤ë¤Î¤¬Æñ¤·¤«¤Ã¤¿¡£ &ref(2019b/Member/kurisuke/Mission1/S__4890653.jpg,35%,´°À®¤·¤¿»÷´é³¨); *²ÝÂê1¤ÎÈ¿¾Ê¤È´¶ÁÛ [#o3317c5d] ½é¤á¤Æ¤Î¥í¥Ü¥Ã¥Èºî¤ê¤ÇǺ¤à¤³¤È¤¬Â¿¡¹¤¢¤Ã¤¿¤¬¡¢¤·¤Ã¤«¤ê¤È´ü¸ÂÆâ¤Ëºî¤ê½ª¤¨¤ë¤³¤È¤¬¤Ç¤¤¿¡£È¿¾ÊÅÀ¤È¤·¤Æ¤Ï¡¢¤É¤¦¤·¤Æ¤â0ÅÙŽ¥180ÅÙÉÕ¶á¤È90ÅÙÉÕ¶á¤Ç¤Ï¥â¡¼¥¿¡¼¤Îư¤¯Â®¤µ¤¬°Û¤Ê¤ê¡¢¤½¤Î¥º¥ì¤ò¹Íθ¤·¤Ê¤¬¤é¥×¥í¥°¥é¥à¤òÁȤà¤Î¤¬ÂçÊѤÀ¤Ã¤¿¡£¸å¤«¤é°ì¿Í¤Î¥Á¡¼¥à¥á¥¤¥È¤¬¡¢¥â¡¼¥¿¡¼¤Î²óž³ÑÅ٤ǥڥó¤òư¤«¤¹¥×¥í¥°¥é¥à¤è¤ê¡¢»°³Ñ´Ø¿ô¤Ç¥×¥í¥°¥é¥à¤ò½ñ¤¤¤¿¤Û¤¦¤¬¤è¤êÀµ³Î¤Ë¥Ú¥ó¤òư¤«¤»¤¿¤Î¤Ç¤Ï¤Ê¤¤¤«¤È¤¤¤¦¹Í¤¨»×¤¤¤Ä¤¤¤¿¤¬¡¢»ä¤âƱ¤¸¹Í¤¨¤Ç¤¢¤ë¡£