gimbal/User/device/ai.c

37 lines
664 B
C

#include "ai.h"
#include <string.h>
#include "bsp\uart.h"
#include "component\crc16.h"
#include "component\crc8.h"
#include "component\user_math.h"
#include "gimbal.h"
#include "remote_control.h"
#define a_pit 0.000744005
#define b_pit 0.10966763
#define a_yaw 0.0078782936
#define b_yaw 0.011819322
int8_t remote_ParseHost(Gimbal_CMD_t *g_cmd,RC_ctrl_t *rc_ctrl,Gimbal_IMU_t*imu)
{
if(rc_ctrl->sw[2]==1800){
g_cmd->mode=GIMBAL_MODE_ABSOLUTE;
g_cmd->delta_pit=((rc_ctrl->ch[2]-780)*(0.6/791));//806~-780,0.473~-0.71
g_cmd->delta_yaw=((rc_ctrl->ch[0])*(1.2/808));//400~-397
}
else if(rc_ctrl->sw[2]==200)
{
g_cmd->mode=GIMBAL_MODE_RELAX;
}
}