2023年全國(guó)碩士研究生考試考研英語(yǔ)一試題真題(含答案詳解+作文范文)_第1頁(yè)
已閱讀1頁(yè),還剩20頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、仿真機(jī)器人足球,信息工程學(xué)院羅忠文Email: lzw63@sina.comHomepage: http://xgxy.cug.edu.cn/rjgcx/lzw/robot,仿真機(jī)器人足球,引論:安裝程序基于LINGO語(yǔ)言的開發(fā)平臺(tái)運(yùn)行機(jī)制基于VC++語(yǔ)言的開發(fā)總體開發(fā)流程,安裝程序,點(diǎn)擊下一步,下一步程序在什么地方:C盤相關(guān)目錄一個(gè)是在STRATEGY另一個(gè)是在PROGRAM FILE下玩一下,基于LINGO

2、的程序(Blue),global B1,B2,B3,B4,B5,ballon strategyBVelocity(B1,0,0)Velocity(B2,0,0)Velocity(B3,0,0)Velocity(B4,0,0)Velocity(B5,0,0)end strategyB,基于LINGO的程序(0.0),global y1,y2,y3,y4,y5,ballon strategyYVelocit

3、y(y1,0,0)Velocity(y2,0,0)Velocity(y3,0,0)Velocity(y4,0,0)Velocity(y5,0,0)end strategyY,基于LINGO的程序(0.1),global y1,y2,y3,y4,y5,ballon strategyYVelocity(y1,0,0)Velocity(y2,0,0)Velocity(y3,0,0)Velocity(y4,

4、5,5) ?。ㄗ笄颁h)Velocity(y5,5,0)end strategyY,基于LINGO的程序(0.2),global y1,y2,y3,y4,y5,ballon strategyYVelocity(y1,5,5)    方向問題Velocity(y2,0,0)Velocity(y3,0,0)Velocity(y4,5,5)    Velocity(y5,5,0)end strategyY,基于L

5、INGO的程序(1.0),global y1,y2,y3,y4,y5,ballon strategyYGaolie(y1)Velocity(y2,0,0)Velocity(y3,0,0)Velocity(y4,0,0)    Velocity(y5,0,0)end strategyYon Gaolie(whichBot)vl=5vr=5Velocity(whichBot,vl,vr)end G

6、aolie,基于LINGO的程序(1.1),global y1,y2,y3,y4,y5,ballon strategyYGaolie(y1)Velocity(y2,0,0)Velocity(y3,0,0)Velocity(y4,0,0)    Velocity(y5,0,0)end strategyYon Gaolie(whichBot)vl=Ball.y-whichBot.pos.yvr=Ball

7、.y-whichBot.pos.yVelocity(whichBot,vl,vr)end Gaolie,基于LINGO的程序(1.2),global y1,y2,y3,y4,y5,ballon strategyYGaolie(y1)Velocity(y2,0,0)Velocity(y3,0,0)Velocity(y4,0,0)    Velocity(y5,0,0)end strategyY,on Gao

8、lie(whichBot)vl=Ball.y-whichBot.pos.yvr=Ball.y-whichBot.pos.y--------校正角度--------------------   tR = whichBot.rot.z   if tR 360.001 then tR = tR - 360   if tR > 90.5 then     vl = vl + abs(tR - 90)   e

