嵌入式導(dǎo)論課件:Chapter3 Model Vehicle Control System_第1頁
嵌入式導(dǎo)論課件:Chapter3 Model Vehicle Control System_第2頁
嵌入式導(dǎo)論課件:Chapter3 Model Vehicle Control System_第3頁
嵌入式導(dǎo)論課件:Chapter3 Model Vehicle Control System_第4頁
嵌入式導(dǎo)論課件:Chapter3 Model Vehicle Control System_第5頁
已閱讀5頁,還剩18頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

1、1Real-Time Systems Lab LIAO YongUniversity of Electronic Science & Technology of China (UESTC)Chapter3 Model Vehicle Control System2Real-Time Systems Lab LIAO YongUniversity of Electronic Science & Technology of China (UESTC)1 OUTLINEnThere is a model vehicle4 cartwheels; 2 motors: One is st

2、eering engine (130s Brushless motor) that is used to control the front two cartwheels; the other is speed motor (Brushless ESC (Electronic Speed Controller) that is used to drive the rear two cartwheels;1 batter;1 freescale 5213 card (MCF 5213);1 ultrasonic sensor (SRF05);1 LCD (LCD 1602).3Real-Time

3、 Systems Lab LIAO YongUniversity of Electronic Science & Technology of China (UESTC)nYour missionDrive the model vehicle to go ahead while keeps it at a given distance (50 cm) from a wall. 1 OUTLINE4Real-Time Systems Lab LIAO YongUniversity of Electronic Science & Technology of China (UESTC)

4、1 OUTLINEnRequirementsDetect (Acquire) the current distance from the wall in real time by the ultrasonic sensor; Display the detected distance by the LCD;Drive the steering engine and speed motor to control the model vehicle to go ahead while keeps it at 50 cm from the wall;Your program runs on the

5、top of uC/OS ;Codewarrior, C & Assemble language.nHow to do this?5Real-Time Systems Lab LIAO YongUniversity of Electronic Science & Technology of China (UESTC)2 Problem (P1)nP1: How to detect the distance in real-time?Velocity of ultrasonic is 340meter/s;Distance=( * 340m/s)/2; How to get th

6、e TimeDuration?TimeDuration6Real-Time Systems Lab LIAO YongUniversity of Electronic Science & Technology of China (UESTC)3 Problem (P2), (P3), (P4)nP2: How to drive the steering engine to turn Left/Right? Given a turning angle, How to implement the “turning” command?nP3: How to determine the tur

7、ning angle in each adjustment ?nP4: How to organize and design the software architecture on the top of uc/OS II ?DFD (Data Flow Diagram)Task structure7Real-Time Systems Lab LIAO YongUniversity of Electronic Science & Technology of China (UESTC)4 Implement the above design on the top of uC/OS Tas

8、k management: OSTaskCreate () Mail Box: OSMBoxCreate () OSMBoxPost () OSMBoxPend () Synchronize: OSSemCreate () OSSemPost () OSSemPend () Mutex: OSMutexCreate () OSMutexPost () OSMutexPend () Interrupt: OSVectSet () . .nAPIs provided by the uC/OS?8Real-Time Systems Lab LIAO YongUniversity of Electro

9、nic Science & Technology of China (UESTC)4 Implement the above design on the top of uC/OS MCF_GPIO_PORTDD&=Trig / produce a 20us pulse TestTimeSum=Gettime1-Gettime0 /Calculate the distancenInterfaces for ultrasonic OSSpeeddown () OSSpeedup () OSTurnLeft () OSTurnRight ()nInterfaces for PWM L

10、CDWcmd () / Determine the position on the LCD LCDWdata () / Display the given information LCDShowChar () / Display the detected distancenInterfaces for LCD9Real-Time Systems Lab LIAO YongUniversity of Electronic Science & Technology of China (UESTC)5 How to design a more perfect control system?n

11、More sensors (A group of photoelectric sensors)nMore tasksnPerfect control algorithmnOptimize your programnResponsibility, StabilitynOther control applicationsnnQ & A10Real-Time Systems Lab LIAO YongUniversity of Electronic Science & Technology of China (UESTC)11Real-Time Systems Lab LIAO Yo

12、ngUniversity of Electronic Science & Technology of China (UESTC)TestTimeSum=(GetTime1-GetTime0)Time Duration=F (TestTimeSum)12Real-Time Systems Lab LIAO YongUniversity of Electronic Science & Technology of China (UESTC)13Real-Time Systems Lab LIAO YongUniversity of Electronic Science & T

13、echnology of China (UESTC)14Real-Time Systems Lab LIAO YongUniversity of Electronic Science & Technology of China (UESTC)nScanCalculate the distance (TestDst), according to the original data (GetTime0, GetTime1) from GPT)Calculate the distance error (ScanResult), according to the increasing PID

14、(Proportion, Integral, Differential) control algorithmnCarAdjust the turning angle of the steering engine, according to the ScanResult and a given adjustment policySend the adjustment commands to the steering engine nShow15Real-Time Systems Lab LIAO YongUniversity of Electronic Science & Technol

15、ogy of China (UESTC)GOSetpoint16Real-Time Systems Lab LIAO YongUniversity of Electronic Science & Technology of China (UESTC) r(t): The set-point of the desired distance (50cm) c(t): The detected distance (TestDst)Where: e(k),e(k-1),e(k-2) are successive errors of 3 times. (u) is the controller

16、output, also the adjustment amount of the distance. e(t)=r(t)-c(t), Where:)2() 1(2)()1()()()(kekekekekekekuKKKdIP17Real-Time Systems Lab LIAO YongUniversity of Electronic Science & Technology of China (UESTC)nPID is a linear controlP control: Improve the responsibility when error happens.I contr

17、ol: Eliminate the residual error (After the P control, if the controlled TestDst does not return to setpoint, there exists a error between the setpoint and the value that has been adjusted by the P control).D control: Decrease the dynamic error. The adjustment is based on the error variation rate of

18、 the previous 3 periods. Thus the stability is improved.)2() 1(2)()1()()()(kekekekekekekuKKKdIP18Real-Time Systems Lab LIAO YongUniversity of Electronic Science & Technology of China (UESTC)PWM: Pulse-Width Modulor 19Real-Time Systems Lab LIAO YongUniversity of Electronic Science & Technolog

19、y of China (UESTC)The relation between the turning angle and Duty ratio(turning angle - Pulse width- Duty ratio) (Pulse width of PWM)Turning anglePWM Pulse the Period is 20msDuty ratio=PWM of Periodwidth Pulse20Real-Time Systems Lab LIAO YongUniversity of Electronic Science & Technology of China (UESTC)0o

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(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)論