From e549a08129fb5cee3021340b6c6dda3273d99226 Mon Sep 17 00:00:00 2001 From: kou029w Date: Fri, 21 Mar 2014 06:27:05 +0900 Subject: [PATCH] =?UTF-8?q?=E7=B4=B0=E3=81=8B=E3=81=84=E3=81=A8=E3=81=93?= =?UTF-8?q?=E3=82=8D=E3=81=AE=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hanzo4_1.ino | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/hanzo4_1.ino b/hanzo4_1.ino index 530bde9..e02dfca 100644 --- a/hanzo4_1.ino +++ b/hanzo4_1.ino @@ -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();