Parcourir la source

油门及制动报警更改

limengqi il y a 6 mois
Parent
commit
d3541e95d1

+ 140 - 69
src/canbus/candatatype.h

@@ -2008,7 +2008,7 @@ typedef struct
     unsigned int  h : 1;
 }T_CTR_ERR_CODE;
 
-//油门(acc)、制动(brk)、挡位(sft)X、挡位(sft)Y、转向(str)电机报警
+//挡位(sft)X、挡位(sft)Y、转向(str)电机报警
 typedef struct
 {
     unsigned int  uiErrag;
@@ -2048,6 +2048,145 @@ typedef struct
     unsigned int  uiErrh;
 }T_MOT_CTR_ERR;
 
+/************行动元油门制动报警信息*******/
+typedef struct
+{
+  unsigned int  be:1;
+  unsigned int  bf:1;
+  unsigned int  bg:1;
+  unsigned int  bh:1;
+  unsigned int  bi:1;
+  unsigned int  bj:1;
+  unsigned int  bk:1;
+  unsigned int  bl:1;
+  unsigned int  aw:1;
+  unsigned int  ax:1;
+  unsigned int  ay:1;
+  unsigned int  az:1;
+  unsigned int  ba:1;
+  unsigned int  bb:1;
+  unsigned int  bc:1;
+  unsigned int  bd:1;
+  unsigned int  ao:1;
+  unsigned int  ap:1;
+  unsigned int  aq:1;
+  unsigned int  ar:1;
+  unsigned int  as:1;
+  unsigned int  at:1;
+  unsigned int  au:1;
+  unsigned int  av:1;
+  unsigned int  ag:1;
+  unsigned int  ah:1;
+  unsigned int  ai:1;
+  unsigned int  aj:1;
+  unsigned int  ak:1;
+  unsigned int  al:1;
+  unsigned int  am:1;
+  unsigned int  an:1;
+  unsigned int  y:1;
+  unsigned int  z:1;
+  unsigned int  aa:1;
+  unsigned int  ab:1;
+  unsigned int  ac:1;
+  unsigned int  ad:1;
+  unsigned int  ae:1;
+  unsigned int  af:1;
+  unsigned int  q:1;
+  unsigned int  r:1;
+  unsigned int  s:1;
+  unsigned int  t:1;
+  unsigned int  u:1;
+  unsigned int  v:1;
+  unsigned int  w:1;
+  unsigned int  x:1;
+  unsigned int  i:1;
+  unsigned int  j:1;
+  unsigned int  k:1;
+  unsigned int  l:1;
+  unsigned int  m:1;
+  unsigned int  n:1;
+  unsigned int  o:1;
+  unsigned int  p:1;
+  unsigned int  a:1;
+  unsigned int  b:1;
+  unsigned int  c:1;
+  unsigned int  d:1;
+  unsigned int  e:1;
+  unsigned int  f:1;
+  unsigned int  g:1;
+  unsigned int  h:1;
+
+}T_CTR_ERR_CODE_AccBrk;
+
+//油门(acc)、制动(brk)电机报警
+typedef struct
+{
+    unsigned int uiErrbe;
+    unsigned int uiErrbf;
+    unsigned int uiErrbg;
+    unsigned int uiErrbh;
+    unsigned int uiErrbi;
+    unsigned int uiErrbj;
+    unsigned int uiErrbk;
+    unsigned int uiErrbl;
+    unsigned int uiErraw;
+    unsigned int uiErrax;
+    unsigned int uiErray;
+    unsigned int uiErraz;
+    unsigned int uiErrba;
+    unsigned int uiErrbb;
+    unsigned int uiErrbc;
+    unsigned int uiErrbd;
+    unsigned int uiErrao;
+    unsigned int uiErrap;
+    unsigned int uiErraq;
+    unsigned int uiErrar;
+    unsigned int uiErras;
+    unsigned int uiErrat;
+    unsigned int uiErrau;
+    unsigned int uiErrav;
+    unsigned int uiErrag;
+    unsigned int uiErrah;
+    unsigned int uiErrai;
+    unsigned int uiErraj;
+    unsigned int uiErrak;
+    unsigned int uiErral;
+    unsigned int uiErram;
+    unsigned int uiErran;
+    unsigned int uiErry;
+    unsigned int uiErrz;
+    unsigned int uiErraa;
+    unsigned int uiErrab;
+    unsigned int uiErrac;
+    unsigned int uiErrad;
+    unsigned int uiErrae;
+    unsigned int uiErraf;
+    unsigned int uiErrq;
+    unsigned int uiErrr;
+    unsigned int uiErrs;
+    unsigned int uiErrt;
+    unsigned int uiErru;
+    unsigned int uiErrv;
+    unsigned int uiErrw;
+    unsigned int uiErrx;
+    unsigned int uiErri;
+    unsigned int uiErrj;
+    unsigned int uiErrk;
+    unsigned int uiErrl;
+    unsigned int uiErrm;
+    unsigned int uiErrn;
+    unsigned int uiErro;
+    unsigned int uiErrp;
+    unsigned int uiErra;
+    unsigned int uiErrb;
+    unsigned int uiErrc;
+    unsigned int uiErrd;
+    unsigned int uiErre;
+    unsigned int uiErrf;
+    unsigned int uiErrg;
+    unsigned int uiErrh;
+}T_MOT_CTR_ERR_AccBrk;
+
 /*************方向盘位置时间控制请求*************/
 typedef struct
 {
@@ -2223,75 +2362,7 @@ typedef struct
   int BrkMax;
 } RACK_SYS_PARA;
 
