|
@@ -28,7 +28,7 @@
|
|
#include "changan_a07.h"
|
|
#include "changan_a07.h"
|
|
#include "dbcsigpacker.h"
|
|
#include "dbcsigpacker.h"
|
|
|
|
|
|
-bool gbUseAPA;
|
|
|
|
|
|
+bool gbUseAPA = true;
|
|
int gnAPAstate = 0; //0 not request 1 request 2 active
|
|
int gnAPAstate = 0; //0 not request 1 request 2 active
|
|
|
|
|
|
std::string gstrdbcpath;
|
|
std::string gstrdbcpath;
|
|
@@ -105,11 +105,22 @@ void ExecSend();
|
|
void executeDecition(const iv::brain::decition &decition)
|
|
void executeDecition(const iv::brain::decition &decition)
|
|
{
|
|
{
|
|
|
|
|
|
|
|
+ static double fLastWheelReq = 0;
|
|
static int xieya = 50;
|
|
static int xieya = 50;
|
|
|
|
+ const double fwheelstep = 10;
|
|
|
|
|
|
double fWheelAngleReq = decition.wheelangle();
|
|
double fWheelAngleReq = decition.wheelangle();
|
|
- if(fWheelAngleReq>430.0)fWheelAngleReq = 430.0;
|
|
|
|
- if(fWheelAngleReq<(-430.0))fWheelAngleReq = -430.0;
|
|
|
|
|
|
+ if(fWheelAngleReq>400.0)fWheelAngleReq = 400.0;
|
|
|
|
+ if(fWheelAngleReq<(-400.0))fWheelAngleReq = -400.0;
|
|
|
|
+
|
|
|
|
+ double fdiff = fWheelAngleReq - fLastWheelReq;
|
|
|
|
+
|
|
|
|
+ if(fabs(fdiff ) > fwheelstep)
|
|
|
|
+ {
|
|
|
|
+ fWheelAngleReq = fLastWheelReq + fwheelstep * fdiff/(fabs(fdiff));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fLastWheelReq = fWheelAngleReq;
|
|
|
|
|
|
|
|
|
|
SetMsgSignal("ECU_1B2","ACC_LatAngReq",fWheelAngleReq);
|
|
SetMsgSignal("ECU_1B2","ACC_LatAngReq",fWheelAngleReq);
|
|
@@ -126,9 +137,11 @@ void executeDecition(const iv::brain::decition &decition)
|
|
|
|
|
|
if(gbUseAPA)
|
|
if(gbUseAPA)
|
|
{
|
|
{
|
|
|
|
+
|
|
|
|
+
|
|
static int64_t ntimeChangetoreq = std::chrono::system_clock::now().time_since_epoch().count()/1e6;
|
|
static int64_t ntimeChangetoreq = std::chrono::system_clock::now().time_since_epoch().count()/1e6;
|
|
int64_t nnow;
|
|
int64_t nnow;
|
|
- if(decition.angle_active() == 0)
|
|
|
|
|
|
+ if(decition.angle_active() == 1)
|
|
{
|
|
{
|
|
switch (gnAPAstate) {
|
|
switch (gnAPAstate) {
|
|
case 0:
|
|
case 0:
|
|
@@ -171,6 +184,8 @@ void executeDecition(const iv::brain::decition &decition)
|
|
SetMsgSignal("ECU_23F","APA_SteeringAngleReqProtection",gnAPAstate);
|
|
SetMsgSignal("ECU_23F","APA_SteeringAngleReqProtection",gnAPAstate);
|
|
SetMsgSignal("ECU_23F","APA_ErrorStatus",0);
|
|
SetMsgSignal("ECU_23F","APA_ErrorStatus",0);
|
|
SetMsgSignal("ECU_23F","APA_SteeringAngleReq",fWheelAngleReq);
|
|
SetMsgSignal("ECU_23F","APA_SteeringAngleReq",fWheelAngleReq);
|
|
|
|
+ SetMsgSignal("ECU_1B2","ACC_LatAngReqActive",0);
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -181,6 +196,7 @@ void executeDecition(const iv::brain::decition &decition)
|
|
SetMsgSignal("ECU_23F","APA_ErrorStatus",0);
|
|
SetMsgSignal("ECU_23F","APA_ErrorStatus",0);
|
|
SetMsgSignal("ECU_23F","APA_SteeringAngleReq",fWheelAngleReq);
|
|
SetMsgSignal("ECU_23F","APA_SteeringAngleReq",fWheelAngleReq);
|
|
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
if(decition.brake()<(-5.0))
|
|
if(decition.brake()<(-5.0))
|