HuanYan/User/module/cap.h
2025-09-30 20:14:32 +08:00

61 lines
1.4 KiB
C
Raw 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
#include "device/supercap.h"
#include "device/motor_rm.h"
#include "component/user_math.h"
#include "component/pid.h"
//#include "device/referee.h"
/**
* @brief 电机测量数据结构体兼容RM电机库
*/
typedef struct {
float speed_rpm; // 电机转速(RPM)
float current; // 电机电流(A)
float angle; // 电机角度(rad)
uint8_t temperature; // 电机温度(℃)
// 其他测量数据...
} chassis_motor_measure_t;
/**
* @brief 底盘电机结构体兼容RM电机库
*/
typedef struct {
chassis_motor_measure_t *chassis_motor_measure; // 电机测量数据指针
// 其他电机控制相关成员...
} chassis_motor_t;
/**
* @brief 底盘运动控制结构体
*/
typedef struct {
/* 4个电机的PID控制器 - 使用现有的KPID_t结构 */
KPID_t motor_speed_pid[4];
/* 4个底盘电机实例 - 兼容RM电机库 */
chassis_motor_t motor_chassis[4];
/* 功率控制相关 */
float total_power; // 底盘总功率
float power_limit; // 功率限制值
uint8_t power_state; // 功率状态
/* 底盘状态信息 */
float velocity_x; // X轴速度
float velocity_y; // Y轴速度
float angular_velocity; // 角速度
// 其他底盘控制相关变量...
} chassis_move_t;
void set_chassis_power(float power);
void chassis_power_control_with_supercap(chassis_move_t *chassis_power_control);
#ifdef __cplusplus
}
#endif