APP下载

浅析加速度计在智能车闭环系统中的应用

2020-12-23王晓梅何帅张昊张康

锦绣·下旬刊 2020年7期
关键词:积分加速度

王晓梅 何帅 张昊 张康

摘要:在智能车的速度闭环控制系统中一般都会选择编码器对电机转速进行测量然后换算为速度再反馈给控制器。虽然编码器能够精准测出电机的转速,但遇到轮胎打滑时,电机在转动而车身不行进或者与编码器换算出的速度不一致就会导致不能对车速进行任意时刻的精准控制。如果将加速度计固定在车身上,加速度计采集回实时加速度后再换算为速度就能保证采集的速度和车身速度一致,然后再反馈给控制器就能实现对智能车的任意时刻精准控制。

关键词:加速度;积分;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-),男,汉族,四川南充,本科,研究方向:电气工程及其自动化

猜你喜欢

积分加速度
走出“加速度”理解的误区
加速度新题型精析
微“积分”:构建活力班级的一把金钥匙
欧拉公式在积分运算中的简化作用
积分激励机制在生物课堂教学《青春期》中的运用
浅谈高等数学教学过程中的教育思想
向心加速度公式推导
向心加速度学习一卡通