《基于DSP的移动机器人的设计与实现.pdf》由会员分享,可在线阅读,更多相关《基于DSP的移动机器人的设计与实现.pdf(4页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、complete temcomplete tem porary tasks aporary tasks assigned by tssigned by t he Mahe Manager.Senager.Second,cond,characharacteristic fcteristic functions 1,aunctions 1,a ccording tccording to theo the compacompany,a responsiny,a responsi bility of three,six systems rebility of three,six systems re
2、quiremequirements of the mants of the ma nagement system,renagement system,re sponsisponsible for a responsible for a responsi bility of three system ability of three system a nd thnd the formulation of major re formulation of major r ules aules and regnd regulatiulations,ons,and iand is responsis r
3、esponsi ble for training,implemeble for training,impleme ntation,intation,inspectinspection aon and gnd guideuide its operation;2,the company responsiits operation;2,the company responsi ble for theble for the DepartmeDepartment(workshop)ant(workshop)a nnual and montnnual and mont hly economic respo
4、nsihly economic responsi bility economic responsibility economic responsi bility system ability system a nd varind variousous spespecial formulaticial formulati on,revion,revision,inspesion,inspe ction,evaluatiction,evaluati on,ion,internternal evaluatinal evaluation,on,summary,asummary,apprpproved
5、aoved andnd communicated,audits,surveys,feedbacommunicated,audits,surveys,feedba ck from senick from senior Deor Department assepartment assessmessment;3,responsint;3,responsi ble for theble for the comcompanys lpanys longong-term plan,annual-term plan,annual planplan of work;4,is responsiof work;4,
6、is responsi ble for theble for the compacompanys monthly operatingnys monthly operating conditiconditions aons analysinalysis and monts and mont hly focus assessmehly focus assessme nt focus;5 rnt focus;5 r ules aules and regnd regulations,the comulations,the com pany responsipany responsi ble for t
7、heble for the develdevelopmentopment,examination,inspe,examination,inspe ction and training,ction and training,Discovery ManageDiscovery Manage r.10r.10 quality aquality acciccidentsdents of work,theof work,the compacompany responsiblny responsibl e for the Dee for the De partment of investigation,j
8、udge,partment of investigation,judge,processiprocessing,anang,analysis,summary and reportilysis,summary and reporti ng;11,and ing;11,and i s responsibls responsibl e for implement imple for implement impl ementation implementatiementation implementati onon national of financial system,and finanation
9、al of financial system,and fina ncialncial disciplidiscipline,accorne,according to compading to compa ny a accountany a accountability threebility three of system requirementof system requirement s,devels,developeoped company finad company fina nciancial management al management a nd finand financia
10、lncial supervisisupervision system(including fundson system(including funds costcosts apprs approval system,and borrowioval system,and borrowi ng approval system,and settlemeng approval system,and settleme nt system cash management system,),bynt system cash management system,),byManager aManager app
11、rpproved Hou serioved Hou seriously organiously organization implementatization implementati on,aon,and implnd implementation,andementation,and基于 DSP 的移动机器人的设计与实现摘摘要:要:智能交通系统是 21 世纪城市交通的发展方向,移动机器人作为智能车辆控制系统实验平台的一个主要部分,对 智能交通系统的关键技术的研究具有十分重要的意义.介绍了面向智能交通系统的 SJTNC1 移动机器人的组成和结构,并详细叙述了基于数字信号处理器 TMS320LF
12、2407A 的控制系统的设计和实现。关键词:关键词:智能交通系统 移动机器人 数字信号处理器智能交通系统(ITS)的概念是美国智能交通学会于1990 年提 出的,它将先进的信息技术、通信技术、自动控制技术、电子技术及计算机处理技术综合运用于整个运输管理系统中,通过对交通信息的采集、传输和处理,对交通运输进行协调和管理,建立起实时、准确、高效的综合交通运输管理体系,从而提高了交通效率和安全了,实现性交通运输服务和管理的智能化.智能车辆的导航与定位、自动驾驶与控制和车辆的预警防碰等智能交通系统关键技术的研究,近年来受到国内外越来越广泛的关注,也取得了丰硕的成果.但真正的 实验研究还是很少,基本上只
13、进行了仿真试验。鉴于理论上的模拟和实际应用情况可能相差甚远,选择了具有智能性、易扩展性和移动性等优点的车型移动机器人作 为 ITS 关键技术的研究平台中的主要部分车辆模拟器。本文所阐述的移动机器人SJTNC-1,就是面向 ITS 提出的.考虑到关键技术研究中需进行大量的计算,如模糊控制、卡尔曼滤波和路径导引等,并且系统对数据的实时性要求很高,所以采用数字信号处理器(DSP)作为移动机器人主控 CPU。1 TMS320LF2407A1 TMS320LF2407A简介简介TMS320LF2407A(以下简称 F2407)是 TI 公司在 TMS320 系列 DSP 的基础上,专为数字电机控制而设计
14、的。除了具有一般 DSP 的改进 的哈佛结构、多总线结构和流水线结构等优点外,它还采用高性能静态 CMOS 技术,电压从 5V 降为 3.3V,减少了功耗.并且指令执行速度提高到 40MIPS,几乎所有指令都可以在25ns 的单周期内完成。如此高的运算速度使其可以通过采用高级控制算法如模糊控制、卡尔曼滤波以及状态控制等来提高 系统的性能.而且,它具有电机控制应用所必需的外设,如:32K 片内 FLASH、2K 单访问 RAM、串行外设接口(SPI)、串行通信接口(SCI)、两 个事件管理模块、16 通道双 10 位 A/D 转换器和 CAN 控制器模块。2 2 移动机器人的运动机构移动机器人的
15、运动机构考虑到该移动机器 人是面向 ITS 的,所以采用的是车型结构(四轮结构)。前两轮通过减速比为 8:1 的齿轮减速机构与转向电机进行连接,实现移动机器人的转向功能;后两轮通 过减速比为 6:1 的齿轮减速机构与驱动电机进行连接,实现移动机器人的驱动。电机的选型可根据实际情况选择小型步进电机或小型直流电机。这里选用的是瑞士 Minimotor 公司生产的直流电机,这种电机具有体积小、转矩大等特点。3 3 移动机器人控制系统移动机器人控制系统控制系统以 控制器 F2407 为核心,由无线通信、电机驱动、速度传感器、数字罗盘、差分 GPS(DGPS)接收机和4 转 1 串口通信模块等组成,如图
16、1 所示。无线通信 模块根据自行约定的通信协议接收上位机的规划好的路径信息,整个控制系统通过控制驱动电机和转向电机使移动机器人跟踪该路径行驶。电机采用 PWM 调速方 式,其中驱动电机采用双闭环(速度和电流)PID 控制策略,而转向电机则通过把数字罗盘的航向信息作为转向的反馈量进行 PID 控制。整个控制系统把 DGPS 接收机的位置信息作为系统的位置反馈信息,用以完成整个系统的位置闭环控制。complete temcomplete tem porary tasks aporary tasks assigned by tssigned by t he Mahe Manager.Senager.
17、Second,cond,characharacteristic fcteristic functions 1,aunctions 1,a ccording tccording to theo the compacompany,a responsiny,a responsi bility of three,six systems rebility of three,six systems re quiremequirements of the mants of the ma nagement system,renagement system,re sponsisponsible for a re
18、sponsible for a responsi bility of three system ability of three system a nd the formulation of major rnd the formulation of major r ules aules and regnd regulatiulations,ons,and iand is responsis responsi ble for training,implemeble for training,impleme ntation,intation,inspectinspection aon and gn
19、d guideuide its operation;2,the company responsiits operation;2,the company responsi ble for theble for the DepartmeDepartment(workshop)ant(workshop)a nnual and montnnual and mont hly economic responsihly economic responsi bility economic responsibility economic responsi bility system ability system
20、 a nd varind variousous spespecial formulaticial formulati on,revion,revision,inspesion,inspe ction,evaluatiction,evaluati on,ion,internternal evaluatinal evaluation,on,summary,asummary,a pprpproved aoved andnd communicated,audits,surveys,feedbacommunicated,audits,surveys,feedba ck from senick from
21、senior Deor Department assepartment assessmessment;3,responsint;3,responsi ble for theble for the comcompanys lpanys longong-term plan,annual-term plan,annual planplan of work;4,is responsiof work;4,is responsi ble for theble for the compacompanys monthly operatingnys monthly operating conditicondit
22、ions aons analysinalysis and monts and mont hly focus assessmehly focus assessme nt focus;5 rnt focus;5 r ules aules and regnd regulations,the comulations,the com pany responsipany responsi ble for theble for the develdevelopmentopment,examination,inspe,examination,inspe ction and training,ction and
23、 training,Discovery ManageDiscovery Manage r.10r.10 quality aquality acciccidentsdents of work,theof work,the compacompany responsiblny responsibl e for the Dee for the De partment of investigation,judge,partment of investigation,judge,processiprocessing,anang,analysis,summary and reportilysis,summa
24、ry and reporti ng;11,and ing;11,and i s responsibls responsibl e for implement imple for implement impl ementation implementatiementation implementati onon national of financial system,and fnational of financial system,and f inainancialncial disciplidiscipline,accorne,according to compading to compa
25、ny a accountany a accountability threebility three of system requirementof system requirement s,devels,developeoped company finad company fina nciancial management al management a nd finand financialncial supervisisupervision system(including fundson system(including funds costcosts apprs approval s
26、ystem,and borrowioval system,and borrowi ng approval system,and settlemeng approval system,and settleme nt system cash management system,),bynt system cash management system,),byManager aManager apprpproved Hou serioved Hou seriously organiously organization implementatization implementati on,aon,an
27、d implnd implementation,andementation,and3 3。1 1 无线通信模块无线通信模块MC35 是德国西门子公司生产的可二次开发的支持GPRS 的双频 GSM 模块,可以通过标准串口与 PC 机相连.本系统用 MC35 作为移动机器人与上位机的通信模块。它具有GPRS 技术带来的一切优点,如一直在线和提供高速价廉的数据传送服务等.该产品的特性如下:支持双频:EGSM900/GSM1800支持 GPRS Class8 协议支持数据、语音、短消息和传真服务采用电路交换方式,最大传送速率为 14。4kbps支持的电压范围:8V30V采用标准工业接口体积:65mm7
28、4mm33mm重量:130g3.23.2 驱动模块驱动模块驱动电机和转向电机的驱动原理相同,都采用脉宽调制(PWM)方式进行调速,PWM 信号由 F2407 产生.驱动电路采用 H 全桥方式,由 4 个达林顿管(2 个 TIP132 和 2 个 TIP137)、4个 IN4001 二极管及与非门组成。电路原理图如图2 所示。当 PWM2、PWM4 为低电平而PWM1、PWM3 为 高电平时,T1、T4 饱和导通,T2、T3 截止,电流从 T1电机T4,电机正转;反之,当 PWM1、PWM3 为低电平而 PWM2、PWM4 为高电平 时,T2、T3 饱和导通,T1、T4 截止,电流从 T2电机T
29、3,电机反转.为防止 T1、T3 或 T2、T4 同时导通,形成短路而击穿器件,要用一对无重叠的PWM 输出去正确地开启和关断这两对管子。在一个管子关断和另一个管子开 启之间加入死区时间,这样就使得一个管子开启前,另一个管子已完全关断。F2407 具有死区控制单元是其一大特色,从而可用软件确保功率电路上下桥臂开关 元件的开通区间没有重叠,简化了硬件电路设计,提高了可靠性.3.3 43.3 4 转转 1 1 串口通信模块串口通信模块由于 DGPS 接收机、磁罗盘、里程计和 MC35 通信模块都采用 RS-232 异步串行通信,而 F2407 只有一个串行口,所以必须将 4 个串口数据通过转换处理
30、来完成与F2407 的串口通信。为此研制了基于分时复用方法的4 转 1 串口通信模块。当 F2407 需要某个传感器(或无线通信模块)的数据时,就通过电路选通该传感器占用 F2407 串口进行通信;当需要另外传感器或无线通信模块数据时,则关断上次传感器的选通,同时选通该次传感器或无线通信模块。4转 1 串口通信模块由 3 8 译码器 74LS138、三态输出的四总线缓冲门74LS125 和电平转换器 MAX232 等组成,其电路原理图如图 3 所示。3.43.4 定位传感器定位传感器3.43.4。1 DGPS1 DGPS 接收机接收机GPS(全球定位系统)是基于卫星的无线电导航系统,它提供一种
31、廉价实用的可在全球范围内确定位置、速度和时间的工具。GPS 由 24 颗卫星(21 颗工作 星、3 颗备份星)组成星座,星座分布在与地球赤道面倾角为55的 6 个轨道面上,其运行周期为11 小时 58 分,轨道半径为 20200km,各轨道面夹角为 60.每颗卫星向地球发射 L 频段的特高连续波,调制两种伪随机码(军用高精度保密 P 码和民用 C/A 码).这样的分布特点保证了用户在地球上任何地点、任 何时间至少可以连续地收到4 颗以上卫星的导航信号,从而联立解算出接收机的三维坐标以及接收机和 GPS 间的时间偏移。三维坐标采用ECEF 笛卡儿坐标系或 大地坐标系如WGS84。complete
32、 temcomplete tem porary tasks aporary tasks assigned by tssigned by t he Mahe Manager.Senager.Second,cond,characharacteristic fcteristic functions 1,aunctions 1,a ccording tccording to theo the compacompany,a responsiny,a responsi bility of three,bility of three,six systems resix systems re quiremeq
33、uirements of the mants of the ma nagement system,renagement system,re sponsisponsible for a responsible for a responsi bility of three system ability of three system a nd the fornd the for mulation of major rmulation of major r ules aules and regnd regulatiulations,ons,and iand is responsis responsi
34、 ble for training,implemeble for training,impleme ntation,intation,inspectinspection aon and gnd guideuide its operation;2,the company responsiits operation;2,the company responsi ble for theble for the DepartmeDepartment(workshop)ant(workshop)a nnual and montnnual and mont hly economic responsihly
35、economic responsi bility economic responsibility economic responsi bility system ability system a nd varind variousous spespecial formulaticial formulati on,revion,revision,inspesion,inspe ction,evaluatiction,evaluati on,ion,internternal evaluatinal evaluation,on,summary,asummary,apprpproved aoved a
36、ndnd communicated,audits,surveys,feedbacommunicated,audits,surveys,feedba ck from senick from senior Deor Department assepartment assessmessment;3,responsint;3,responsi ble for theble for the comcompanys lpanys longong-term plan,annual-term plan,annual planplan of work;4,is responsiof work;4,is resp
37、onsi ble for theble for the compacompanys monthly operatingnys monthly operating conditiconditions aons analysinalysis and monts and mont hly focus assessmehly focus assessme nt focus;5 rnt focus;5 r ules aules and regnd regulations,the comulations,the com pany responsipany responsi ble for theble f
38、or the develdevelopmentopment,examination,inspe,examination,inspe ction and training,ction and training,Discovery ManageDiscovery Manage r.10r.10 quality aquality acciccidentsdents of work,theof work,the compacompany responsiblny responsibl e for the Dee for the De partment of investigation,judge,pa
39、rtment of investigation,judge,processiprocessing,anang,analysis,summary and reportilysis,summary and reporti ng;11,and ing;11,and i s responsibls responsibl e for implement imple for implement impl ementation implementatiementation implementati onon national of financial system,and finanational of f
40、inancial system,and fina ncialncial disciplidiscipline,accorne,according to compading to companyny a accounta a accounta bility threebility three of system requirementof system requirement s,devels,developeoped company finad company fina nciancial management al management a nd finand financialncial
41、supervisisupervision system(including fundson system(including funds costcosts apprs approval system,and borrowioval system,and borrowi ng approval system,and settlemeng approval system,and settleme nt system cash management system,),bynt system cash management system,),by Manager aManager apprpprov
42、ed Hoved Hou seriou seriously organiously organization implementatization implementati on,aon,and implnd implementation,andementation,and虽然美国政府于 2001 年 5 月取消了民用 C/A 码的可选择性保护,但民用导航型GPS 接收机的单点实时定位精度只能达到25m 左右,不能满足系统的定位导航要求。而采用实时差分 GPS(DGPS),其定位精度可以达到25m,该精度已能满足系统定位和导航的要求。为此研发了单基站 DGPS(SRDGPS)系统,其结构框图如
43、图 4 所示.基准站由 ALLSTARBASE GPS 接收机、天线和 MDS 无线电发射台、天线组成,流动站由SUPERSTAR GPS接收机、天线和 MDX 无线电接收台、天线组成。其中基准站安装在上海交大徐家汇校区教学一楼楼顶,该基准站能覆盖方圆30 公里的范围,流动站安装在 车载单元上。3.43.4。2 2 数字罗盘和车速传感器数字罗盘和车速传感器采用 HoneyWell公司的 HMR 3300 数字罗盘作为移动机器人的方向检测传感器。其主要技术指标为:(1)1 度航向精度,0。1 度分辨率;(2)0。5 度重复性;(3)60 度倾斜俯 仰范围;(4)15Hz 响应时间;(5)-408
44、5 度工作温度;(6)615V 直流电压。同时采用用于大众汽车公司桑塔纳2000 型 轿车的霍尔车速传感器作为移动机器人的车速传感器。其工作原理是以霍尔传感器为变换元件,将机械旋转量转化为电脉冲信号输出。主要技术指标为:(1)输出 波形为矩形脉冲,占空比为 50;(2)每旋转一周产生 6 个脉冲;(3)额定电压为 12V.4 4 电源模块电源模块电源模 块需分别给各传感器、DSP 芯片、其它芯片和电机供电。其中,磁罗盘、码盘和DGPS 接收机使用 12V 直流电压,DSP 芯片使用 3。3V 直流电压,其它芯 片使用 5V 直流电压,还有电机电源使用 12V 直流电压。所以,采用 1 节 12
45、V 的直流蓄电池(4AH),直流 5V通过 ST 半导体公司的 L7805 和扩流用的 功率管实现,DSP 芯片用 3.3V 电源采用 ON 半导体公司的 1SMB5913BT3 实现。F2407 正常工作时,所有电源管脚都为3.3V;写入 FLASH 存储器时,VCCP 引脚为 5V 供电;复位时,复位电路会产生一个10s 宽度的持续低电平使芯片复位。5 5 控制器程序结构控制器程序结构DSP 程序由五大功能模块组成,分别为系统初始化模块、串口通信模块、路径引导模块、驱动电机控制模块和转向电机控制模块。TI 公司提供了用于 C 语言开 发的 CC 和 CCS 平台。该平台包括了 ANSI C
46、 优化编译器,从而可以在源程序级进行开发调试。这种方式大大提高了软件的开发速度和可读性,方便了软件的修改和移植.但在某些情况下,代码的效率还是无 法与手工编写的汇编代码的效率相比。此外,用C 语言实现芯片的某些硬件控制也不如汇编程序方便,有些甚至无法用语言实现.为了充分利用芯片的资源,更好地 发挥 C 语言和汇编语言进行软件开发的各自优点,采用混合编程方法将两者有机结合起来,兼顾两者的优点,避免其弊端.系统的框架如图 5 所示。下面对关键的几 大模块进行简要的阐述。5.15.1 串口通信模块串口通信模块该模块程序采用串口中断方式实现,主程序主要由系统初始化、串口初始化、串口中断设置和等待中断组
47、成。而中断子程序分为发送子程序和接收子程序。本文给出发送子程序流程图。主程序及发送子程序流程图如图6 所示。5 5。2 2 路径引导模块路径引导模块该模块在移动机器人行驶中为其提供实时的速度和转向指令,从而引导它沿着上位机给定的路径行驶。主要包括行驶指令的产生和规划路径的跟踪两个环节。根据预瞄跟随理论及驾驶员的开车行为特性,智能行驶和驾驶员操纵行为是内在一致的.通过研究有驾驶员操纵行为,发现主要根据两个因素决定车辆的前进速度,这两个因素分别是complete temcomplete tem porary tasks aporary tasks assigned by tssigned by t
48、 he Mahe Manager.Senager.Second,cond,characharacteristic fcteristic functions 1,aunctions 1,a ccording tccording to theo the compacompany,a responsiny,a responsi bility of three,six systems rebility of three,six systems re quiremequirements of the mants of the ma nagement system,renagement system,re
49、 sponsisponsible for a responsible for a responsi bility of three system ability of three system a nd the formulation of major rnd the formulation of major r ules aules and regnd regulatiulations,ons,and iand is responsis responsi ble for training,implemeble for training,impleme ntation,intation,ins
50、pectinspection aon and gnd guideuide its operation;2,the company responsiits operation;2,the company responsi ble for theble for the DepartmeDepartment(workshop)ant(workshop)a nnual and montnnual and mont hly economic responsihly economic responsi bility economic responsibility economic responsi bil