双柱双电机S型传感器版本更新

1.优化了屏幕中间控制用力不均匀的问题
2.优化了控制算法
This commit is contained in:
2025-10-17 13:59:16 +08:00
parent a6f4d0fb17
commit 60b35ce978
3 changed files with 62 additions and 37 deletions
-5
View File
@@ -225,11 +225,6 @@
<WinNumber>1</WinNumber> <WinNumber>1</WinNumber>
<ItemText>App.CentreRunFalg,0x0A</ItemText> <ItemText>App.CentreRunFalg,0x0A</ItemText>
</Ww> </Ww>
<Ww>
<count>14</count>
<WinNumber>1</WinNumber>
<ItemText>App.EvenRunDelay1mSCnt</ItemText>
</Ww>
</WatchWindow1> </WatchWindow1>
<MemoryWindow1> <MemoryWindow1>
<Mm> <Mm>
+1 -1
View File
@@ -14,7 +14,7 @@
#define FOLLOW_VPT 20 #define FOLLOW_VPT 20
#define SHIELD_VPT 2500 #define SHIELD_VPT 2500
#define STOP_TIME_MS 500 #define STOP_TIME_MS 0
#define RUN_TIME_MS 0 #define RUN_TIME_MS 0
#define TRAVEL_TIME_MS 30000 #define TRAVEL_TIME_MS 30000
+51 -21
View File
@@ -217,22 +217,22 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
App.LeftRunFalg = false; App.LeftRunFalg = false;
App.RightRunFalg = false; App.RightRunFalg = false;
App.CentreRunFalg = false; App.CentreRunFalg = false;
if(((ll_ad[0] > App.ADTrack.LeftLow_Org_AdZero) if(((lu_ad[0] < App.ADTrack.LeftUp_Org_AdZero-1000)
&& (rl_ad[0] > App.ADTrack.RightLow_Org_AdZero)) && (ll_ad[0] > App.ADTrack.LeftLow_Org_AdZero+1000)
|| ((ll_ad[0] < App.ADTrack.LeftLow_Org_AdZero) && (ru_ad[0] < App.ADTrack.RightUp_Org_AdZero-1000)
&& (rl_ad[0] < App.ADTrack.RightLow_Org_AdZero))) && (rl_ad[0] > App.ADTrack.RightLow_Org_AdZero+1000))
|| ((lu_ad[0] > App.ADTrack.LeftUp_Org_AdZero+1000)
&& (ll_ad[0] < App.ADTrack.LeftLow_Org_AdZero-1000)
&& (ru_ad[0] > App.ADTrack.RightUp_Org_AdZero+1000)
&& (rl_ad[0] < App.ADTrack.RightLow_Org_AdZero-1000)))
{ {
App.CentreRunFalg = true; App.CentreRunFalg = true;
if(abs(Oll_diff1) > abs(Orl_diff1)) if(abs(Oll_diff1) > abs(Orl_diff1))
{ {
App.LeftRunFalg = true; App.LeftRunFalg = true;
} if((App.LeftLowCS1237_SlopeArray[0] > App.ADTrack.Slope_VPT/3))
else if(abs(Oll_diff1) < abs(Orl_diff1))
{ {
App.RightRunFalg = true; if(Oll_diff1 < -App.ADTrack.LeftLowVPT/2)
}
if(((Oll_diff1 + Orl_diff1) < -(App.ADTrack.LeftLowVPT + App.ADTrack.RightLowVPT)/2)
&& (((App.LeftUpCS1237_SlopeArray[0] + App.RightUpCS1237_SlopeArray[0]) < -App.ADTrack.Slope_VPT/4)))
{ {
BDC_UP(); BDC_UP();
App.UpFlag = true; App.UpFlag = true;
@@ -240,8 +240,10 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
App.DownFlag = false; App.DownFlag = false;
App.RunCollDelay1mSCnt = RUN_TIME_MS; App.RunCollDelay1mSCnt = RUN_TIME_MS;
} }
else if(((Oll_diff1 + Orl_diff1) > (App.ADTrack.LeftLowVPT + App.ADTrack.RightLowVPT)/2) }
&& (((App.LeftUpCS1237_SlopeArray[0] + App.RightUpCS1237_SlopeArray[0]) > App.ADTrack.Slope_VPT/4))) else if((App.LeftLowCS1237_SlopeArray[0] < -App.ADTrack.Slope_VPT/3))
{
if(Oll_diff1 > App.ADTrack.LeftLowVPT/2)
{ {
BDC_DOWN(); BDC_DOWN();
App.UpFlag = false; App.UpFlag = false;
@@ -250,6 +252,34 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
App.RunCollDelay1mSCnt = RUN_TIME_MS; App.RunCollDelay1mSCnt = RUN_TIME_MS;
} }
} }
}
else if(abs(Oll_diff1) < abs(Orl_diff1))
{
App.RightRunFalg = true;
if((App.RightLowCS1237_SlopeArray[0] > App.ADTrack.Slope_VPT/3))
{
if(Orl_diff1 < -App.ADTrack.RightLowVPT/2)
{
BDC_UP();
App.UpFlag = true;
App.StopFlag = false;
App.DownFlag = false;
App.RunCollDelay1mSCnt = RUN_TIME_MS;
}
}
else if((App.RightLowCS1237_SlopeArray[0] < -App.ADTrack.Slope_VPT/3))
{
if(Orl_diff1 > App.ADTrack.RightLowVPT/2)
{
BDC_DOWN();
App.UpFlag = false;
App.StopFlag = false;
App.DownFlag = true;
App.RunCollDelay1mSCnt = RUN_TIME_MS;
}
}
}
}
else if((LeftSlopeSum > RightSlopeSum && LeftDiffSum > RightDiffSum)) else if((LeftSlopeSum > RightSlopeSum && LeftDiffSum > RightDiffSum))
{ {
App.LeftRunFalg = true; App.LeftRunFalg = true;
@@ -360,7 +390,7 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
if(App.LeftRunFalg == true) if(App.LeftRunFalg == true)
{ {
if(((App.CentreRunFalg == false ) && (ll_slope > App.ADTrack.Slope_VPT)) if(((App.CentreRunFalg == false ) && (ll_slope > App.ADTrack.Slope_VPT))
|| ((App.CentreRunFalg == true ) && (App.LeftUpCS1237_SlopeArray[0] + App.RightUpCS1237_SlopeArray[0]) < -App.ADTrack.Slope_VPT/3)) || ((App.CentreRunFalg == true ) && (App.LeftUpCS1237_SlopeArray[0] + App.RightUpCS1237_SlopeArray[0]) < -App.ADTrack.Slope_VPT))
{ {
BDC_STOP(); BDC_STOP();
App.StopFlag = true; App.StopFlag = true;
@@ -380,8 +410,8 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
} }
else if(App.RightRunFalg == true) else if(App.RightRunFalg == true)
{ {
if(((App.CentreRunFalg == false ) && (ll_slope > App.ADTrack.Slope_VPT)) if(((App.CentreRunFalg == false ) && (rl_slope > App.ADTrack.Slope_VPT))
|| ((App.CentreRunFalg == true ) && (App.LeftUpCS1237_SlopeArray[0] + App.RightUpCS1237_SlopeArray[0]) < -App.ADTrack.Slope_VPT/3)) || ((App.CentreRunFalg == true ) && (App.LeftUpCS1237_SlopeArray[0] + App.RightUpCS1237_SlopeArray[0]) < -App.ADTrack.Slope_VPT))
{ {
BDC_STOP(); BDC_STOP();
App.StopFlag = true; App.StopFlag = true;
@@ -405,7 +435,7 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
if(App.LeftRunFalg == true) if(App.LeftRunFalg == true)
{ {
if(((App.CentreRunFalg == false ) && (ll_slope < -App.ADTrack.Slope_VPT)) if(((App.CentreRunFalg == false ) && (ll_slope < -App.ADTrack.Slope_VPT))
|| ((App.CentreRunFalg == true ) && (App.LeftUpCS1237_SlopeArray[0] + App.RightUpCS1237_SlopeArray[0]) > App.ADTrack.Slope_VPT/3)) || ((App.CentreRunFalg == true ) && (App.LeftUpCS1237_SlopeArray[0] + App.RightUpCS1237_SlopeArray[0]) > App.ADTrack.Slope_VPT))
{ {
BDC_STOP(); BDC_STOP();
App.StopFlag = true; App.StopFlag = true;
@@ -426,7 +456,7 @@ void SupportControlHandle(int32_t *lu_ad, int32_t *ll_ad, int32_t *ru_ad, int32_
else if(App.RightRunFalg == true) else if(App.RightRunFalg == true)
{ {
if(((App.CentreRunFalg == false ) && (rl_slope < -App.ADTrack.Slope_VPT)) if(((App.CentreRunFalg == false ) && (rl_slope < -App.ADTrack.Slope_VPT))
|| ((App.CentreRunFalg == true ) && (App.LeftUpCS1237_SlopeArray[0] + App.RightUpCS1237_SlopeArray[0]) > App.ADTrack.Slope_VPT/3)) || ((App.CentreRunFalg == true ) && (App.LeftUpCS1237_SlopeArray[0] + App.RightUpCS1237_SlopeArray[0]) > App.ADTrack.Slope_VPT))
{ {
BDC_STOP(); BDC_STOP();
App.StopFlag = true; App.StopFlag = true;
@@ -538,10 +568,10 @@ static void AppInit(void)
RIGHTUP_CS1237_Init(); RIGHTUP_CS1237_Init();
RIGHTLOW_CS1237_Init(); RIGHTLOW_CS1237_Init();
App.Status = APP_STATUS_WAIT; // App.Status = APP_STATUS_WAIT;
App.TD1mSDelayCnt = 1000; // App.TD1mSDelayCnt = 1000;
// App.Status = APP_STATUS_UP1; App.Status = APP_STATUS_UP1;
// App.TD1mSDelayCnt = TRAVEL_TIME_MS; App.TD1mSDelayCnt = TRAVEL_TIME_MS;
App.RStatus = READ_STATUS_START; App.RStatus = READ_STATUS_START;
GradeControl(App.Para.Layout.ControlLevel);//等级控制 GradeControl(App.Para.Layout.ControlLevel);//等级控制