|
@@ -28,6 +28,9 @@
|
|
|
#include "changan_a07.h"
|
|
|
#include "dbcsigpacker.h"
|
|
|
|
|
|
+bool gbUseAPA;
|
|
|
+int gnAPAstate = 0; //0 not request 1 request 2 active
|
|
|
+
|
|
|
std::string gstrdbcpath;
|
|
|
bool gbUseOutDBC;
|
|
|
|
|
@@ -120,6 +123,51 @@ void executeDecition(const iv::brain::decition &decition)
|
|
|
SetMsgSignal("ECU_23C","ACC_AccTrqReq",ftorque);
|
|
|
SetMsgSignal("ECU_23C","ACC_AccTrqReqActive",decition.acc_active());
|
|
|
|
|
|
+ if(gbUseAPA)
|
|
|
+ {
|
|
|
+ static int64_t ntimeChangetoreq = std::chrono::system_clock::now().time_since_epoch().count()/1e6;
|
|
|
+ int64_t nnow;
|
|
|
+ if(decition.angle_active() == 0)
|
|
|
+ {
|
|
|
+ switch (gnAPAstate) {
|
|
|
+ case 0:
|
|
|
+ gnAPAstate = 1;
|
|
|
+ ntimeChangetoreq = std::chrono::system_clock::now().time_since_epoch().count()/1e6;
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ nnow = std::chrono::system_clock::now().time_since_epoch().count()/1e6;
|
|
|
+ if(abs(nnow - ntimeChangetoreq)<300)
|
|
|
+ gnAPAstate = 1;
|
|
|
+ else
|
|
|
+ gnAPAstate = 2;
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ gnAPAstate = 2;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ gnAPAstate = 0;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ switch (gnAPAstate) {
|
|
|
+ case 0:
|
|
|
+ gnAPAstate = 0;
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ gnAPAstate = 0;
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ gnAPAstate = 0;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ gnAPAstate = 0;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if(decition.brake()<(-5.0))
|
|
|
{
|
|
|
SetMsgSignal("ECU_23C","ACC_ACCTargetAcceleration",-5.0);
|