Browse Source

fix(driver_radar_srr):fix share memory error and update build_lib.sh

HAPO#9 3 years ago
parent
commit
22264c2e90
2 changed files with 27 additions and 15 deletions
  1. 9 1
      autogen_lib.sh
  2. 18 14
      src/detection/detection_radar_delphi_srr/main.cpp

+ 9 - 1
autogen_lib.sh

@@ -91,6 +91,14 @@ rm Makefile
 rm .qmake.stash
 cd ../../../
 
-
+cd src/common/ivchart/
+$qtmake ivchart.pro
+make $MAKEOPT
+check_result $?
+make clean
+cp libivchart.so ./../../../bin/
+rm Makefile
+rm .qmake.stash
+cd ../../../
 
 

+ 18 - 14
src/detection/detection_radar_delphi_srr/main.cpp

@@ -96,10 +96,10 @@ void Listengpsimu(const char * strdata,const unsigned int nSize,const unsigned i
 /*vcan end*/
 void ShareResult()
 {
-    char * str = new char[gobj.ByteSize()];
     int nsize = gobj.ByteSize();
-    char * stright = new char[gobj.ByteSize()];
+    char * str = new char[nsize];
     int nsizeright = gobjright.ByteSize();
+    char * stright = new char[nsizeright];
     if(gobj.SerializeToArray(str,nsize))
     {
         iv::modulecomm::ModuleSendMsg(gpa,str,nsize);
@@ -162,20 +162,23 @@ void DecodeRadar(iv::can::canmsg xmsg)
 
             double x = x_temp;
             double y = y_temp;
-            x_temp = x * cos_rotation + y * sin_rotation + gstrRadarLeft_Offset_X.toDouble();
-            y_temp = y * cos_rotation - x * sin_rotation + gstrRadarLeft_Offset_Y.toDouble();
+            x_temp = x * cos_rotation - y * sin_rotation + gstrRadarLeft_Offset_X.toDouble();
+            y_temp = y * cos_rotation + x * sin_rotation + gstrRadarLeft_Offset_Y.toDouble();
 
             x = vx_temp;
             y = vy_temp;
-            vx_temp = x * cos_rotation + y * sin_rotation;
-            vy_temp = y * cos_rotation - x * sin_rotation;
+            vx_temp = x * cos_rotation - y * sin_rotation;
+            vy_temp = y * cos_rotation + x * sin_rotation;
 
-            if ((angle != 0 || range != 0) && detect_status != 0 && detect_valid_level > 1) {
+            if ((angle != 0 || range != 0) && detect_status != 0 && detect_valid_level >= 1) {
                 iv::radar::radarobject * pobj = gobj.mutable_obj(radar_ID_index);
                 pobj->set_bvalid(true);
                 pobj->set_x(x_temp);
                 pobj->set_y(y_temp);
                 pobj->set_vel(rate_temp);
+                pobj->set_range(range_temp);
+                pobj->set_range_rate(rate_temp);
+                pobj->set_angle(angle_temp);
                 pobj->set_vx(vx_temp);
                 pobj->set_vy(vy_temp);
                 pobj->set_power(object_power);
@@ -255,20 +258,23 @@ void DecodeRadar(iv::can::canmsg xmsg)
 
             double x = x_temp;
             double y = y_temp;
-            x_temp = x * cos_rotation + y * sin_rotation + gstrRadarRight_Offset_X.toDouble();
-            y_temp = y * cos_rotation - x * sin_rotation + gstrRadarRight_Offset_Y.toDouble();
+            x_temp = x * cos_rotation - y * sin_rotation + gstrRadarRight_Offset_X.toDouble();
+            y_temp = y * cos_rotation + x * sin_rotation + gstrRadarRight_Offset_Y.toDouble();
 
             x = vx_temp;
             y = vy_temp;
-            vx_temp = x * cos_rotation + y * sin_rotation;
-            vy_temp = y * cos_rotation - x * sin_rotation;
+            vx_temp = x * cos_rotation - y * sin_rotation;
+            vy_temp = y * cos_rotation + x * sin_rotation;
 
-            if ((angle_right != 0 || range_right != 0) && detect_status != 0 && detect_valid_level > 1) {
+            if ((angle_right != 0 || range_right != 0) && detect_status != 0 && detect_valid_level >= 1) {
                 iv::radar::radarobject * pobj = gobjright.mutable_obj(radar_ID_index);
                 pobj->set_bvalid(true);
                 pobj->set_x(x_temp);
                 pobj->set_y(y_temp);
                 pobj->set_vel(rate_temp);
+                pobj->set_range(range_temp);
+                pobj->set_range_rate(rate_temp);
+                pobj->set_angle(angle_temp);
                 pobj->set_vx(vx_temp);
                 pobj->set_vy(vy_temp);
                 pobj->set_power(object_power);
@@ -409,12 +415,10 @@ int main(int argc, char *argv[])
     gstrRadarLeft_Offset_X = gstrRadarLeft_Offset_X.fromStdString(xp.GetParam("radar_left_offset_x","0"));
     gstrRadarLeft_Offset_Y = gstrRadarLeft_Offset_Y.fromStdString(xp.GetParam("radar_left_offset_y","0"));
     gstrRadarLeft_Mirror = gstrRadarLeft_Mirror.fromStdString(xp.GetParam("radar_left_mirror","0"));
-    std::cout << gstrRadarLeft_Mirror.toInt() << std::endl;
     gstrRadarRight_Angle = gstrRadarRight_Angle.fromStdString(xp.GetParam("radar_right_angle","-120"));
     gstrRadarRight_Offset_X = gstrRadarRight_Offset_X.fromStdString(xp.GetParam("radar_right_offset_x","0"));
     gstrRadarRight_Offset_Y = gstrRadarRight_Offset_Y.fromStdString(xp.GetParam("radar_right_offset_y","0"));
     gstrRadarRight_Mirror = gstrRadarRight_Mirror.fromStdString(xp.GetParam("radar_right_mirror","0"));
-    std::cout << gstrRadarRight_Mirror.toInt() << std::endl;
 
     gpa = iv::modulecomm::RegisterSend(strmemradarleft.data(),100000,3);
     gpb = iv::modulecomm::RegisterSend(strmemradaright.data(),100000,3);