瀏覽代碼

change controller_changan_shenlan_v2. and canfd send.

pilot 2 年之前
父節點
當前提交
aa816745b6
共有 2 個文件被更改,包括 15 次插入6 次删除
  1. 12 4
      src/controller/controller_changan_shenlan_v2/main.cpp
  2. 3 2
      src/driver/driver_can_nvidia_agx/nvcan.cpp

+ 12 - 4
src/controller/controller_changan_shenlan_v2/main.cpp

@@ -153,9 +153,9 @@ void executeDecition(const iv::brain::decition &decition)
     /*制动过程用的减速度,加速用扭矩*/
     _m24E.ACC_AccTrqReq = ECU_24E_ACC_AccTrqReq_toS(decition.torque());
     _m24E.ACC_AccTrqReqActive = decition.acc_active();
-    if(decition.brake()<(-0.5))
+    if(decition.brake()<(-1.5))
     {
-        _m24E.ACC_ACCTargetAcceleration = ECU_24E_ACC_ACCTargetAcceleration_toS(-0.5);
+        _m24E.ACC_ACCTargetAcceleration = ECU_24E_ACC_ACCTargetAcceleration_toS(-1.5);
     }
     else
         _m24E.ACC_ACCTargetAcceleration = ECU_24E_ACC_ACCTargetAcceleration_toS(decition.brake());
@@ -238,6 +238,9 @@ void executeDecition(const iv::brain::decition &decition)
         {
             _m24E.ACC_ACCTargetAcceleration = ECU_24E_ACC_ACCTargetAcceleration_toS(0);
         }
+        _m24E.ACC_AccTrqReqActive = 1;
+        _m24E.ACC_DecToStop = 0;
+
     }
     else
     {
@@ -254,6 +257,9 @@ void executeDecition(const iv::brain::decition &decition)
 
             }
         }
+
+        _m24E.ACC_AccTrqReqActive = 0;
+        _m24E.ACC_DecToStop = 1;
     }
  //       _m24B.ACC_CDDActive = decition.brake_active();
     _m24E.ACC_ACCMode = decition.auto_mode();
@@ -414,6 +420,8 @@ void ListenDeciton(const char * strdata,const unsigned int nSize,const unsigned
 //    xdecition.set_brake_type(1);
     xdecition.set_auto_mode(3);
 
+ //   xdecition.set_wheelangle(45.0);
+
     if((oldtime - QDateTime::currentMSecsSinceEpoch())<-100)qDebug("dection time is %lld diff is %lld ",QDateTime::currentMSecsSinceEpoch(),oldtime - QDateTime::currentMSecsSinceEpoch());
     oldtime = QDateTime::currentMSecsSinceEpoch();
     gMutex.lock();
@@ -434,10 +442,10 @@ void ExecSend()
     //    qDebug("%02x %02x %02x %02x %02x %02x %02x %02x",strp[0],strp[1],strp[2],strp[3],strp[4],strp[5],strp[6],strp[7]);
 
     xraw.set_id(0x1C4);
-    xraw.set_data(byte_1C4,64);
+    xraw.set_data(byte_1C4,32);
     xraw.set_bext(false);
     xraw.set_bremote(false);
-    xraw.set_len(64);
+    xraw.set_len(32);
     iv::can::canraw * pxraw1C4 = xmsg.add_rawmsg();
     pxraw1C4->CopyFrom(xraw);
 //    qDebug(" 0x144: %02X %02X %02X %02X %02X %02X %02X %02X",byte_144[0],byte_144[1],byte_144[2],byte_144[3],

+ 3 - 2
src/driver/driver_can_nvidia_agx/nvcan.cpp

@@ -244,7 +244,8 @@ void nvcan::run()
             for(i=0;i<mMsgSendBuf[nch].size();i++)
             {
                 if(i>=2500)break;
-                memcpy(framesend[i].data,mMsgSendBuf[nch].at(i).data,8);
+                framesend[i].len = mMsgSendBuf[nch].at(i).nLen;
+                memcpy(framesend[i].data,mMsgSendBuf[nch].at(i).data,framesend[i].len);
                 framesend[i].can_id = mMsgSendBuf[nch].at(i).id;
                 if(mMsgSendBuf[nch].at(i).isExtern)
                 {
@@ -259,7 +260,7 @@ void nvcan::run()
                     framesend[i].can_id= framesend[i].can_id|0x40000000;
                 }
 
-                framesend[i].len = mMsgSendBuf[nch].at(i).nLen;
+
 
                 nsend++;
             }