diff --git a/diaoerqiege/BHBF_Robot_Lifting_Lug/.settings/language.settings.xml b/diaoerqiege/BHBF_Robot_Lifting_Lug/.settings/language.settings.xml index 15fa460..07f8dd5 100644 --- a/diaoerqiege/BHBF_Robot_Lifting_Lug/.settings/language.settings.xml +++ b/diaoerqiege/BHBF_Robot_Lifting_Lug/.settings/language.settings.xml @@ -5,7 +5,7 @@ - + @@ -16,7 +16,7 @@ - + diff --git a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Inc/FSM.h b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Inc/FSM.h index 1660c22..8ac6494 100644 --- a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Inc/FSM.h +++ b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Inc/FSM.h @@ -16,7 +16,7 @@ typedef enum _MoveSTATE_t Manual_State, low_Speed_Manual_State, AUTO_FORWARD, - + AUTO_BACKWARD } MoveSTATE_t; typedef enum _Front_MoveSTATE_t diff --git a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Inc/robot_state.h b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Inc/robot_state.h index 73c9fea..2c776ce 100644 --- a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Inc/robot_state.h +++ b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Inc/robot_state.h @@ -19,7 +19,7 @@ extern void Manual_State_Do(void); extern void low_Speed_Manual_State_Do(void); extern void HALT_State_Do(void); extern void auto_forward_state_do(void); - +extern void auto_backward_state_do(void); // ********前端升降电机*********** extern void Manual_Up_State_Do(void); diff --git a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/FSM.c b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/FSM.c index 8fc97c5..e8a7cd6 100644 --- a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/FSM.c +++ b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/FSM.c @@ -35,8 +35,8 @@ transition_t MoveTransitions[] = { Move_HALT, HALT_State_Do }, { Manual_State, Manual_State_Do }, { low_Speed_Manual_State, low_Speed_Manual_State_Do}, - { AUTO_FORWARD, auto_forward_state_do} - + { AUTO_FORWARD, auto_forward_state_do}, + { AUTO_BACKWARD, auto_backward_state_do} }; transition_t FrontendMoveTransitions[] = diff --git a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/robot_state.c b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/robot_state.c index 11b6e54..fccc040 100644 --- a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/robot_state.c +++ b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/robot_state.c @@ -397,6 +397,23 @@ void auto_forward_state_do(void) GV.RightBackMotor.Target_Velcity = -Ref_Speed; } +void auto_backward_state_do(void) +{ + if((GV.MK32_Key.CH10_LD1 >= -1000) && (GV.MK32_Key.CH10_LD1 <= 1000)) + { + speedAdj = -995.0f + (GV.MK32_Key.CH10_LD1 + 1000.0f) * 0.005f; + Speed_Ctrl = ((speedAdj + 1000) * 360 / 1000); + } + + Ref_Speed = Speed_Ctrl; + Act_Speed =Speed_Ctrl; + if(Ref_Speed >= 5000) Ref_Speed = 5000; + + GV.LeftFrontMotor.Target_Velcity = -Ref_Speed; + GV.RightFrontMotor.Target_Velcity = Ref_Speed; + GV.LeftBackMotor.Target_Velcity = -Ref_Speed; + GV.RightBackMotor.Target_Velcity = Ref_Speed; +}