2023/3/13第五次参数飞行测试
This commit is contained in:
40
APP/mymain.c
40
APP/mymain.c
@ -1,12 +1,12 @@
|
||||
//
|
||||
// Created by hu123456 on 2024/1/16.
|
||||
// Created by lijie on 2024/1/16.
|
||||
//
|
||||
|
||||
#include "mymain.h"
|
||||
|
||||
void mymain()
|
||||
{
|
||||
HAL_UART_Receive_IT(&huart1, (uint8_t *)g_rx_buffer, RXBUFFERSIZE); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
||||
setvbuf(stdout, NULL, _IONBF, 0); //<2F><><EFBFBD><EFBFBD>printfû<66><C3BB>\n<><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
HAL_Delay(2000);
|
||||
led_init();
|
||||
adc_init();
|
||||
@ -15,34 +15,32 @@ void mymain()
|
||||
imu_rest();
|
||||
moto_Init();
|
||||
PID_Iint();
|
||||
setvbuf(stdout, NULL, _IONBF, 0); //<2F><><EFBFBD><EFBFBD>printfû<66><C3BB>\n<><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
float x = 0,y=0;
|
||||
unsigned int i =0;
|
||||
unsigned int a =0;
|
||||
HAL_TIM_Base_Start(&htim5); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
// while(i<2000*1)
|
||||
// {
|
||||
//// MpuGetData();
|
||||
//// GetAngle(&ICM42688,&Angle);
|
||||
// Angel_closed_loop(motorx,&FOCStruct_X,3.0);
|
||||
// Angel_closed_loop(motory,&FOCStruct_Y,2.2);
|
||||
// i++;
|
||||
// }
|
||||
// i=0;
|
||||
|
||||
while(a<2200*6)
|
||||
{
|
||||
MpuGetData();
|
||||
GetAngle(&ICM42688,&Angle);
|
||||
// Angel_closed_loop(motorx,&FOCStruct_X,x);
|
||||
// Angel_closed_loop(motory,&FOCStruct_Y,y);
|
||||
a++;
|
||||
}
|
||||
// LED_ON;
|
||||
while(1)
|
||||
{
|
||||
// MpuGetData();
|
||||
// GetAngle(&ICM42688,&Angle);
|
||||
// x = Angle.pitch;
|
||||
// y = Angle.roll;
|
||||
// Zitai_closed_loop(motorx,&FOCStruct_X,x);
|
||||
// Zitai_closed_loop(motory,&FOCStruct_Y,-y);
|
||||
MpuGetData();
|
||||
GetAngle(&ICM42688,&Angle);
|
||||
x = Angle.pitch;
|
||||
y = Angle.roll + 90.f;
|
||||
Zitai_closed_loop(motorx,&FOCStruct_X,x);
|
||||
Zitai_closed_loop(motory,&FOCStruct_Y,-y);
|
||||
// commander_run();
|
||||
// x = getAngle(motorx);
|
||||
// y = getAngle(motory);
|
||||
// x= get_VCC();
|
||||
// printf("%fY%f\n",x,y);
|
||||
// HAL_Delay(2);
|
||||
// HAL_Delay(10);
|
||||
// speed_closed_loop(motorx,&FOCStruct_X,_2PI*5);
|
||||
// speed_closed_loop(motory,&FOCStruct_Y,_2PI*2);
|
||||
// printf("b%d\n",b);
|
||||
|
Reference in New Issue
Block a user