Skip to content

Commit

Permalink
barrel heat regulation added, still need some final adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
CuboiLeo committed May 30, 2024
1 parent 878b34c commit 60fdeb9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/app/inc/launch_task.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#define FLYWHEEL_VELOCITY_23 (6000.0f * M3508_REDUCTION_RATIO)
#define FLYWHEEL_VELOCITY_30 (7000.0f * M3508_REDUCTION_RATIO)
#define FEED_HOLE_NUM (6.0f)
#define LAUNCH_FREQUENCY (10)
#define LAUNCH_FREQUENCY (15)
#define LAUNCH_PERIOD (1000.0f/LAUNCH_FREQUENCY)
#define FEED_1_PROJECTILE_ANGLE (2.0f*PI/FEED_HOLE_NUM)
#define FEED_FREQUENCY_6 (6.0f / FEED_HOLE_NUM * 60.0f)
Expand Down
1 change: 1 addition & 0 deletions src/app/src/debug_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@ void Debug_Task_Loop(void)
counter = 0;
}
DEBUG_PRINTF(&huart6, ">calc:%d\n>ref:%d\n",g_launch_target.calculated_heat,Referee_Robot_State.Shooter_Heat_1);
DEBUG_PRINTF(&huart6, ">feed_angle:%f\n>total_angle:%f\n",g_launch_target.feed_angle,g_motor_feed->stats->total_angle_rad);
#endif
}
14 changes: 7 additions & 7 deletions src/app/src/launch_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ void Feed_Angle_Calc()
#ifdef HEAT_CONTROL
if (Referee_System.Online_Flag)
{
// if (g_launch_target.heat_count*2 % 100 == 0)
// {
// g_launch_target.calculated_heat -= Referee_Robot_State.Cooling_Rate/10;
// __MAX_LIMIT(g_launch_target.calculated_heat,0,Referee_Robot_State.Heat_Max);
// }
if (g_launch_target.heat_count*2 % 100 == 0)
{
g_launch_target.calculated_heat -= Referee_Robot_State.Cooling_Rate/10;
__MAX_LIMIT(g_launch_target.calculated_heat,0,Referee_Robot_State.Heat_Max);
}
if (g_launch_target.heat_count*2 % 1000 == 0)
{
g_launch_target.calculated_heat = Referee_Robot_State.Shooter_Heat_1;
}
Expand All @@ -107,10 +107,10 @@ void Feed_Angle_Calc()
if (g_launch_target.launch_freq_count*2 > LAUNCH_PERIOD)
{
g_launch_target.launch_freq_count = 0;
if((Referee_Robot_State.Heat_Max-g_launch_target.calculated_heat) > 10)
if((Referee_Robot_State.Heat_Max-g_launch_target.calculated_heat) > 20)
{
g_launch_target.calculated_heat += 10;
g_launch_target.feed_angle = DJI_Motor_Get_Total_Angle(g_motor_feed) + FEED_1_PROJECTILE_ANGLE;
g_launch_target.feed_angle += FEED_1_PROJECTILE_ANGLE;
DJI_Motor_Set_Control_Mode(g_motor_feed, POSITION_CONTROL_TOTAL_ANGLE);
DJI_Motor_Set_Angle(g_motor_feed,g_launch_target.feed_angle);
}
Expand Down
1 change: 1 addition & 0 deletions src/app/src/robot.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ void Robot_Cmd_Loop()
g_launch_target.single_launch_finished_flag = 0;
g_launch_target.burst_launch_flag = 0;
g_launch_target.launch_freq_count = 0;
g_launch_target.feed_angle = DJI_Motor_Get_Total_Angle(g_motor_feed);
}
}
else
Expand Down

0 comments on commit 60fdeb9

Please sign in to comment.