#include“stm32f10x.h” #include“I2C_MPU6050.h” #include“usart1.h” #include“delay.h” #include“filter.h” #include“math.h” #include“misc.h” #include“TIMX.h” #defineAIN2PBout(15) #defineAIN1PBout(14) #defineBIN1PBout(13) #defineBIN2PBout(12) #defineBITBAND(addr,bitnum...
//GPIO 过滤器 extern uint16_t GPIO_Filter( GPIO_TypeDef* GPIOx ); #endif iic_analog.c #include"stm32f10x.h"#include"iic_analog.h"/***//*模拟IIC引脚初始化函数*//***/voidIIC_GPIO_Configuration( GPIO_TypeDef * GPIOx_SDA ,uint16_tSDA_Pin , GPIO_TypeDef * GPIOx_SCL ,uint16_tSCL...
Kalman滤波函数入下: floatKalman_Filter(floatAccel,floatGyro,floatangle){floatangle_xsz;angle+=(Gyro-Q_bias)*dt;Pdot[0]=Q_angle-PP[0][1]-PP[1][0];Pdot[1]=-PP[1][1];Pdot[2]=-PP[1][1];Pdot[3]=Q_gyro;PP[0][0]+=Pdot[0]*dt;PP[0][1]+=Pdot[1]*dt;PP[1][0]+=Pdot...
后面把kalman滤波值、陀螺仪计量值、磁力计计算值都赋值为上面计算的roll、pitch、yaw的值。 1voidfunc()2{3doublegyroXrate,gyroYrate,gyroZrate,dt=0.01;4/*Update all the IMU values*/5updateMPU6050();6updateHMC5883();78//dt = (double)(micros - timer) / 1000;//Calculate delta time9//timer...
由于我手里有一块STM32的飞控板子,上面集成了mpu6050模块,所以先在STM32平台下进行了测试,上位机选择了Processing,这块源码可以参考FreeIMU,mpu6050的驱动参考官方Invensense Motion Driver,kalman filter可以参考Example-Sketch-for-IMU-including-Kalman-filter。
本文用于记录平衡自行车的制作过程,及制作中遇到的问题;总体方案如下:采用STM32F103C8T6作为主控单元、MPU6050作为位姿采集单元、无刷电机带动动量轮调节小车平衡、1S锂电池配合5V和12V升压模块作为电源、蓝牙模块用于和微信小程序进行无线遥控及PID调试、舵机用于控制行驶方向和支撑小车站立。
#include“stm32f10x.h” #include“I2C_MPU6050.h” #include“usart1.h” #include“delay.h” #include“filter.h” #include“math.h” #include“misc.h” #include“TIMX.h” #defineAIN2PBout(15) #defineAIN1PBout(14) #defineBIN1PBout(13) ...
#include“stm32f10x.h” #include“Kalman_Filter.h” //卡尔曼滤波参数与函数 floatdt=0.001;//注意:dt的取值为kalman滤波器采样时间 floatangle,angle_dot;//角度和角速度 floatP[2][2]={{1,0}, {0,1}}; floatPdot[4]={0,0,0,0}; ...
#include "stm32f10x.h" #include "Kalman_Filter.h" //卡尔曼滤波参数与函数 float dt=0.001;//注意:dt的取值为kalman滤波器采样时间 float angle, angle_dot;//角度和角速度 float P[2][2] = {{ 1, 0 }, { 0, 1 }}; float Pdot[4] ={ 0,0,0,0}; ...
MPU6050.KalmanAngleX The Kalman filter algorithm for calculating angles is taken from the projecthttps://github.com/TKJElectronics/KalmanFilter Russian note ПростаябиблиотеканаСи (STM32 HAL) дляработысмодулем GY-521 (MPU6050)https://www.aliexpress....