細かいところの調整

This commit is contained in:
Nebel 2014-03-21 06:27:05 +09:00
parent 3b56ac95e7
commit e549a08129

View file

@ -31,15 +31,15 @@ struct target_t{
/**************************************/
/* 動作パラメーター */
unsigned long lapDistance = 28500; //ロータリーエンコーダーのカウント数/周
unsigned long lapDistance = 28550; //ロータリーエンコーダーのカウント数/周
unsigned long turnDistance = 4650; //カーブ中でのカウント数
struct target_t targetA = {{lapDistance/2, lapDistance*0.6 }, 900, { 29, 0}};
struct target_t targetB = {{lapDistance/2, lapDistance*0.75}, 900, {-32, 0}};
struct target_t targetC = {{lapDistance*0.6, lapDistance*0.85}, 900, { 34, 0}};
struct target_t targetD = {{lapDistance*0.75, lapDistance*0.85}, 900, {-42, 0}};
struct target_t targetE = {{1500, 2400 }, 800, { 40, 48}};
struct target_t targetF = {{lapDistance/8, lapDistance/4 }, 800, { 61, 60}};
struct target_t targetE = {{ 500,4000}, 750, { 48, 53}};
struct target_t targetF = {{4000,7000}, 750, { 60, 67}};
int laps = 3; //最大周回数
bool silent = false; //サイレントモード(true:ブザーを鳴らさない)
@ -58,12 +58,12 @@ int errorCountThreshold = 500; //最大読み取りエラー回数(これを超
/* ピンの設定 */
// Servo : SC-1267SG
unsigned int steeringServoCenter = 1815; //us
unsigned int steeringServoCenter = 1808; //us
unsigned int steeringServoMin = (steeringServoCenter-780); //us
unsigned int steeringServoMax = (steeringServoCenter+780); //us
// Servo : SC-0352
unsigned int lanceServoCenter = 1550; //us
unsigned int lanceServoCenter = 1560; //us
unsigned int lanceServoMin = (lanceServoCenter-780); //us
unsigned int lanceServoMax = (lanceServoCenter+780); //us
@ -134,23 +134,23 @@ void trace(){
return;
case 0b01000000:
speed = speedMax*0.3;
deltaSpeed = -150;
angle = -18;
deltaSpeed = -145;
angle = -15;
break;
case 0b01100000:
speed = speedMax*0.5;
deltaSpeed = -100;
angle = -16;
deltaSpeed = -115;
angle = -13;
break;
case 0b00100000:
speed = speedMax*0.6;
deltaSpeed = -50;
angle = -14;
speed = speedMax*0.7;
deltaSpeed = -95;
angle = -11;
break;
case 0b00110000:
speed = speedMax;
deltaSpeed = -25;
angle = -10;
speed = speedMax*0.9;
deltaSpeed = -75;
angle = -9;
break;
case 0b00010000:
speed = speedMax;
@ -212,8 +212,6 @@ void setup(){
//ブザー
startBeep();
/* 3秒停止 */
motorL.mode(STOP);
motorR.mode(STOP);
delay(3000);
/* スタート */
mode = MODE_STRAIGHT;
@ -234,12 +232,13 @@ void run(){
default:
case MODE_STOP: //停止
MsTimer2::stop();
lanceServo.detach();
steeringServo.detach();
motorL.mode(STOP);
motorR.mode(STOP);
while(1){
;
};
}
break;
case MODE_STRAIGHT: //まっすぐ進む
trace();