最終版
This commit is contained in:
parent
f728213817
commit
cd7fe687b8
1 changed files with 12 additions and 12 deletions
24
hanzo4.ino
24
hanzo4.ino
|
@ -8,15 +8,15 @@
|
|||
#include <Servo.h>
|
||||
#include "Motor.h"
|
||||
|
||||
const unsigned long LAP_DISTANCE = 28510; //ロータリーエンコーダーのカウント数/周
|
||||
const unsigned long TURN_DISTANCE = 4700; //カーブ中でのカウント数
|
||||
const unsigned long LAP_DISTANCE = 28500; //ロータリーエンコーダーのカウント数/周
|
||||
const unsigned long TURN_DISTANCE = 4650; //カーブ中でのカウント数
|
||||
|
||||
const int LANCE_ANGLE_E = 45; //度
|
||||
const int LANCE_ANGLE_F = 62; //度
|
||||
const int LANCE_ANGLE_E = 40; //度
|
||||
const int LANCE_ANGLE_F = 61; //度
|
||||
const int LANCE_ANGLE_A = 29; //度
|
||||
const int LANCE_ANGLE_B = -30; //度
|
||||
const int LANCE_ANGLE_C = 32; //度
|
||||
const int LANCE_ANGLE_D = -40; //度
|
||||
const int LANCE_ANGLE_B = -32; //度
|
||||
const int LANCE_ANGLE_C = 34; //度
|
||||
const int LANCE_ANGLE_D = -42; //度
|
||||
|
||||
//const unsigned char SPEED_DEFAULT = 0;
|
||||
const unsigned char SPEED_DEFAULT = 127;
|
||||
|
@ -155,7 +155,7 @@ void trace(){
|
|||
void modeSet(){
|
||||
if(sensor == 0) errorCount++;
|
||||
else errorCount = 0;
|
||||
if(distance > LAP_DISTANCE*5 || errorCount > 5000){
|
||||
if(distance > LAP_DISTANCE*13 || errorCount > 5000){
|
||||
mode = MODE_STOP;
|
||||
return;
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ void modeSet(){
|
|||
modeChangedDistance = distance;
|
||||
if(distance%LAP_DISTANCE < LAP_DISTANCE/2){
|
||||
;
|
||||
}else if(distance%LAP_DISTANCE < LAP_DISTANCE*0.80){
|
||||
}else if(distance%LAP_DISTANCE < LAP_DISTANCE*0.75){
|
||||
mode = MODE_ATTACK_B;
|
||||
}else if(distance%LAP_DISTANCE < LAP_DISTANCE*0.85){
|
||||
mode = MODE_ATTACK_D;
|
||||
|
@ -251,8 +251,8 @@ void loop(){
|
|||
case MODE_ATTACK_E: //平行標的1
|
||||
trace();
|
||||
lance(LANCE_ANGLE_E);
|
||||
if(distance - modeChangedDistance > 1000){ //マーカーから少し進んで、叩く
|
||||
lance(LANCE_ANGLE_E + 5);
|
||||
if(distance - modeChangedDistance > 800){ //マーカーから少し進んで、叩く
|
||||
lance(LANCE_ANGLE_E + 8);
|
||||
mode = MODE_STRAIGHT;
|
||||
}
|
||||
break;
|
||||
|
@ -260,7 +260,7 @@ void loop(){
|
|||
trace();
|
||||
lance(LANCE_ANGLE_F);
|
||||
if(distance - modeChangedDistance > 1000){ //マーカーから少し進んで、叩く
|
||||
lance(LANCE_ANGLE_F + 5);
|
||||
lance(LANCE_ANGLE_F + 8);
|
||||
mode = MODE_STRAIGHT;
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Add table
Reference in a new issue