9、lse if tR < 89.5 then vr = vr + abs(tR - 90) end if --------------------Velocity(whichBot,vl,vr)end Gaolie,運(yùn)行機(jī)制,每秒60次決策傳入決策程序中的是球、小車等的位置. 通過寫速度,來(lái)對(duì)小車實(shí)施控制每次根據(jù)當(dāng)前的狀態(tài)進(jìn)行判斷,作出決策使用注意兩種程序(不

10、同的選項(xiàng)):LINGO和C幫助信息(參見隨機(jī)的幫助)這里提供了大量的信息如厘米與英尺的轉(zhuǎn)換等,比賽規(guī)則,擺球規(guī)則自由球規(guī)則點(diǎn)球規(guī)則,基于VC的程序,編寫程序進(jìn)行調(diào)試修改后再做處理,基于VC的程序-調(diào)試,函數(shù)化(過程化)調(diào)試辦法1(在線輸出:OpenViewer)調(diào)試辦法2(輸出信息)FILE * debugfile; dfile = fopen("debugfile.txt","a

11、"); fprintf(dfile, "x: %f y: %\n", robot->pos.x, robot->pos.y); fclose(debugfile);,守門員函數(shù)的修改,回到一個(gè)四方塊中if (fabs(FRIGHTX-robot->pos.x) > 6.) {Position(robot,FRIGHTX, 35);return ;}固

12、定到-90度(或者270度)if (fabs(robot->rotation+90)> 2 ) {robot->velocityLeft=robot->rotation+90;robot->velocityRight=-robot->rotation-90;return ;},守門員函數(shù)調(diào)試要點(diǎn),對(duì)照檢查:發(fā)現(xiàn)大于小于的問題C語(yǔ)言:if ( Ay > Ty -

13、 0.9 && Ay fieldBounds.top - env->currentBall.pos.y;double Ty = FTOP - env->currentBall.pos.y;,總體開發(fā)流程-分層開發(fā),上層:陣形確定與設(shè)計(jì)進(jìn)攻、防守固定角色、智能角色中層:角色分配路徑規(guī)劃下層基本動(dòng)作組合動(dòng)作,基本動(dòng)作函數(shù)設(shè)計(jì),球預(yù)測(cè)void PredictBall ( Environment

14、 *env ){double dx = env->currentBall.pos.x - env->lastBall.pos.x;double dy = env->currentBall.pos.y - env->lastBall.pos.y;env->predictedBall.pos.x = env->currentBall.pos.x + dx;env->predicte

15、dBall.pos.y = env->currentBall.pos.y + dy;},基本動(dòng)作函數(shù)-轉(zhuǎn)角函數(shù),void Angle ( Robot *robot, int desired_angle){int theta_e, vl, vr;theta_e = desired_angle - (int)robot->rotation;while (theta_e > 180) theta_e -= 3

16、60;//將角度差劃到-180到180while (theta_e 90) theta_e -= 180;if (abs(theta_e) > 50) {vl = (int)(-9./90.0 * (double) theta_e);vr = (int)(9./90.0 * (double)theta_e);}else if (abs(theta_e) > 20){vl = (int)(

17、-11.0/90.0 * (double)theta_e);vr = (int)(11.0/90.0 * (double)theta_e);}Velocity (robot, vl, vr);},基本動(dòng)作函數(shù)-到定點(diǎn),void Position( Robot *robot, double x, double y ){int desired_angle = 0, theta_e = 0, d_angle = 0, vl

18、, vr, vc = 70;double dx, dy, d_e, Ka = 10.0/90.0;dx = x - robot->pos.x;dy = y - robot->pos.y;d_e = sqrt(dx * dx + dy * dy);if (dx == 0 && dy == 0)desired_angle = 90;elsedesired_angle = (in

19、t)(180. / PI * atan2((double)(dy), (double)(dx)));theta_e = desired_angle - (int)robot->rotation;while (theta_e > 180) theta_e -= 360;while (theta_e 100.) Ka = 17. / 90.;else if (d_e > 50)Ka = 19. /

20、 90.;else if (d_e > 30)Ka = 21. / 90.;else if (d_e > 20)Ka = 23. / 90.;else Ka = 25. / 90.;,基本動(dòng)作函數(shù)-到定點(diǎn),if (theta_e > 95 || theta_e 180) theta_e -= 360;if (theta_e > 80)theta_e = 80;if (

21、theta_e -85){if (d_e < 5.0 && abs(theta_e) < 40)Ka = 0.1;vr = (int)( vc * (1.0 / (1.0 + exp(-3.0 * d_e)) - 0.3) + Ka * theta_e);vl = (int)( vc * (1.0 / (1.0 + exp(-3.0 * d_e)) - 0.3) - Ka * thet

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 眾賞文庫(kù)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論