欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136
標(biāo)題:
stm32f429使用mpu6050檢測風(fēng)力擺角度 四元數(shù)法
[打印本頁]
作者:
y1887655
時間:
2017-8-10 19:31
標(biāo)題:
stm32f429使用mpu6050檢測風(fēng)力擺角度 四元數(shù)法
mpu6050芯片四元數(shù)法計(jì)算風(fēng)力擺擺動角度
所有資料51hei提供下載:
六軸.rar
(1009.29 KB, 下載次數(shù): 71)
2017-8-10 19:30 上傳
點(diǎn)擊文件名下載附件
角度檢測
下載積分: 黑幣 -5
stm32f429單片機(jī)源程序如下(主程序):
#include "sys.h"
#include "delay.h"
#include "usart.h"
#include "led.h"
#include "key.h"
#include "myiic.h"
#include "mpu6050.h"
#include "siyuanshu.h"
/*簡單任務(wù)管理*/
uint32_t Task_Delay[3]={0};
//extern AHRS_EulerAngleTypeDef EulerAngle;
int main(void)
{
u8 res=0;
// float pitch_temp1 = 0.0;
// float roll_temp1 = 0.0;
extern float Pitch;
extern float Roll;
HAL_Init(); //初始化HAL庫
Stm32_Clock_Init(360,25,2,8); //設(shè)置時鐘,180Mhz
delay_init(180); //初始化延時函數(shù)
uart_init(115200); //初始化USART
LED_Init(); //初始化LED
KEY_Init(); //初始化按鍵
IIC_Init(); //初始iic
/*
short Acel[3];
short Gyro[3];
float Temp;
*/
short aacx,aacy,aacz; //加速度傳感器原始數(shù)據(jù)
short gyrox,gyroy,gyroz; //陀螺儀原始數(shù)據(jù)
float temp; //溫度
printf("\r\n 歡迎使用阿波羅 STM32 F429 開發(fā)板。\r\n");
printf("\r\n 這是一個I2C外設(shè)(AT24C02)讀寫測試?yán)?\r\n");
MPU_Init();
res=MPU_Read_Byte(MPU_DEVICE_ID_REG); //讀取MPU6500的ID
if (res==MPU_ADDR)
{
while(1)
{
// if(Task_Delay[0]==0)
// {
// LED1=0;
//
// Task_Delay[0]=1000;
// }
//
// if(Task_Delay[1]==0)
// {
/*
MPU6050ReadAcc(Acel);
printf("加速度:%8d%8d%8d",Acel[0],Acel[1],Acel[2]);
MPU6050ReadGyro(Gyro);
printf(" 陀螺儀%8d%8d%8d",Gyro[0],Gyro[1],Gyro[2]);
MPU6050_ReturnTemp(&Temp);
printf(" 溫度%8.2f\r\n",Temp);
Task_Delay[1]=500; //更新一次數(shù)據(jù),可根據(jù)自己的需求,提高采樣頻率,如100ms采樣一次
*/
temp=MPU_Get_Temperature(); //得到溫度值
printf("溫度:%8f",temp);
MPU_Get_Accelerometer(&aacx,&aacy,&aacz); //得到加速度傳感器數(shù)據(jù)
printf("加速度:%8d%8d%8d",aacx,aacy,aacz);
MPU_Get_Gyroscope(&gyrox,&gyroy,&gyroz); //得到陀螺儀數(shù)據(jù)
printf("陀螺儀:%8d%8d%8d\r\n",gyrox,gyroy,gyroz);
// Task_Delay[1]=500; //更新一次數(shù)據(jù),可根據(jù)自己的需求,提高采樣頻率,如100ms采樣一次
// EulerAngle.Pitch = Kalman_Filter1(pitch_temp1,gyroy);
// EulerAngle.Roll = Kalman_Filter2(roll_temp1,-gyrox);
//
// printf("俯仰角:%8f",EulerAngle.Pitch);
// printf("橫滾角:%8f\r\n",EulerAngle.Roll);
IMUupdate(gyrox,gyroy,gyroz,aacx,aacy,aacz);
printf("俯仰角:%8f橫滾角:%8f\r\n", Pitch,Roll);
delay_ms(100);
// }
}
}
else
{
printf("\r\n沒有檢測到MPU6050傳感器!\r\n");
LED0=0;
while(1);
}
}
復(fù)制代碼
作者:
iYoutudou
時間:
2021-2-4 11:11
請問樓主,實(shí)際效果如何?
歡迎光臨 (http://m.raoushi.com/bbs/)
Powered by Discuz! X3.1