• 沒有找到結果。

精確轉向、精確走曲線

if (dist < objCm) { pwr = (-1)*pwr;

} }

err = nMotorEncoder[motorB] - nMotorEncoder[motorC];

motor[motorB] = pwr* (7500.0/nImmediateBatteryLevel) - 2*err;

motor[motorC] = pwr* (7500.0/nImmediateBatteryLevel) + 2*err;

}

front2Wall(100, 30);

PlaySound(soundBeepBeep);

//wait1Msec(3000);

//awayWall(90, 30); 步及修正降低至最少,以爭取時間。我們以下方motorSorting.c 為馬達作配對,尋求最 佳組合。

task main() {

int err;

// reset tachometers

nMotorEncoder[motorB] = nMotorEncoder[motorC] = 0;

// start motors

motor[motorB] = motor[motorC] = 100;

while(nMotorEncoder[motorB] < 10000) { // do nothing, just wait

}

// after motorB reached 10000 degree, stop both motors motor[motorB] = motor[motorC] = 0;

// show the degree of two motors, and the difference

nxtDisplayBigTextLine(0, "%d", nMotorEncoder[motorB]);

nxtDisplayBigTextLine(2, "%d", nMotorEncoder[motorC]);

int err = nMotorEncoder[motorB] - nMotorEncoder[motorC];

nxtDisplayBigTextLine(6, "%d", err);

wait1Msec(5000);

}

robot 精確動作控制理論: 馬達轉角 vs 車身轉角

r1 w

水平位移=

θ

cos

θ

// robotMotionControl.c //

const float tireDiameter=5.6*97.2/100; // cm, with minor calibration const float wheelDist=20*0.8*366/360; // 20 Lego units

float kSync=2.0; // sensibility for motors BC to sync, the bigger, more sinsible. 1--5

float mvRef = 7700.0; // battery greater than 7.5V will keep motor same speed.

int pUp=50; // power init at ramp up int upDeg=90; // ramp up degree

int pDown=40; // final power at ramp down

int downDeg=180; // degree before target to ramp down

int nSpeedB, nSpeedC;

bool bMotorStalled=false; // flag used to detect if motors all stalled.

