#ifndef __GO_M8010_6_H #define __GO_M8010_6_H #ifdef __cplusplus extern "C"{ #endif #include "main.h" #include "crc16.h" #include "usart.h" #include "string.h" #include #define GO_NUM 2 /** * @brief * */ typedef struct { uint8_t id :4; uint8_t status :3; uint8_t none :1; } RIS_Mode_t /*__attribute__((packed))*/; /** * @brief ���״̬������Ϣ * */ typedef struct { int16_t tor_des; // �����ؽ����Ť�� unit: N.m (q8) int16_t spd_des; // �����ؽ�����ٶ� unit: rad/s (q7) int32_t pos_des; // �����ؽ����λ�� unit: rad (q15) uint16_t k_pos; // �����ؽڸն�ϵ�� unit: 0.0-1.0 (q15) uint16_t k_spd; // �����ؽ�����ϵ�� unit: 0.0-1.0 (q15) } RIS_Comd_t; // ���Ʋ��� 12Byte /** * @brief �������ݰ���ʽ * */ typedef struct { uint8_t head[2]; // ��ͷ 2Byte RIS_Mode_t mode; // �������ģʽ 1Byte RIS_Comd_t comd; // ����������� 12Byte uint16_t CRC16; // CRC 2Byte } ControlData_t; // ������������ 17Byte typedef struct { unsigned short id; unsigned short mode; uint16_t correct; int MError; int Temp; float tar_pos; // target position float tar_w; // target speed float T; // ��ǰʵ�ʵ��������� float W; // ��ǰʵ�ʵ���ٶȣ����٣� float Pos; // ��ǰ���λ�� int footForce; // They dont even know what 7 is this so we dont update this uint8_t buffer[17]; uint8_t Rec_buffer[16]; ControlData_t motor_send_data; }GO_Motorfield; void GO_M8010_init(void); void GO_M8010_send_data(UART_HandleTypeDef *huart,int id, int rev,float T,float W,float Pos,float K_P,float K_W); void USART6_RxCompleteCallback(void ); void uartTxCB(UART_HandleTypeDef *huart); void basic_ForceControl (UART_HandleTypeDef *huart, int id, float bias, float length, float mass, float tar_pos, float tar_w, float K_P,float K_W); GO_Motorfield* getGoPoint(uint8_t id); #ifdef __cplusplus } #endif #endif /*__GO_M8010_6_H */