 
         
         
         
         
        版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 清洁能源设备租赁创新创业项目商业计划书
- 糕点影视道具企业制定与实施新质生产力项目商业计划书
- 虚拟实验室创新创业项目商业计划书
- 胰岛细胞培养基质企业制定与实施新质生产力项目商业计划书
- 肺气肿常见症状及护理注意事项
- 宠物情感支持与心理咨询创新创业项目商业计划书
- 洗衣店连锁加盟服务创新创业项目商业计划书
- 精密螺丝制造中心企业制定与实施新质生产力项目商业计划书
- 2026年初级银行从业资格之初级银行业法律法规与综合能力考试题库500道及答案(真题汇编)
- 管道巡检无人机系统创新创业项目商业计划书
- DB37-T 5338-2025 既有玻璃幕墙检验评估技术规程
- 2024-2025学年广西壮族自治区贺州市八步区北师大版五年级上册期中测试数学试卷(含答案)
- 春节安全生产培训会课件
- 幽门螺旋杆菌治疗指南
- 浙江入团考试题目及答案
- 三进两联一交友课件
- 2025湖南生物机电职业技术学院单招《语文》考试历年机考真题集【必考】附答案详解
- 九级硬笔真题及答案
- 2025届湖北省武汉外国语高三下学期10月考-数学试题(含答案)
- 环保低碳宣传知识培训课件
- (完整版)2025年全国自考《马克思主义基本原理概论》真题及答案
 
            
评论
0/150
提交评论