From df518c97a5718d744361f3b95946f45b3a9a7ce4 Mon Sep 17 00:00:00 2001 From: Jingxiao Teng Date: Fri, 14 Jun 2024 00:45:04 -0600 Subject: [PATCH] Heat Regulation Changed --- src/app/inc/launch_task.h | 2 +- src/app/src/launch_task.c | 5 ++++- src/app/src/motor_task.c | 2 +- src/app/src/robot.c | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/app/inc/launch_task.h b/src/app/inc/launch_task.h index 84c5db8..d7bdee0 100644 --- a/src/app/inc/launch_task.h +++ b/src/app/inc/launch_task.h @@ -15,7 +15,7 @@ #define FEED_FREQUENCY_20 (20.0f / FEED_HOLE_NUM * 60.0f) #define FEED_FREQUENCY_30 (30.0f / FEED_HOLE_NUM * 60.0f) -//#define HEAT_CONTROL +#define HEAT_CONTROL typedef struct { diff --git a/src/app/src/launch_task.c b/src/app/src/launch_task.c index a85430e..3e24fac 100644 --- a/src/app/src/launch_task.c +++ b/src/app/src/launch_task.c @@ -93,6 +93,10 @@ void Feed_Angle_Calc() #ifdef HEAT_CONTROL if (Referee_System.Online_Flag) { + if (Referee_System.Robot_State.Shooter_Power_Output == 0) + { + g_launch_target.feed_angle = g_motor_feed->stats->total_angle_rad; + } if (g_launch_target.heat_count*2 % 100 == 0) { g_launch_target.calculated_heat -= Referee_Robot_State.Cooling_Rate/10; @@ -107,7 +111,6 @@ void Feed_Angle_Calc() { g_launch_target.calculated_heat += 10; g_launch_target.feed_angle += FEED_1_PROJECTILE_ANGLE; - } } DJI_Motor_Set_Control_Mode(g_motor_feed, POSITION_CONTROL_TOTAL_ANGLE); diff --git a/src/app/src/motor_task.c b/src/app/src/motor_task.c index 58119ed..83e1a7f 100644 --- a/src/app/src/motor_task.c +++ b/src/app/src/motor_task.c @@ -7,7 +7,7 @@ extern Supercap_t g_supercap; void Motor_Task_Loop() { - // DJI_Motor_Send(); + DJI_Motor_Send(); // MF_Motor_Send(); // DM_Motor_Send(); diff --git a/src/app/src/robot.c b/src/app/src/robot.c index 54dc263..c16c788 100644 --- a/src/app/src/robot.c +++ b/src/app/src/robot.c @@ -140,7 +140,7 @@ void Robot_Cmd_Loop() /* Launch control starts here */ g_launch_target.heat_count++; - if (1)//Referee_Robot_State.Shooter_Heat_1 < (Referee_Robot_State.Heat_Max-10)) + if (Referee_Robot_State.Shooter_Heat_1 < (Referee_Robot_State.Heat_Max-10)) { if (g_remote.controller.wheel < -50.0f) { // dial wheel forward single fire