task stallMonitor() {

int nStallCount;

int nLastEncoderB, nLastEncoderC;

bMotorStalled=false;

nStallCount = 0;

while (true) {

nLastEncoderB = nMotorEncoder[motorB];

nLastEncoderC = nMotorEncoder[motorC];

wait1Msec(100);

nSpeedB = nMotorEncoder[motorB] - nLastEncoderB;

ta

r

(n

nSpeedC = nMotorEncoder[motorC] - nLastEncoderC;

if ( (abs(nSpeedB)<10) && (abs(nSpeedC)<10) ) { long enc; // convert cm to motor encoder degree

int fr; // follow ratio, -100 --- 100 tMotor master, follow;

void rightCurveFwdCm(int p, int curve, int cm) // right curvely forward n cm with stall check // curve: curvely degree, 0 --- 100

{

master=motorB; follow=motorC;

fr = 100 - 2*curve; //scale curve:0 --- 100 to fr:100 --- -100 enc = (float)cm*360/PI/tireDiameter;

nMotorEncoder[master]=nMotorEncoder[follow]=0;

StartTask(stallMonitor);

while(nMotorEncoder[master]<enc && !bMotorStalled) { int err;

// --- Ramp up, Ramp down --- int pwr;

if ((enc - nMotorEncoder[master]) < downDeg) {

pw = (p-pDown)*(enc-nMotorEncoder[master])/downDeg + pDown;

} else {

if MotorEncoder[master] < upDeg) {

r pwr = pwr * mvRef/nImmediateBatteryLevel;

if (pwr>100) pwr=100;

if (fr>=0) {

err = nMotorEncoder[master]*fr/100 - nMotorEncoder[follow];

motor[master] = pwr - kSync*err;

motor[follow] = pwr*fr/100 + kSync*err;

} else {

err = -(nMotorEncoder[master]*fr/100 - nMotorEncoder[follow]);

motor[master] = pwr - kSync*err;

motor[follow] = pwr*fr/100 - kSync*err;

} }

motor[master]=motor[follow]=0;

StopTask(stallMonitor);

}

第4章 研究結果探討

2009 工業機器人競賽

這是由國科會指導,屏東科技大學主辦的活動,比賽分兩組,A 組:國中小學生;B 組:

高中職以上到社會人士都可以參加。但可能限於人力,參賽隊伍總數限60 隊(或各組 30 隊)。

2009 年 1 月舉辦的「2009 工業機器人競賽」,本團隊參賽,競賽題目是與「自動化倉儲 管理」相關的「推高機搬運賽」,比賽場地如圖4-1 所示,本團隊不但事前自製比賽場 地所需的道具,為求臨場逼真度,比賽前一天還特地親往屏東科技大學的比賽場地實地 測試。

這一屆的題目其實很困難,必須把9 個「貨物」由「卸貨區」搬運到「存貨區」,每個 貨物都重達160 公克,而且緊緊相貼,要把它抽離卸貨區都不容易,還好我們祭出「反 向取貨」的策略,與其他隊伍不同的取貨順序,我們從另一端單邊不緊貼的貨物先搬起 就容易多了。

而且搬運比賽時間只有兩分鐘,「卸貨區」到「存貨區」的距離是234 公分,以機器人 移動的速度,兩分鐘只能來回4、5 趟,我們聰明的隊員就有人想到:為什麼不一次搬 兩個?後來我們的機構設計當然是一趟能夠搬兩個貨物的堆高機啦!

更困難的是要用什麼感測器?還有操控程式要怎麼寫?機器人接觸4 面固定黑牆即扣 分,我們評估過所有的感測器:光感、色感、碰觸、聲感、超音波、羅盤等穩定度都不 高,但我們選擇超音波來做定位,搭配馬達內的「角度感測器」,藉由及馬達的轉角來 計算所需行走的距離,以及所需旋轉的角度,順利完成競賽。

一如預期,我們團隊包辦前四名,圖4-1 展示堆高機機器人及其需搬運之貨物。

圖4-1 2009 工業機器人競賽場地

圖4-2 堆高機機器人及獎杯獎牌

第5章 結論與未來研究方向

機器人這個科技領域尚在發展之中,很多國家甚至將它視為未來的明星產業。雖然 機器人沒有明確的定義,且很難說機器人能做什麼、不能做什麼,以教育界的立場,我 們由教育與學習的角度出發,LEGO Mindstorms NXT 是相對價廉的入門學習工具,其 多樣、可重複使用、親和的程式等特性是其他套件所不及的。藉由參與競賽,因為目標 明確,透過過程中必然發生且重複的發現問題/解決問題階段,學習的成效必然加速,

而且,選手間的競爭、觀摩、模仿、與創新必然也會擴大學習範疇。

本研究利用樂高公司所出的NXT Mindstorm 作為研究的工具,利用其感知元件實際 產生之不可預測結果,並透過程式的過濾及修正而達其穩定及精確的感知判斷,來提升 機器人相關穩定精確的感知數據,進而完成規劃中的搬運作業。

一如預期,我們團隊包辦前四名,獲得不錯的成果來印證研究之方法,但尚未將整 個搬運作業完成,故於規定時間內規劃完成整個作業,是為未來更進一步之研究方向。

參考文獻

[1] 機器人世界情報網 http://www.robotworld.org.tw/index.htm

[2] 機器人世界情報網 產業訊息 http://www.robotworld.org.tw/index.htm?pid=9 [3] 精密機械研發中心,機器人白皮書http://www.robotworld.org.tw/index.htm?pid=24 [4] 精密機械研發中心,機器人白皮書http://www.robotworld.org.tw/index.htm?pid=24 [5] 精密機械研發中心,機器人白皮書http://www.robotworld.org.tw/index.htm?pid=24 [6] 精密機械研發中心,機器人白皮書http://www.robotworld.org.tw/index.htm?pid=24 [7] Lee, Dai Gil (2005). Axiomatic Design and Fabrication of Composite Structures. Oxford

University Press. ISBN 0195178777. Retrieved on 2007-10-22

[8] Definition of a robot (PDF). Dansk Robot Forening. Retrieved on 2007-09-10.

[9] Harris, Tom. How Robots Work. How Stuff Works. Retrieved on 2007-09-10.

[10] World Robotics (2007-10-29). "Robots Today and Tomorrow: IFR Presents the 2007 World Robotics Statistics Survey". Press release. Retrieved on 2007-12-14.

[11] iRobot Corporation, http://www.irobot.com/

[12] Intuitive Surgical

Inc., http://www.intuitivesurgical.com/products/davinci_surgicalsystem/index.aspx

int8.htm [13] NASA's Mars Exploration Program, http://marsrover.nasa.gov/home/index.html

[14] 自由時報譯自法新社,http://www.libertytimes.com.tw/2008/new/feb/28/today-int4.htm.

Retrieved on 2008-2-28.

[15] 自由時報取自

ITmedia,

http://www.libertytimes.com.tw/2008/new/feb/13/today-[16] Dick Swan, Programming Solutions for the LEGO Mindstorms NXT-Which approach is best for you?, http://www.botmag.com/articles/10-31-07_NXT.shtml.

[17] The Center for Engineering and Educational Outreach, http://ceeo.tufts.edu/

[18] NI LabVIEW, http://www.ni.com/labview/

[19] LEGO MINDSTORMS NXT Hardware Developer Kit

[20] Performance Testing NXT’s Ultrasonic Range Finder, http://tir38.com/archives/137

相關文件