




版權(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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 高效節(jié)能電機(jī)項(xiàng)目可行性研究報(bào)告(參考范文)
- 文明工地管理制度
- 2025年濕法稀磷酸項(xiàng)目建議書
- 異步電機(jī)控制策略
- 2025年智能電網(wǎng)配電設(shè)備項(xiàng)目建議書
- 2025年互聯(lián)網(wǎng)醫(yī)療平臺(tái)在線問診平臺(tái)與患者健康檔案管理對(duì)接報(bào)告
- 2025年工業(yè)碳捕獲與封存(CCS)技術(shù)在節(jié)能減排中的應(yīng)用案例研究
- 基于大數(shù)據(jù)的2025年智慧交通流量預(yù)測(cè)模型構(gòu)建與分析報(bào)告
- 2025年綠色藥品生產(chǎn)技術(shù)現(xiàn)狀與市場(chǎng)推廣路徑研究報(bào)告
- 城市污水處理廠智能化升級(jí)改造中的能源管理優(yōu)化策略報(bào)告
- 自尊主題班會(huì)課件
- 海洋經(jīng)濟(jì)政策效果評(píng)估
- 徳龍全自動(dòng)咖啡機(jī)ECAM 22.110.SB 中文使用說明書
- 勞動(dòng)教育與數(shù)學(xué)作業(yè)深度融合 全面培養(yǎng)學(xué)生的勞動(dòng)素養(yǎng)
- 中國(guó)質(zhì)譜儀行業(yè)發(fā)展趨勢(shì)及發(fā)展前景研究報(bào)告2025-2028版
- 2025至2030中國(guó)直聯(lián)式真空泵行業(yè)市場(chǎng)現(xiàn)狀分析及競(jìng)爭(zhēng)格局與投資發(fā)展報(bào)告
- 2025至2030中國(guó)無源光分路器行業(yè)發(fā)展趨勢(shì)分析與未來投資戰(zhàn)略咨詢研究報(bào)告
- 痛風(fēng)治療與護(hù)理課件
- T/CCBD 19-2022品牌餐廳評(píng)價(jià)規(guī)范
- 2025 秋外研英語八上單元重點(diǎn)知識(shí)清單Unit 1
- 河南省南陽市內(nèi)鄉(xiāng)縣2025屆數(shù)學(xué)七下期末調(diào)研試題含解析
評(píng)論
0/150
提交評(píng)論