修热量控制逻辑,待测
This commit is contained in:
parent
a692457d79
commit
94c980caef
@ -322,9 +322,15 @@ int8_t MOTOR_DM_Update(MOTOR_DM_Param_t *param) {
|
||||
return DEVICE_ERR;
|
||||
}
|
||||
|
||||
bool was_online = motor->motor.header.online;
|
||||
motor->motor.header.online = true;
|
||||
motor->motor.header.last_online_time = BSP_TIME_Get();
|
||||
MOTOR_DM_ParseFeedbackFrame(motor, rx_msg.data);
|
||||
|
||||
/* 如果刚从掉线状态恢复,自动补发使能指令,解决上电时序和裁判系统断电重连不使能的问题 */
|
||||
if (!was_online) {
|
||||
MOTOR_DM_Enable(param);
|
||||
}
|
||||
|
||||
return DEVICE_OK;
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ static void CMD_RC_BuildGimbalCmd(CMD_t *ctx) {
|
||||
}
|
||||
|
||||
/* 左摇杆控制云台 */
|
||||
ctx->output.gimbal.cmd.delta_yaw = -ctx->input.rc.joy_left.x * 4.0f;
|
||||
ctx->output.gimbal.cmd.delta_yaw = -ctx->input.rc.joy_left.x * 2.0f;
|
||||
ctx->output.gimbal.cmd.delta_pit = -ctx->input.rc.joy_left.y * 2.5f;
|
||||
}
|
||||
#endif /* CMD_ENABLE_SRC_RC && CMD_ENABLE_MODULE_GIMBAL */
|
||||
|
||||
@ -286,6 +286,7 @@ Config_RobotParam_t robot_config = {
|
||||
},
|
||||
.heatControl={
|
||||
.enable=true,
|
||||
.safe_shots=1, // 安全出弹余量
|
||||
.nmax=2.0f, // 最大射频 Hz
|
||||
.Hwarn=200.0f, // 热量预警值
|
||||
.Hsatu=100.0f, // 热量饱和值
|
||||
|
||||
@ -41,7 +41,7 @@ void Task(void *argument) {
|
||||
/* Private typedef ---------------------------------------------------------- */
|
||||
/* Private define ----------------------------------------------------------- */
|
||||
#define MAX_FRIC_RPM 7000.0f
|
||||
#define MAX_TRIG_RPM 1500.0f//这里可能也会影响最高发射频率,待测试
|
||||
#define MAX_TRIG_RPM 4000.0f//这里可能也会影响最高发射频率,待测试
|
||||
|
||||
/* 发射检测参数 */
|
||||
#define SHOT_DETECT_RPM_DROP_THRESHOLD 100.0f /* 摩擦轮转速下降阈值,单位rpm */
|
||||
@ -512,8 +512,13 @@ int8_t Shoot_CaluTargetAngle(Shoot_t *s, Shoot_CMD_t *cmd)
|
||||
/* 根据热量控制计算实际射频 */
|
||||
float actual_freq = Shoot_CaluFreqByHeat(s);
|
||||
|
||||
/* 检查可发射弹丸数是否满足安全余量 */
|
||||
if (s->param->heatControl.enable && s->heatcontrol.shots_available <= s->param->heatControl.safe_shots) {
|
||||
actual_freq = 0.0f; /* 禁止发弹 */
|
||||
}
|
||||
|
||||
float dt = s->timer.now - s->var_trig.time_lastShoot;
|
||||
float dpos;
|
||||
float dpos;
|
||||
dpos = CircleError(s->target_variable.trig_angle, s->var_trig.trig_agl, M_2PI);
|
||||
|
||||
/* 使用热量控制计算出的射频,而不是配置的固定射频 */
|
||||
@ -966,7 +971,7 @@ int8_t Shoot_Control(Shoot_t *s, Shoot_CMD_t *cmd)
|
||||
s->timer.now = BSP_TIME_Get_us() / 1000000.0f;
|
||||
s->timer.dt = (BSP_TIME_Get_us() - s->timer.lask_wakeup) / 1000000.0f;
|
||||
s->timer.lask_wakeup = BSP_TIME_Get_us();
|
||||
// Shoot_CaluTargetRPM(s,233);
|
||||
Shoot_CaluTargetRPM(s,233);
|
||||
|
||||
/* 运行热量检测状态机 */
|
||||
// Shoot_HeatDetectionFSM(s);
|
||||
|
||||
@ -164,6 +164,7 @@ typedef struct {
|
||||
}jamDetection;/* 卡弹检测参数 */
|
||||
struct {
|
||||
bool enable; /* 是否启用热量控制 */
|
||||
uint16_t safe_shots;/* 安全余量,当shots_available小于等于该值时禁止发弹 */
|
||||
float nmax;//最大射频
|
||||
float Hwarn;//热量预警值
|
||||
float Hsatu;//热量饱和值
|
||||
|
||||
@ -66,14 +66,14 @@ void Task_ctrl_chassis(void *argument) {
|
||||
: 500.0f;
|
||||
Chassis_Power_Control(&chassis, power_limit);
|
||||
|
||||
// Chassis_Output(&chassis);
|
||||
Chassis_Output(&chassis);
|
||||
|
||||
|
||||
track.middle_val.seata=chassis.feedback.encoder_gimbalYawMotor-chassis.mech_zero;
|
||||
Track_UpdateFeedback(&track);
|
||||
Track_Control(&track, &track_cmd );
|
||||
// Track_AutoControl(&track,&chassis);
|
||||
// Track_Output(&track);
|
||||
Track_Output(&track);
|
||||
|
||||
/* USER CODE END */
|
||||
osDelayUntil(tick); /* 运行结束,等待下一次唤醒 */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user