rm_balance/User/module/balance_chassis.h

62 lines
1.6 KiB
C

#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ----------------------------------------------------------------- */
#include "device/motor.h"
#include "device/motor_lz.h"
#include "device/motor_lk.h"
#include "device/device.h"
/* USER INCLUDE BEGIN */
/* USER INCLUDE END */
/* USER DEFINE BEGIN */
/* USER DEFINE END */
/* Exported constants ------------------------------------------------------- */
/* Exported macro ----------------------------------------------------------- */
/* Exported types ----------------------------------------------------------- */
typedef struct {
MOTOR_LZ_Param_t joint_param[4]; // 4个电机参数
MOTOR_LK_Param_t wheel_param[2]; // 2个轮子电机参数
} Chassis_Param_t;
typedef struct {
MOTOR_Feedback_t joint[4]; // 4个电机反馈数据
MOTOR_Feedback_t wheel[2]; // 2个轮子电机反馈数据
} Chassis_Feedback_t;
typedef struct {
float joint[4]; // 4个电机反馈数据
float wheel[2]; // 2个轮子电机反馈数据
} Chassis_Output_t;
typedef struct {
Chassis_Param_t param; // 底盘参数配置
Chassis_Feedback_t data; // 底盘反馈数据
Chassis_Output_t output; // 底盘输出数据
} Chassis_t;
/* USER STRUCT BEGIN */
/* USER STRUCT END */
/* Exported functions prototypes -------------------------------------------- */
int8_t Chassis_Init(Chassis_t *chassis, Chassis_Param_t *param);
int8_t Chassis_Update(Chassis_t *chassis);
int8_t Chassis_Enable(Chassis_t *chassis);
int8_t Chassis_Relax(Chassis_t *chassis);
int8_t Chassis_Ctrl(Chassis_t *chassis);
/* USER FUNCTION BEGIN */
/* USER FUNCTION END */
#ifdef __cplusplus
}
#endif