2024/1/25飞行测试
This commit is contained in:
@ -23,6 +23,7 @@ void mymain()
|
||||
Angel_closed_loop(motory,&FOCStruct_Y,2.3);
|
||||
i++;
|
||||
}
|
||||
i=0;
|
||||
LED_ON;
|
||||
while(1)
|
||||
{
|
||||
@ -32,8 +33,8 @@ void mymain()
|
||||
y = Angle.roll ;
|
||||
Zitai_closed_loop(motorx,&FOCStruct_X,x);
|
||||
Zitai_closed_loop(motory,&FOCStruct_Y,-y);
|
||||
x = getAngle(motorx);
|
||||
y = getAngle(motory);
|
||||
// x = getAngle(motorx);
|
||||
// y = getAngle(motory);
|
||||
// printf("%fY%f\n",x,y);
|
||||
// speed_closed_loop(motorx,&FOCStruct_X,_2PI*5);
|
||||
// speed_closed_loop(motory,&FOCStruct_Y,_2PI*2);
|
||||
@ -44,7 +45,7 @@ void mymain()
|
||||
// }
|
||||
// i++;
|
||||
//
|
||||
// Data_send(x,y,0,0);
|
||||
Data_send(x,y);
|
||||
// HAL_Delay(3);
|
||||
}
|
||||
}
|
@ -5,11 +5,12 @@
|
||||
#include "usart_ano.h"
|
||||
unsigned char Data_Buff[32] ={0XAA,0XFF,0XF1};
|
||||
//AA FF F1 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 AA 37
|
||||
void Data_send(int32_t _a,int32_t _b,int32_t _c,int32_t _d)
|
||||
void Data_send(int32_t _a,int32_t _b)
|
||||
{
|
||||
unsigned char i,cnt=4;
|
||||
unsigned char sc=0,ac=0;
|
||||
|
||||
Data_Buff[3]=0x08;
|
||||
Data_Buff[cnt++] = BYTE0(_a);
|
||||
Data_Buff[cnt++] = BYTE1(_a);
|
||||
Data_Buff[cnt++] = BYTE2(_a);
|
||||
@ -20,19 +21,6 @@ void Data_send(int32_t _a,int32_t _b,int32_t _c,int32_t _d)
|
||||
Data_Buff[cnt++] = BYTE2(_b);
|
||||
Data_Buff[cnt++] = BYTE3(_b);
|
||||
|
||||
Data_Buff[cnt++] = BYTE0(_c);
|
||||
Data_Buff[cnt++] = BYTE1(_c);
|
||||
Data_Buff[cnt++] = BYTE2(_c);
|
||||
Data_Buff[cnt++] = BYTE3(_c);
|
||||
|
||||
Data_Buff[cnt++] = BYTE0(_d);
|
||||
Data_Buff[cnt++] = BYTE1(_d);
|
||||
Data_Buff[cnt++] = BYTE2(_d);
|
||||
Data_Buff[cnt++] = BYTE3(_d);
|
||||
|
||||
|
||||
Data_Buff[3]=cnt-4;
|
||||
|
||||
for(i=0;i<cnt;i++)
|
||||
{
|
||||
sc+=Data_Buff[i];
|
||||
|
@ -10,6 +10,6 @@
|
||||
#define BYTE2(dwTemp) ( *( (char *)(&dwTemp) + 2) )
|
||||
#define BYTE3(dwTemp) ( *( (char *)(&dwTemp) + 3) )
|
||||
|
||||
|
||||
void Data_send(int32_t _a,int32_t _b,int32_t _c,int32_t _d);
|
||||
void Data_send(int32_t _a,int32_t _b);
|
||||
//void Data_send(int32_t _a,int32_t _b,int32_t _c,int32_t _d);
|
||||
#endif //FOC_N_USART_ANO_H
|
||||
|
Reference in New Issue
Block a user