王曉梅 何帥 張昊 張康

摘要:在智能車的速度閉環控制系統中一般都會選擇編碼器對電機轉速進行測量然后換算為速度再反饋給控制器。雖然編碼器能夠精準測出電機的轉速,但遇到輪胎打滑時,電機在轉動而車身不行進或者與編碼器換算出的速度不一致就會導致不能對車速進行任意時刻的精準控制。如果將加速度計固定在車身上,加速度計采集回實時加速度后再換算為速度就能保證采集的速度和車身速度一致,然后再反饋給控制器就能實現對智能車的任意時刻精準控制。
關鍵詞:加速度;積分;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 引言
將加速度計固定在車身上,將采集的加速度換算為速度就能保證在任何時刻控制器都能采集到的準確的車速,將會消除輪胎打滑時的速度采集的差錯。這將為實現速度的精準閉環控制提供關鍵數據。所以本文將主要討論如何如何利用加速度計反饋速度并如何利用采集的速度值實現車速的精準閉環控制。
1 實時測速的實現
一般線性加速度計能夠利用壓電效應測量出空間中的X、Y、Z三軸的加速度,然后經過對三軸方向加速度積分換算出各軸的速度,最后通過分速度合成可得到任意方向的速度。
2 速度閉環的實現
2.1速度閉環原理
當加速度計采集到實際車身加速度后通過雙重積分獲得實際速度,實際速度與期望速度做差得到速度偏差傳給PID系統,PID輸出值加載到電機上,依次動態調整電機轉速大小從而實現車身能夠一直以較小誤差波動維持在期望速度上下。
2.2 程序實現
以MPU6050加速度計和增量式PID為例,程序實現加速度計在速度閉環中的實現。
#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; ?????? ??????? //計算x軸速度
speed_y += k2*mpu_acc_y; ?????? //計算y軸速度
speed = sqrt(pow(speed_x ,2) + pow(speed_y,2));??????? //計算行進速度
speed_err = setspeed-speed;???????????????? //計算速度偏差
pwm = kp*speed_err? + ki*speed_err? +kd*speed_err; //PID系統輸出
out = pwm+last;??????????????? //最終電機輸出占空比
3 結論
利用加速度計測出加速度并轉換為速度,能防止輪胎打滑時電機速度與車身速度不匹配現象導致的反饋速度與實際速度有較大偏差問題,這樣就能為速度閉環提供真實可靠的速度值。
作者簡介:
王曉梅(1997-),女,漢,四川宜賓,本科,研究方向:機械電子工程
何帥(1997-),男,漢,四川廣元,本科,研究方向:機械電子工程
張昊(1999-),男,漢族,甘肅武威,本科,研究方向:電氣工程及其自動化
張康(1999-),男,漢族,四川南充,本科,研究方向:電氣工程及其自動化