diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml
index 7c1ad0a..99f53df 100644
--- a/.settings/language.settings.xml
+++ b/.settings/language.settings.xml
@@ -5,7 +5,7 @@
-
+
@@ -16,7 +16,7 @@
-
+
diff --git a/BASE/Src/MSP/msp_U7.c b/BASE/Src/MSP/msp_U7.c
index acfa0de..e30e441 100644
--- a/BASE/Src/MSP/msp_U7.c
+++ b/BASE/Src/MSP/msp_U7.c
@@ -35,7 +35,7 @@ void decode_U7Data(uint8_t *buffer, uint16_t length)
{
system_mode = SYSTEM_RESET;
CurrentMoveState = Move_Reset;
- HALT_State_Do(); // 立即停车并清空状态
+
}
else
{
@@ -56,7 +56,7 @@ void decode_U7Data(uint8_t *buffer, uint16_t length)
else
{
// 还没复位,保持 RESET
- HALT_State_Do();
+ CurrentMoveState = Move_Reset;
}
}
}
@@ -132,16 +132,17 @@ uint8_t IsRemoteAtInitialPosition(void)
{
if(GV.U7_Key.CH0_LYB_V != 0) return 0;
if(GV.U7_Key.CH1_LYB_H != 0) return 0;
- if(GV.U7_Key.LU_Single != -1000) return 0;
- if(GV.U7_Key.LU_Three != 0) return 0;
- if(GV.U7_Key.LU_pulley != 0) return 0;
if(GV.U7_Key.M1 != -1000) return 0;
- if(GV.U7_Key.M2 != -1000) return 0;
- if(GV.U7_Key.M3 != -1000) return 0;
if(GV.U7_Key.M5 != -1000) return 0;
- if(GV.U7_Key.M6 != -1000) return 0;
- if(GV.U7_Key.RU_Single != -1000) return 0;
+ if(GV.U7_Key.M3 != -1000) return 0;
+ if(GV.U7_Key.LU_pulley != 0) return 0;
+ if(GV.U7_Key.RU_pulley != 0) return 0;
+ if(GV.U7_Key.LU_Three != 0) return 0;
if(GV.U7_Key.RU_Three != 0) return 0;
+ if(GV.U7_Key.LU_Single != -1000) return 0;
+ if(GV.U7_Key.RU_Single != -1000) return 0;
+ if(GV.U7_Key.M2 != -1000) return 0;
+ if(GV.U7_Key.M6 != -1000) return 0;
LOG("U7_At_Initial_Posotion");
return 1; // 全部归零
}
diff --git a/Core/Inc/FSM.h b/Core/Inc/FSM.h
index 51ed106..52cdd2a 100644
--- a/Core/Inc/FSM.h
+++ b/Core/Inc/FSM.h
@@ -44,15 +44,12 @@ typedef enum _MoveSTATE_t
Move_Backwards,
Move_TurnLeft,
Move_TurnRight,
-
Move_AutoForward,
Move_AutoBackward,
-
Move_ChgLeft,
Move_ChgRight,
Move_ChgUp,
Move_ChgDown,
-
Move_ChgFinish,
Move_Emergency,
Move_Reset,
diff --git a/Core/Inc/robot_state.h b/Core/Inc/robot_state.h
index a3f6b24..8037166 100644
--- a/Core/Inc/robot_state.h
+++ b/Core/Inc/robot_state.h
@@ -78,9 +78,8 @@ void Forwards_State_Do(void);
void Backwards_State_Do(void);
void TurnLeft_State_Do(void);
void TurnRight_State_Do(void);
-
void HALT_State_Do(void);//停止
-
+void Reset(void);
void SwingHALT_State_Do(void);
void SwingLeft_State_Do(void);
diff --git a/Core/Protobuf/PSource/bsp_IV.pb.h b/Core/Protobuf/PSource/bsp_IV.pb.h
index 4f06d60..32ffb66 100644
--- a/Core/Protobuf/PSource/bsp_IV.pb.h
+++ b/Core/Protobuf/PSource/bsp_IV.pb.h
@@ -27,8 +27,6 @@ typedef struct _IV_struct_define {
int32_t Robot_Compensation_Left;
int32_t Robot_Compensation_Right;
int32_t Robot_RESET;
- int32_t Robot_LaneChange_Left;
- int32_t Robot_LaneChange_Right;
} IV_struct_define;
@@ -37,8 +35,8 @@ extern "C" {
#endif
/* Initializer values for message structs */
-#define IV_struct_define_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
-#define IV_struct_define_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+#define IV_struct_define_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+#define IV_struct_define_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
/* Field tags (for use in manual encoding/decoding) */
#define IV_struct_define_Robot_Move_AutoSpeed_tag 1
@@ -56,8 +54,6 @@ extern "C" {
#define IV_struct_define_Robot_Compensation_Left_tag 13
#define IV_struct_define_Robot_Compensation_Right_tag 14
#define IV_struct_define_Robot_RESET_tag 15
-#define IV_struct_define_Robot_LaneChange_Left_tag 16
-#define IV_struct_define_Robot_LaneChange_Right_tag 17
/* Struct field encoding specification for nanopb */
#define IV_struct_define_FIELDLIST(X, a) \
@@ -75,9 +71,7 @@ X(a, STATIC, SINGULAR, INT32, Robot_Error_Left, 11) \
X(a, STATIC, SINGULAR, INT32, Robot_Error_Right, 12) \
X(a, STATIC, SINGULAR, INT32, Robot_Compensation_Left, 13) \
X(a, STATIC, SINGULAR, INT32, Robot_Compensation_Right, 14) \
-X(a, STATIC, SINGULAR, INT32, Robot_RESET, 15) \
-X(a, STATIC, SINGULAR, INT32, Robot_LaneChange_Left, 16) \
-X(a, STATIC, SINGULAR, INT32, Robot_LaneChange_Right, 17)
+X(a, STATIC, SINGULAR, INT32, Robot_RESET, 15)
#define IV_struct_define_CALLBACK NULL
#define IV_struct_define_DEFAULT NULL
@@ -88,7 +82,7 @@ extern const pb_msgdesc_t IV_struct_define_msg;
/* Maximum encoded size of messages (where known) */
#define BSP_IV_PB_H_MAX_SIZE IV_struct_define_size
-#define IV_struct_define_size 189
+#define IV_struct_define_size 165
#ifdef __cplusplus
} /* extern "C" */
diff --git a/Core/Protobuf/Proto/bsp_CV.proto b/Core/Protobuf/Proto/bsp_CV.proto
index 9159bde..625f82c 100644
--- a/Core/Protobuf/Proto/bsp_CV.proto
+++ b/Core/Protobuf/Proto/bsp_CV.proto
@@ -4,18 +4,14 @@ syntax = "proto3";
message CV_struct_define{
- //洗舱项目
+ //洗舱项目
- int32 RobotMoveSpeedBase = 2;
- int32 SwingMoveSpeedBase =3;
- int32 TiltMoveSpeedBase = 4;
- int32 TiltMoveTargetSpeed = 5;
- int32 SwingMoveTargetSpeed = 6;
- int32 TurnLeftRightSpeed = 7;
-
-
-
+ int32 RobotMoveSpeedBase = 2;
+ int32 SwingMoveSpeedBase =3;
+ int32 TiltMoveSpeedBase = 4;
+ int32 TiltMoveTargetSpeed = 5;
+ int32 SwingMoveTargetSpeed = 6;
+ int32 TurnLeftRightSpeed = 7;
-
};
diff --git a/Core/Protobuf/Proto/bsp_PV.proto b/Core/Protobuf/Proto/bsp_PV.proto
index a5a2bce..a5bcb9d 100644
--- a/Core/Protobuf/Proto/bsp_PV.proto
+++ b/Core/Protobuf/Proto/bsp_PV.proto
@@ -1,8 +1,8 @@
syntax = "proto3";
message PV_struct_define{
- int32 Robot_ChgLength= 1;
- double Robot_AutoSpeedBase=2;
- double Robot_ManualSpeedBase=3;
- int32 Robot_LaneChange_Direction = 4;
+ int32 Robot_ChgLength= 1;
+ double Robot_AutoSpeedBase=2;
+ double Robot_ManualSpeedBase=3;
+ int32 Robot_LaneChange_Direction = 4;
};
diff --git a/Core/Src/FSM.c b/Core/Src/FSM.c
index 083c2ec..8cecaad 100644
--- a/Core/Src/FSM.c
+++ b/Core/Src/FSM.c
@@ -53,7 +53,7 @@ transition_t MoveTransitions[] =
{ Move_ChgUp, ChgUp},
{ Move_ChgDown, ChgDown},
{ Move_ChgFinish, ChgFinish},
-
+{ Move_Reset, Reset},
};
transition_t SwingTransitions[] =
@@ -264,15 +264,13 @@ void Front_End()
}
}
- //LU_Three控制打磨推杆升降:下压时,设置安全阈值,确保按压到一定值时,不再继续下压。
- // GV.Robot_ForceValue即APP显示的压力值,设置10,是考虑到按压到一定程度后,开启打磨盘的压力余量
-
+ //LU_Three控制打磨推杆升降
if(P_U7->LU_Three==1000)
{
GF_BSP_GPIO_SetIO(Out_Lift_2,0);
GF_BSP_GPIO_SetIO(Out_Lift_1,1);
}
- else if(P_U7->LU_Three==-1000 && GV.Robot_ForceValue < 10)
+ else if(P_U7->LU_Three==-1000 && GV.Robot_ForceValue < 100)
{
GF_BSP_GPIO_SetIO(Out_Lift_2,1);
GF_BSP_GPIO_SetIO(Out_Lift_1,0);
@@ -391,10 +389,10 @@ void GF_Dispatch()//2ms调用一次 给车体速度等赋值
{
// 如果处于复位模式,直接停车,不再执行运动逻辑
if (system_mode == SYSTEM_RESET) {
- HALT_State_Do();
+ action_perfrom(MoveTransitions, sizeof(MoveTransitions) / sizeof(transition_t), CurrentMoveState);//结构体数组/大小/当前状态
return;
}
- // //运动部分 Move Region
+ //运动部分 Move Region
//左补偿、右补偿
Lcompensation_control();
Rcompensation_control();
@@ -407,7 +405,6 @@ void GF_Dispatch()//2ms调用一次 给车体速度等赋值
CV.TurnLeftRightSpeed = abs((2 * 186.9 * (P_U7->CH1_LYB_H))/ 1000);//RobotSpeed指向GV的移动车体速度 这是整体车速 不是单个轮的
GV.Robot_AutoSpeed = GV.PV.Robot_AutoSpeedBase* 186.9;
-//
IV.Robot_AngleRoll = GV.Robot_Angle.RF_Angle_Roll;
IV.Robot_ForceValue = GV.Robot_ForceValue;
IV.Robot_DynamometerValue = GV.Robot_DynamometerValue;
diff --git a/Core/Src/main.c b/Core/Src/main.c
index fc67ae8..06c9c26 100644
--- a/Core/Src/main.c
+++ b/Core/Src/main.c
@@ -32,7 +32,6 @@
/* USER CODE BEGIN Includes */
#include "BHBF_ROBOT.h"
#include "fsm.h"
-
#include "motors.h"
#include "robot_state.h"
/* USER CODE END Includes */
@@ -103,9 +102,9 @@ int main(void)
/* USER CODE END 1 */
/* MPU Configuration--------------------------------------------------------*/
- MPU_Config();
+ MPU_Config();
- /* Enable I-Cache---------------------------------------------------------*/
+ /* Enable I-Cache------------------- --------------------------------------*/
SCB_EnableICache();
/* Enable D-Cache---------------------------------------------------------*/
@@ -151,7 +150,7 @@ int main(void)
GF_BSP_GPIO_SetIO(0,0);//0�??????????? 1�???????????
GF_BSP_GPIO_SetIO(1,1);
- HAL_Delay(10000); ////////////////////////////延时10s
+ HAL_Delay(5000); ////////////////////////////延时5s
DLT_LOG_ENABLE_LEVEL=0;//7 send all information 0 send nothing
Error_Detect_Intialzie(500);//every 1 seconds
@@ -264,7 +263,7 @@ void CV_GV_Init()
Motor[2]->MotorID = 2;
- P_U7 = &GV.U7_Key;//P_MK32 指向GV的遥控器参数
+ P_U7 = &GV.U7_Key;//P_U7 指向GV的遥控器参数
SP_MSP_RF_TL720D_Parameters_In = &GV.Robot_Angle ;// SP_MSP_RF_TL720D_Parameters_In 指向GV的�?�角
CMCUValue_in = &GV.Robot_ForceValue;
diff --git a/Core/Src/robot_state.c b/Core/Src/robot_state.c
index 60308e3..81c66af 100644
--- a/Core/Src/robot_state.c
+++ b/Core/Src/robot_state.c
@@ -168,10 +168,20 @@ void HALT_State_Do(void)
GV.Chg_Flag = 0;
GV.LeftFrontMotor.Target_Velcity = 0;
GV.RightFrontMotor.Target_Velcity = 0;
-// Polish_Flag = 0;
-// Spray_Flag = 0;
+// GF_BSP_GPIO_SetIO(Out_Polish, 1);
+// GF_BSP_GPIO_SetIO(Out_Spray, 1);
+}
+void Reset(void)
+{
+ *AuTo_Flag = 0;
+ Chg_Pa.change_road_finish_flag = 0;
+ Chg_Pa.change_road_status_flag = 0;
+ GV.Chg_Flag = 0;
+ GV.LeftFrontMotor.Target_Velcity = 0;
+ GV.RightFrontMotor.Target_Velcity = 0;
+ GF_BSP_GPIO_SetIO(Out_Polish, 1);
+ GF_BSP_GPIO_SetIO(Out_Spray, 1);
}
-
void continueTurn_up(double Angle, double CurrentAngle)
{
@@ -276,7 +286,7 @@ void Auto()
//垂直
if ((AM_Pa.ExpectationAngle > -45 && AM_Pa.ExpectationAngle < 45))
{
- AM_Pa.ExpectationAngle = 0 - GV.Left_Compensation/100.0 + GV.Right_Compensation/100.0;
+ AM_Pa.ExpectationAngle = 0 ; //- GV.Left_Compensation/100.0 + GV.Right_Compensation/100.0;
}
VehicleAutoBackward(angle,
GV.Left_Compensation/100.0, GV.Right_Compensation/100.0);//自动后退