Browse Source

change detection_chassis for hunter.

yuchuli 1 year ago
parent
commit
a132e1dc56
1 changed files with 10 additions and 5 deletions
  1. 10 5
      src/detection/detection_chassis/decodechassis.cpp

+ 10 - 5
src/detection/detection_chassis/decodechassis.cpp

@@ -551,16 +551,21 @@ int ProcHunterChassis(void *pa, iv::can::canmsg *pmsg)
         {
             unsigned char vdata[2];
             memcpy(&vdata,praw->data().data(),2);
-            double fvh = vdata[0];
-            double fvl = vdata[1];
-            double vehspeed = (fvh * 256 + fvl) * 0.001;
+            unsigned char vswap[2];
+            vswap[0] = vdata[1];
+            vswap[1] = vdata[0];
+            short svalue;
+            memcpy(&svalue,vswap,2);
+            double vehspeed =  svalue;
+            vehspeed = vehspeed * 0.001 *3.6;
             xchassis.set_vel(static_cast<float>(vehspeed));
             bHave0x221 = true;
         }
         if(praw->id() == 0x361)
         {
-            unsigned char vdata[2];
-            memcpy(&vdata,praw->data().data(),1);
+            unsigned char vdata[8];
+            memcpy(&vdata,praw->data().data(),8);
+ //           std::cout<<" vdata "<<(int)vdata[0]<<" "<<(int)vdata[1]<<" "<<(int)vdata[2]<<" "<<(int)vdata[3]<<" "<<std::endl;
             fsoc = vdata[0];
             memcpy(&vdata,praw->data().data() + 1,1);
             fsoh = vdata[0];