Infantry/User/device/ai.h
yunhai8432 054430fe49 touch README.md
git init
git checkout -b main
git add README.md
git commit -m "first commit"
git remote add origin ssh://git@gitea.qutrobot.top:222/yunhai/Infantry.git
git push -u origin main
2026-01-09 09:50:07 +08:00

81 lines
1.4 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* 自瞄模组
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ----------------------------------------------------------------- */
#include "component\user_math.h"
#include "gimbal.h"
struct __attribute__((packed)) GimbalToVision
{
uint8_t head[2];
uint8_t mode; // 0: 空闲, 1: 自瞄, 2: 小符, 3: 大符
float q[4]; // wxyz顺序 /q4,q0,q1,q2/
float yaw;
float yaw_vel;
float pitch;
float pitch_vel;
float bullet_speed;
uint16_t bullet_count; // 子弹累计发送次数
uint16_t crc16;
};
struct __attribute__((packed)) VisionToGimbal
{
uint8_t head[2];
uint8_t mode; // 0: 不控制, 1: 控制云台但不开火2: 控制云台且开火
float yaw;
float yaw_vel;
float yaw_acc;
float pitch;
float pitch_vel;
float pitch_acc;
uint16_t crc16;
};
typedef struct __attribute__((packed)) {
uint8_t mode;
struct{
// Gimbal_CMD_t g_cmd;
struct{
float yaw;
float pit;
}setpoint;
struct{
float pit;
float yaw;
}accl;
struct{
float pit;
float yaw;
}vel;
}gimbal_t;
}AI_cmd_t;
typedef struct __attribute__((packed)) {
struct GimbalToVision TX;
struct VisionToGimbal RX;
}AI_t;
int8_t AI_StartReceiving(AI_t *ai);
int8_t AI_Get_NUC(AI_t *ai,AI_cmd_t* ai_cmd);
int8_t AI_ParseHost(AI_t* ai,Gimbal_Feedback_t* g_feedback);
int8_t AI_StartSend(AI_t *ai);
#ifdef __cplusplus
}
#endif