




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年内分泌科糖尿病临床诊断对策考试答案及解析
- 学校四班级春季教学工作方案
- 2025年康复医学综合治疗方案设计模拟测试答案及解析
- 2025年麻醉科安全操作流程考核答案及解析
- 2025年心电图解读技能应用考核测试卷答案及解析
- 2025年肿瘤放疗放射治疗的副作用模拟测试卷答案及解析
- 新质生产力的哲学与文化思考
- 2025年心血管病学心梗后康复训练考试卷答案及解析
- 江苏新质生产力发展动态
- 新质生产力的核心体现维度
- I类切口手术预防应用抗菌药物制度
- 鞋业模具制作流程
- 未成年人保护法普法宣传教育课件
- 第六课 实现人生的价值(精美课件)
- 《专利及专利查询》课件
- 地下水污染控制与修复
- 智障个别化教育计划案例(3篇)
- 《欧盟的法律体系》课件
- 网络信息安全基础知识培训课件
- 江苏南京建邺高新区管委会社会公开招聘22人高频重点提升(共500题)附带答案详解
- 化学奇妙之旅
评论
0/150
提交评论