Parcourir la source

add vv7chasis in deciton chasis module

liusunan il y a 4 ans
Parent
commit
f83d0dcc9b

+ 1 - 0
src/decition/common/common/car_status.h

@@ -68,6 +68,7 @@ namespace iv {
         int driverMode=0;
         int epb=0;
         int epsMode=1;
+        float engine_speed=0;
         bool receiveEps=false;
 
 

+ 9 - 0
src/decition/decition_brain/decition/brain.cpp

@@ -1224,6 +1224,15 @@ void iv::decition::BrainDecition::UpdateChassis(const char *strdata, const unsig
         std::cout<<"******* ServiceCarStatus.torque_st:"<< ServiceCarStatus.torque_st<<std::endl;
         givlog->warn(" ServiceCarStatus.torque_st: is %f",ServiceCarStatus.torque_st);
 
+    }
+
+    if(xchassis.has_engine_speed())
+    {
+         ServiceCarStatus.engine_speed = xchassis.engine_speed();
+
+         std::cout<<"******* xchassis.engine_speed:"<< xchassis.engine_speed()<<std::endl;
+
+
     }
     //    if(xchassis.epsmode() == 1)
     //    {

+ 11 - 0
src/decition/decition_brain_sf/decition/brain.cpp

@@ -1185,6 +1185,17 @@ void iv::decition::BrainDecition::UpdateChassis(const char *strdata, const unsig
         givlog->warn(" ServiceCarStatus.torque_st: is %f",ServiceCarStatus.torque_st);
 
     }
+
+    if(xchassis.has_engine_speed())
+    {
+         ServiceCarStatus.engine_speed = xchassis.engine_speed();
+
+         std::cout<<"******* xchassis.engine_speed:"<< xchassis.engine_speed()<<std::endl;
+
+
+    }
+
+
     //    if(xchassis.epsmode() == 1)
     //    {
     //        ncount++;

+ 39 - 2
src/detection/detection_chassis/decodechassis.cpp

@@ -171,12 +171,49 @@ int ProcMIDCARChassis(void * pa, iv::can::canmsg * pmsg)
 
         const iv::can::canraw * praw = &(pmsg->rawmsg(i));
         unsigned char data[8];
-        if(praw->id() == 0xC2)
+        if(praw->id() == 0x14)
         {
             memcpy(data,praw->data().data(),8);
+            double torque,dangwei,soc,vehspeed;
+            torque = data[3];
+            dangwei = data[7]>>6;
+            soc = data[6]; soc = soc *0.4;
+            vehspeed = (data[4]*256.0 + data[5])*0.05625;
 
             iv::chassis xchassis;
-            xchassis.set_soc(data[0]);
+            xchassis.set_torque(torque);
+            xchassis.set_shift(dangwei);
+            xchassis.set_soc(soc);
+            xchassis.set_vel(vehspeed);
+
+            ShareChassis(pa,&xchassis);
+            nRtn = 1;
+        }
+    }
+
+    return nRtn;
+
+}
+
+int ProcVV7Chassis(void * pa, iv::can::canmsg * pmsg)
+{
+    int i;
+    int nRtn = 0;
+    for(i=0;i<pmsg->rawmsg_size();i++)
+    {
+
+        const iv::can::canraw * praw = &(pmsg->rawmsg(i));
+        unsigned char data[8];
+        if(praw->id() == 0x13)
+        {
+            memcpy(data,praw->data().data(),8);
+            double engine_speed;
+
+            engine_speed = (data[5]*256.0 + data[6])*0.125;
+
+            iv::chassis xchassis;
+            xchassis.set_engine_speed(engine_speed);
+
 
             ShareChassis(pa,&xchassis);
             nRtn = 1;

+ 2 - 0
src/detection/detection_chassis/decodechassis.h

@@ -13,6 +13,8 @@ int ProcPROBLUEChassis(void * pa, iv::can::canmsg * pmsg);
 
 int ProcMIDCARChassis(void * pa, iv::can::canmsg * pmsg);
 
+int ProcVV7Chassis(void * pa, iv::can::canmsg * pmsg);
+
 int ProcMIDBUSChassis(void * pa, iv::can::canmsg * pmsg);
 
 int ProcHAPOChassis(void * pa, iv::can::canmsg * pmsg);

+ 1 - 0
src/include/proto/chassis.proto

@@ -28,5 +28,6 @@ message chassis
   optional float frontrightwheel_feedback = 22;
   optional float rearleftwheel_feedback = 23;
   optional float rearrightwheel_feedback = 24;
+  optional float engine_speed = 25;
   
 };