-/************行动元油门制动报警信息*******/
-typedef struct
-{
-  unsigned int  be:1;
-  unsigned int  bf:1;
-  unsigned int  bg:1;
-  unsigned int  bh:1;
-  unsigned int  bi:1;
-  unsigned int  bj:1;
-  unsigned int  bk:1;
-  unsigned int  bl:1;
-  unsigned int  aw:1;
-  unsigned int  ax:1;
-  unsigned int  ay:1;
-  unsigned int  az:1;
-  unsigned int  ba:1;
-  unsigned int  bb:1;
-  unsigned int  bc:1;
-  unsigned int  bd:1;
-  unsigned int  ao:1;
-  unsigned int  ap:1;
-  unsigned int  aq:1;
-  unsigned int  ar:1;
-  unsigned int  as:1;
-  unsigned int  at:1;
-  unsigned int  au:1;
-  unsigned int  av:1;
-  unsigned int  ag:1;
-  unsigned int  ah:1;
-  unsigned int  ai:1;
-  unsigned int  aj:1;
-  unsigned int  ak:1;
-  unsigned int  al:1;
-  unsigned int  am:1;
-  unsigned int  an:1;
-  unsigned int  y:1;
-  unsigned int  z:1;
-  unsigned int  aa:1;
-  unsigned int  ab:1;
-  unsigned int  ac:1;
-  unsigned int  ad:1;
-  unsigned int  ae:1;
-  unsigned int  af:1;
-  unsigned int  q:1;
-  unsigned int  r:1;
-  unsigned int  s:1;
-  unsigned int  t:1;
-  unsigned int  u:1;
-  unsigned int  v:1;
-  unsigned int  w:1;
-  unsigned int  x:1;
-  unsigned int  i:1;
-  unsigned int  j:1;
-  unsigned int  k:1;
-  unsigned int  l:1;
-  unsigned int  m:1;
-  unsigned int  n:1;
-  unsigned int  o:1;
-  unsigned int  p:1;
-  unsigned int  a:1;
-  unsigned int  b:1;
-  unsigned int  c:1;
-  unsigned int  d:1;
-  unsigned int  e:1;
-  unsigned int  f:1;
-  unsigned int  g:1;
-  unsigned int  h:1;
 
-}T_MOT_CTR_ERR_1;
 
 } // namespace canbus
 

+ 82 - 5
src/canbus/messagecoder.cpp

@@ -588,7 +588,7 @@ void MessageCoder::CanMsgAnalyseID_2E1(unsigned char * ucData, T_ESTOP_ERR * tEs
     tEstopErr->uiEspErrf = tEstop2E1.uiEspErrf;
 }
 
