王曉梅 何帥 張昊 張康
摘要:在智能車的速度閉環(huán)控制系統(tǒng)中一般都會(huì)選擇編碼器對(duì)電機(jī)轉(zhuǎn)速進(jìn)行測(cè)量然后換算為速度再反饋給控制器。雖然編碼器能夠精準(zhǔn)測(cè)出電機(jī)的轉(zhuǎn)速,但遇到輪胎打滑時(shí),電機(jī)在轉(zhuǎn)動(dòng)而車身不行進(jìn)或者與編碼器換算出的速度不一致就會(huì)導(dǎo)致不能對(duì)車速進(jìn)行任意時(shí)刻的精準(zhǔn)控制。如果將加速度計(jì)固定在車身上,加速度計(jì)采集回實(shí)時(shí)加速度后再換算為速度就能保證采集的速度和車身速度一致,然后再反饋給控制器就能實(shí)現(xiàn)對(duì)智能車的任意時(shí)刻精準(zhǔn)控制。
關(guān)鍵詞:加速度;積分;PID
Abstract: In the speed closed-loop control system of intelligent vehicle, the encoder is usually selected to measure the motor speed, and then the speed is converted and fed back to the controller. Although the encoder can accurately measure the speed of the motor, when the tire slips, the motor is rotating and the body is not moving or the speed is inconsistent with that of the encoder, so the speed cannot be accurately controlled at any time. If the accelerometer is fixed on the vehicle body, the real-time acceleration collected by the accelerometer and converted into speed can ensure that the collected speed is consistent with that of the vehicle body, and then feedback to the controller can achieve accurate control of the intelligent vehicle at any time.
Key words: Acceleration; Integral; The PID
0 引言
將加速度計(jì)固定在車身上,將采集的加速度換算為速度就能保證在任何時(shí)刻控制器都能采集到的準(zhǔn)確的車速,將會(huì)消除輪胎打滑時(shí)的速度采集的差錯(cuò)。這將為實(shí)現(xiàn)速度的精準(zhǔn)閉環(huán)控制提供關(guān)鍵數(shù)據(jù)。所以本文將主要討論如何如何利用加速度計(jì)反饋速度并如何利用采集的速度值實(shí)現(xiàn)車速的精準(zhǔn)閉環(huán)控制。
1 實(shí)時(shí)測(cè)速的實(shí)現(xiàn)
一般線性加速度計(jì)能夠利用壓電效應(yīng)測(cè)量出空間中的X、Y、Z三軸的加速度,然后經(jīng)過(guò)對(duì)三軸方向加速度積分換算出各軸的速度,最后通過(guò)分速度合成可得到任意方向的速度。
2 速度閉環(huán)的實(shí)現(xiàn)
2.1速度閉環(huán)原理
當(dāng)加速度計(jì)采集到實(shí)際車身加速度后通過(guò)雙重積分獲得實(shí)際速度,實(shí)際速度與期望速度做差得到速度偏差傳給PID系統(tǒng),PID輸出值加載到電機(jī)上,依次動(dòng)態(tài)調(diào)整電機(jī)轉(zhuǎn)速大小從而實(shí)現(xiàn)車身能夠一直以較小誤差波動(dòng)維持在期望速度上下。
2.2 程序?qū)崿F(xiàn)
以MPU6050加速度計(jì)和增量式PID為例,程序?qū)崿F(xiàn)加速度計(jì)在速度閉環(huán)中的實(shí)現(xiàn)。
#define ??????? ?k1?? xx???????????? //積分常量
#define ??????? ?k2?? xx???????????? //積分常量
mpu_acc_x = GetData(ACCEL_XOUT_H)>>2;//獲取x軸加速度
mpu_acc_y = GetData(ACCEL_YOUT_H)>>2;//獲取y軸加速度
speed_x += k1*mpu_acc_x; ?????? ??????? //計(jì)算x軸速度
speed_y += k2*mpu_acc_y; ?????? //計(jì)算y軸速度
speed = sqrt(pow(speed_x ,2) + pow(speed_y,2));??????? //計(jì)算行進(jìn)速度
speed_err = setspeed-speed;???????????????? //計(jì)算速度偏差
pwm = kp*speed_err? + ki*speed_err? +kd*speed_err; //PID系統(tǒng)輸出
out = pwm+last;??????????????? //最終電機(jī)輸出占空比
3 結(jié)論
利用加速度計(jì)測(cè)出加速度并轉(zhuǎn)換為速度,能防止輪胎打滑時(shí)電機(jī)速度與車身速度不匹配現(xiàn)象導(dǎo)致的反饋速度與實(shí)際速度有較大偏差問(wèn)題,這樣就能為速度閉環(huán)提供真實(shí)可靠的速度值。
作者簡(jiǎn)介:
王曉梅(1997-),女,漢,四川宜賓,本科,研究方向:機(jī)械電子工程
何帥(1997-),男,漢,四川廣元,本科,研究方向:機(jī)械電子工程
張昊(1999-),男,漢族,甘肅武威,本科,研究方向:電氣工程及其自動(dòng)化
張康(1999-),男,漢族,四川南充,本科,研究方向:電氣工程及其自動(dòng)化