ソースを参照

change apollo shenlanfd contoller. for fix some bug, not test.

yuchuli 1 日 前
コミット
d88ff50516

+ 16 - 2
src/apollo/apollolib/shenlanfd/shenlanfd.cpp

@@ -108,6 +108,17 @@ void Shenlanfd::threadsend()
         ExecuteDecision(xdcs);
         std::this_thread::sleep_for(std::chrono::milliseconds(1));
     }
+
+    gnState = 0;
+    int i;
+    for(i=0;i<100;i++)
+    {
+        iv::dcs xdcs;
+        xdcs.mfTorque = 0;xdcs.mfBrake = 0; xdcs.mfWheel = 0; xdcs.mblampleft = false; xdcs.mblampright = false;
+        ExecuteDecision(xdcs);
+        std::this_thread::sleep_for(std::chrono::milliseconds(1));
+    }
+    std::cout<<"Shenlanfd::threadsend Exit"<<std::endl;
 }
 
 void Shenlanfd::ExecuteDecision(iv::dcs & xdcs)
@@ -169,6 +180,11 @@ void Shenlanfd::ExecuteDecision(iv::dcs & xdcs)
     }
 
 
+    if(gnState == 0)
+    {
+        _m1C4.ACC_LatAngReqActive = 0;
+
+    }
 
     byte_1C4[0] = ((_m1C4.ACC_MotorTorqueMaxLimitRequest >> 3) & (0xFFU));
     byte_1C4[1] = ((_m1C4.ACC_MotorTorqueMaxLimitRequest & (0x07U)) << 5) | ((_m1C4.ACC_MotorTorqueMinLimitRequest >> 6) & (0x1FU));
@@ -224,8 +240,6 @@ void Shenlanfd::ExecuteDecision(iv::dcs & xdcs)
         _m24E.ACC_ACCTargetAcceleration = 0;
         _m24E.ACC_AccTrqReqActive = 0;
         _m24E.ACC_DecToStop = 0;
-        _m1C4.ACC_LatAngReqActive = 0;
-
     }
 
 

+ 2 - 1
src/apollo/code/apollocontroller_shenlanfd/main.cpp

@@ -244,10 +244,11 @@ int main(int argc, char *argv[])
 
     apollo::cyber::WaitForShutdown();
 
+    delete gpShenlanfd;
     gbthreadrun = false;
     gpthreadsend->join();
 //    ptestthread->join();
-    delete gpShenlanfd;
+    
     std::cout<<" Shut Down."<<std::endl;
 
     return 0;