Skip to content

Commit

Permalink
power regulation restored
Browse files Browse the repository at this point in the history
  • Loading branch information
CuboiLeo committed Jun 15, 2024
1 parent 637e7b4 commit daf810b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/algo/src/Swerve_Locomotion.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ void Swerve_Drive(float x, float y, float omega)
{
__MOVING_AVERAGE(g_robot_state.chassis_power_buffer,g_robot_state.chassis_power_index,
Referee_Robot_State.Chassis_Power,g_robot_state.chassis_power_count,g_robot_state.chassis_total_power,g_robot_state.chassis_avg_power);
if(g_robot_state.chassis_avg_power < (Referee_Robot_State.Chassis_Power_Max*(0.9f-Referee_Robot_State.Level*0.2f)))
if(g_robot_state.chassis_avg_power < (Referee_Robot_State.Chassis_Power_Max*(0.7f)))
g_robot_state.power_increment_ratio += 0.001f;
else
g_robot_state.power_increment_ratio -= 0.001f;
Expand Down
2 changes: 1 addition & 1 deletion src/app/src/motor_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
8 changes: 4 additions & 4 deletions src/app/src/ui_task.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "ui_task.h"
#include "supercap.h"

void UI_Task_Loop(void)
{
Expand Down Expand Up @@ -45,10 +46,9 @@ void UI_Task_Loop(void)
ui_indicator_1_Aim_H_Line->color = 3;
ui_indicator_1_Aim_V_Line->color = 3;
}
if (ui_indicator_1_Supercap->number>=99)
{
ui_indicator_1_Supercap->number = 0;
}

ui_indicator_1_Supercap->number = g_supercap.supercap_percent;

if(Referee_System.Online_Flag)
{
ui_indicator_1_Level_Indicator->number = Referee_Robot_State.Level;
Expand Down
2 changes: 2 additions & 0 deletions src/devices/inc/supercap.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ void Supercap_Init(Supercap_t *g_supercap);
void Supercap_Decode(CAN_Instance_t *can_instance);
void Supercap_Send(void);

extern Supercap_t g_supercap;

#endif // __SUPERCAP_H

0 comments on commit daf810b

Please sign in to comment.