-//油门(acc)、制动(brk)、挡位(sft)X、挡位(sft)Y、转向(str)电机报警--数据解析
+//挡位(sft)X、挡位(sft)Y、转向(str)电机报警--数据解析
 void MessageCoder::CanMsgAnalyseErr(unsigned char * ucData, T_MOT_CTR_ERR * tMotCtrErr)
 {
     T_CTR_ERR_CODE tCtrErrCode = { 0 };
@@ -635,6 +635,83 @@ void MessageCoder::CanMsgAnalyseErr(unsigned char * ucData, T_MOT_CTR_ERR * tMot
     tMotCtrErr->uiErrz = tCtrErrCode.z;
 }
 
+//油门(acc)、制动(brk)电机报警--数据解析
+void MessageCoder::CanMsgAnalyseErrAccBrk(unsigned char * ucData, T_MOT_CTR_ERR_AccBrk * tMotCtrErr)
+{
+    T_CTR_ERR_CODE_AccBrk tCtrErrCode = { 0 };
+//    unsigned char ucCanMsgSrc[8] = { 0 };
+
+//    memcpy(ucCanMsgSrc, ucData, CAN_MSG_LEN);
+    CharReverse(ucData,8);
+    memcpy(&tCtrErrCode, ucData, CAN_MSG_LEN);
+
+    tMotCtrErr->uiErrbe = tCtrErrCode.be;
+    tMotCtrErr->uiErrbf = tCtrErrCode.bf;
+    tMotCtrErr->uiErrbg = tCtrErrCode.bg;
+    tMotCtrErr->uiErrbh = tCtrErrCode.bh;
+    tMotCtrErr->uiErrbi = tCtrErrCode.bi;
+    tMotCtrErr->uiErrbj  = tCtrErrCode.bj;
+    tMotCtrErr->uiErrbk = tCtrErrCode.bk;
+    tMotCtrErr->uiErrbl = tCtrErrCode.bl;
+    tMotCtrErr->uiErraw = tCtrErrCode.aw;
+    tMotCtrErr->uiErrax = tCtrErrCode.ax;
+    tMotCtrErr->uiErray = tCtrErrCode.ay;
+    tMotCtrErr->uiErraz = tCtrErrCode.az;
+    tMotCtrErr->uiErrba = tCtrErrCode.ba;
+    tMotCtrErr->uiErrbb = tCtrErrCode.bb;
+    tMotCtrErr->uiErrbc = tCtrErrCode.bc;
+    tMotCtrErr->uiErrbd = tCtrErrCode.bd;
+    tMotCtrErr->uiErrao = tCtrErrCode.ao;
+    tMotCtrErr->uiErrap = tCtrErrCode.ap;
+    tMotCtrErr->uiErraq = tCtrErrCode.aq;
+    tMotCtrErr->uiErrar = tCtrErrCode.ar;
+    tMotCtrErr->uiErras = tCtrErrCode.as;
+    tMotCtrErr->uiErrat = tCtrErrCode.at;
+    tMotCtrErr->uiErrau = tCtrErrCode.au;
+    tMotCtrErr->uiErrav = tCtrErrCode.av;
+    tMotCtrErr->uiErrag = tCtrErrCode.ag;
+    tMotCtrErr->uiErrah = tCtrErrCode.ah;
+    tMotCtrErr->uiErrai = tCtrErrCode.ai;
+    tMotCtrErr->uiErraj = tCtrErrCode.aj;
+    tMotCtrErr->uiErrak = tCtrErrCode.ak;
+    tMotCtrErr->uiErral = tCtrErrCode.al;
+    tMotCtrErr->uiErram = tCtrErrCode.am;
+    tMotCtrErr->uiErran = tCtrErrCode.an;
+    tMotCtrErr->uiErry = tCtrErrCode.y;
+    tMotCtrErr->uiErrz = tCtrErrCode.z;
+    tMotCtrErr->uiErraa = tCtrErrCode.aa;
+    tMotCtrErr->uiErrab = tCtrErrCode.ab;
+    tMotCtrErr->uiErrac = tCtrErrCode.ac;
+    tMotCtrErr->uiErrad = tCtrErrCode.ad;
+    tMotCtrErr->uiErrae = tCtrErrCode.ae;
+    tMotCtrErr->uiErraf = tCtrErrCode.af;
+    tMotCtrErr->uiErrq = tCtrErrCode.q;
+    tMotCtrErr->uiErrr = tCtrErrCode.r;
+    tMotCtrErr->uiErrs = tCtrErrCode.s;
+    tMotCtrErr->uiErrt = tCtrErrCode.t;
+    tMotCtrErr->uiErru = tCtrErrCode.u;
+    tMotCtrErr->uiErrv = tCtrErrCode.v;
+    tMotCtrErr->uiErrw = tCtrErrCode.w;
+    tMotCtrErr->uiErrx = tCtrErrCode.x;
+    tMotCtrErr->uiErri = tCtrErrCode.i;
+    tMotCtrErr->uiErrj = tCtrErrCode.j;
+    tMotCtrErr->uiErrk = tCtrErrCode.k;
+    tMotCtrErr->uiErrl = tCtrErrCode.l;
+    tMotCtrErr->uiErrm = tCtrErrCode.m;
+    tMotCtrErr->uiErrn = tCtrErrCode.n;
+    tMotCtrErr->uiErro = tCtrErrCode.o;
+    tMotCtrErr->uiErrp = tCtrErrCode.p;
+    tMotCtrErr->uiErra = tCtrErrCode.a;
+    tMotCtrErr->uiErrb = tCtrErrCode.b;
+    tMotCtrErr->uiErrc = tCtrErrCode.c;
+    tMotCtrErr->uiErrd = tCtrErrCode.d;
+    tMotCtrErr->uiErre = tCtrErrCode.e;
+    tMotCtrErr->uiErrf = tCtrErrCode.f;
+    tMotCtrErr->uiErrg = tCtrErrCode.g;
+    tMotCtrErr->uiErrh = tCtrErrCode.h;
+
+}
+
 //OBD实际油门踏板行程--数据解析
 void MessageCoder::OBDAnalyseID_070(unsigned char *ucData, T_OBD_ACC_PSNG *tOBDAccPsng)
 {
@@ -1391,13 +1468,13 @@ void * MessageCoder::CanMsgAnalyse(int id,unsigned char * ucData)
         p = &tEstopErr;
         break;
     case robot::common::AccErr://油门(acc)电机报警
-        T_MOT_CTR_ERR tMotCtrErrAcc ;
-        CanMsgAnalyseErr(ucData,&tMotCtrErrAcc);
+        T_MOT_CTR_ERR_AccBrk tMotCtrErrAcc ;
+        CanMsgAnalyseErrAccBrk(ucData,&tMotCtrErrAcc);
         p = &tMotCtrErrAcc;
         break;
     case robot::common::BrkErr://制动(brk)电机报警
-        T_MOT_CTR_ERR tMotCtrErrBrk ;
-        CanMsgAnalyseErr(ucData, &tMotCtrErrBrk);
+        T_MOT_CTR_ERR_AccBrk tMotCtrErrBrk ;
+        CanMsgAnalyseErrAccBrk(ucData, &tMotCtrErrBrk);
         p = &tMotCtrErrBrk;
         break;
     case robot::common::XsftErr://挡位(sft)X电机报警

+ 4 - 1
src/canbus/messagecoder.h

@@ -99,9 +99,12 @@ private:
     //Estop故障码--数据解析
     static void CanMsgAnalyseID_2E1(unsigned char *ucData, T_ESTOP_ERR *tEstopErr);
 
-    //油门(acc)、制动(brk)、挡位(sft)X、挡位(sft)Y、转向(str)电机报警--数据解析
+    //挡位(sft)X、挡位(sft)Y、转向(str)电机报警--数据解析
     static void CanMsgAnalyseErr(unsigned char *ucData, T_MOT_CTR_ERR *tMotCtrErr);
 
+    //油门(acc)、制动(brk)电机报警--数据解析
+    static void CanMsgAnalyseErrAccBrk(unsigned char *ucData, T_MOT_CTR_ERR_AccBrk *tMotCtrErr);
+
     //OBD实际油门踏板行程--数据解析
     static void OBDAnalyseID_070(unsigned char *ucData, T_OBD_ACC_PSNG *tOBDAccPsng);
 

+ 2 - 2
src/perception/perception.cpp

@@ -406,7 +406,7 @@ bool Perception::PublishState_6D2_3(unsigned char* msg, int type, const ros::Pub
 {
 
 
-    robot::canbusSpace::T_MOT_CTR_ERR_1 *pErr;
+    robot::canbusSpace::T_CTR_ERR_CODE_AccBrk *pErr;
     switch (type) {
     case 2:
         pErr = &s_state_6D2;
@@ -427,7 +427,7 @@ bool Perception::PublishState_6D2_3(unsigned char* msg, int type, const ros::Pub
 //        copySize = sizeof(s_state_6D2);
 
     //6D2_2 6D2_3 数据结构相同
-    robot::canbusSpace::T_MOT_CTR_ERR_1 state_6D2;
+    robot::canbusSpace::T_CTR_ERR_CODE_AccBrk state_6D2;
     memset(&state_6D2, 0 ,sizeof(state_6D2));
     memcpy(&state_6D2, msg, CAN_MSG_LEN);
 

+ 2 - 2
src/perception/perception.h

@@ -221,10 +221,10 @@ ros::Subscriber sub;
      robot::canbusSpace::T_STATE_OUT_6D1 s_state_6D1;
     ::perception::seMsg se_msg;
 
-     robot::canbusSpace::T_MOT_CTR_ERR_1 s_state_6D2;
+     robot::canbusSpace::T_CTR_ERR_CODE_AccBrk s_state_6D2;
      ::perception::cecMsg2 cec_msg22;
 
-     robot::canbusSpace::T_MOT_CTR_ERR_1 s_state_6D3;
+     robot::canbusSpace::T_CTR_ERR_CODE_AccBrk s_state_6D3;
      ::perception::cecMsg2 cec_msg23;
 
      robot::canbusSpace::T_XSFT_ERR s_state_6D4;