Explorar el Código

change driver_lidar_leishen_chx. add yaml for configure ignore range.

yuchuli hace 1 año
padre
commit
57f56722e4

+ 8 - 0
src/driver/driver_lidar_leishen_chx/driver_lidar_leishen_chx.yaml

@@ -0,0 +1,8 @@
+useignore : true
+ignore_x_min : -1.0
+ignore_x_max : 1.0
+ignore_y_min : -2.3
+ignore_y_max : 2.3
+
+
+

+ 31 - 7
src/driver/driver_lidar_leishen_chx/leishenchx.cpp

@@ -2,7 +2,9 @@
 
 leishenchx::leishenchx(char * strmemname,double froll,double finclinationang_xaxis ,
                        double finclinationang_yaxis , int nDevMode ,
-                       unsigned short nDataPort,unsigned short nDevPort,std::string strtype):
+                       unsigned short nDataPort,unsigned short nDevPort,std::string strtype,
+                                      bool buseignore ,double fignore_x_min ,double fignore_x_max ,
+                                      double fignore_y_min,double fignore_y_max ):
     socket_id(-1),
     point_cloud_xyzi_(new pcl::PointCloud<pcl::PointXYZI>),
     point_cloud_xyzi_bak_(new pcl::PointCloud<pcl::PointXYZI>),
@@ -62,6 +64,12 @@ leishenchx::leishenchx(char * strmemname,double froll,double finclinationang_xax
     mplidardevudp = new lidarudp(nDevPort);
     mpthreaddev = new std::thread(&leishenchx::threaddevdecode,this);
     mpthread = new std::thread(&leishenchx::threaddecode,this);
+
+    mbuseignore = buseignore;
+    mfignore_x_min = fignore_x_min;
+    mfignore_x_max = fignore_x_max;
+    mfignore_y_min = fignore_y_min;
+    mfignore_y_max = fignore_y_max;
 }
 
 leishenchx::~leishenchx()
@@ -1002,12 +1010,28 @@ int leishenchx::convertCoordinate(struct Firing &lidardata) {
         noldaz =  lidardata.azimuth;
 
         pcl::PointXYZI point_xyzi;
-        point_xyzi.x = x;
-        point_xyzi.y = y;
-        point_xyzi.z = z;
-        point_xyzi.intensity = lidardata.intensity;
-        point_cloud_xyzi_->points.push_back(point_xyzi);
-        ++point_cloud_xyzi_->width;
+        if(mbuseignore == false){
+            point_xyzi.x = x;
+            point_xyzi.y = y;
+            point_xyzi.z = z;
+            point_xyzi.intensity = lidardata.intensity;
+            point_cloud_xyzi_->points.push_back(point_xyzi);
+            ++point_cloud_xyzi_->width;
+        } else {
+
+            if((x>mfignore_x_min)&&(x<mfignore_x_max)&&(y>mfignore_y_min)&&(y<mfignore_y_max)){
+
+            } else {
+
+                point_xyzi.x = x;
+                point_xyzi.y = y;
+                point_xyzi.z = z;
+                point_xyzi.intensity = lidardata.intensity;
+                point_cloud_xyzi_->points.push_back(point_xyzi);
+                ++point_cloud_xyzi_->width;
+            }
+        }
+
     } else {
 
     }

+ 10 - 1
src/driver/driver_lidar_leishen_chx/leishenchx.h

@@ -70,7 +70,9 @@ class leishenchx : public lidardecode
 public:
     leishenchx(char * strmemname, double froll = 0.0,double finclinationang_xaxis = 0.0,
                double finclinationang_yaxis = 0.0, int nDevMode = 0,
-               unsigned short nDataPort = 2368,unsigned short nDevPort = 2369,std::string strtype = "ch128x1");
+               unsigned short nDataPort = 2368,unsigned short nDevPort = 2369,std::string strtype = "ch128x1",
+               bool buseignore = false,double fignore_x_min = 0,double fignore_x_max = 0,
+               double fignore_y_min = 0,double fignore_y_max = 0);
 
     ~leishenchx();
 
@@ -84,6 +86,13 @@ private:
         float time;
     };
 
+private:
+    bool mbuseignore = false;
+    double mfignore_x_min;
+    double mfignore_x_max;
+    double mfignore_y_min;
+    double mfignore_y_max;
+
 private:
     bool initialize();
 

+ 48 - 1
src/driver/driver_lidar_leishen_chx/main.cpp

@@ -20,6 +20,11 @@ static char gstr_yaml[256];
 static char gstr_modulename[256];
 static char gstr_devmode[256];
 static char gstr_devtype[256];
+static double gignore_x_max;
+static double gignore_x_min;
+static double gignore_y_max;
+static double gignore_y_min;
+static bool gbuseignore = false;
 
 /**
  * @brief print_useage
@@ -158,6 +163,44 @@ void decodeyaml(const char * stryaml)
         return;
     }
 
+    if(config["ignore_x_min"])
+    {
+        char strdata[256];
+        strncpy(strdata,config["ignore_x_min"].as<std::string>().data(),255);
+        gignore_x_min = atof(strdata);
+    }
+
+    if(config["ignore_x_max"])
+    {
+        char strdata[256];
+        strncpy(strdata,config["ignore_x_max"].as<std::string>().data(),255);
+        gignore_x_max = atof(strdata);
+    }
+
+    if(config["ignore_y_min"])
+    {
+        char strdata[256];
+        strncpy(strdata,config["ignore_y_min"].as<std::string>().data(),255);
+        gignore_y_min = atof(strdata);
+    }
+
+    if(config["ignore_y_max"])
+    {
+        char strdata[256];
+        strncpy(strdata,config["ignore_y_max"].as<std::string>().data(),255);
+        gignore_y_max = atof(strdata);
+    }
+
+    if(config["useignore"])
+    {
+        char strdata[256];
+        strncpy(strdata,config["useignore"].as<std::string>().data(),255);
+        if(strncmp(strdata,"true",256) == 0)
+        {
+            gbuseignore = true;
+        }
+    }
+
 
     if(config["memname"])
     {
@@ -226,6 +269,8 @@ int main(int argc, char *argv[])
         return 0;
     }
 
+//    snprintf(gstr_yaml,256,"driver_lidar_leishen_chx.yaml");
+
     if(strnlen(gstr_yaml,255)>1)
     {
         decodeyaml(gstr_yaml);
@@ -235,7 +280,9 @@ int main(int argc, char *argv[])
 
     leishenchx * pleishenchx = new leishenchx(gstr_memname,atof(gstr_rollang),atof(gstr_inclinationang_xaxis),
                                              atof(gstr_inclinationang_yaxis),atoi(gstr_devmode),static_cast<unsigned short>(atoi(gstr_port)),
-                                             static_cast<unsigned short>(atoi(gstr_devport)),std::string(gstr_devtype));
+                                             static_cast<unsigned short>(atoi(gstr_devport)),std::string(gstr_devtype),
+                                              gbuseignore,gignore_x_min,gignore_x_max,
+                                              gignore_y_min,gignore_y_max);
     (void)pleishenchx;
 
     return a.exec();

+ 83 - 0
src/driver/driver_radar_4d_ars548/view_radar4d_ars548.pro

@@ -0,0 +1,83 @@
+QT       += core gui
+
+#QT       += openglwidgets
+
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
+#TARGET = view_radar4d_ars548
+
+CONFIG += c++17
+
+# You can make your code fail to compile if it uses deprecated APIs.
+# In order to do so, uncomment the following line.
+#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
+
+SOURCES += \
+    ../../include/msgtype/radar4ddetect.pb.cc \
+    ../../include/msgtype/radar4ddetectarray.pb.cc \
+    ../../include/msgtype/radar4dobject.pb.cc \
+    ../../include/msgtype/radar4dobjectarray.pb.cc \
+    ar548pac.cpp \
+    ars548recv.cpp \
+    viewmain.cpp \
+    mainwindow.cpp
+
+HEADERS += \
+    ../../include/msgtype/radar4ddetect.pb.h \
+    ../../include/msgtype/radar4ddetectarray.pb.h \
+    ../../include/msgtype/radar4dobject.pb.h \
+    ../../include/msgtype/radar4dobjectarray.pb.h \
+    ar548pac.h \
+    ars548recv.h \
+    mainwindow.h
+
+FORMS += \
+    mainwindow.ui
+
+# Default rules for deployment.
+qnx: target.path = /tmp/$${TARGET}/bin
+else: unix:!android: target.path = /opt/$${TARGET}/bin
+!isEmpty(target.path): INSTALLS += target
+
+INCLUDEPATH += /usr/include/eigen3
+INCLUDEPATH += /usr/include/pcl-1.12
+INCLUDEPATH += /usr/include/vtk-9.1
+INCLUDEPATH += /usr/include/vtk-6.3
+INCLUDEPATH += /usr/include/vtk-7.1
+INCLUDEPATH += /usr/include/pcl-1.8
+INCLUDEPATH += /usr/include/pcl-1.10
+INCLUDEPATH += /usr/include/pcl-1.7
+
+
+!include(../../../include/common.pri ) {
+    error( "Couldn't find the common.pri file!" )
+}
+
+!include(../../../include/ivprotobuf.pri ) {
+    error( "Couldn't find the ivprotobuf.pri file!" )
+}
+
+unix:LIBS +=  -lpcl_common\
+        -lpcl_features\
+        -lpcl_filters\
+        -lpcl_io\
+        -lpcl_io_ply\
+        -lpcl_kdtree\
+        -lpcl_keypoints\
+        -lpcl_octree\
+        -lpcl_outofcore\
+        -lpcl_people\
+        -lpcl_recognition\
+        -lpcl_registration\
+        -lpcl_sample_consensus\
+        -lpcl_search\
+        -lpcl_segmentation\
+        -lpcl_surface\
+        -lpcl_tracking\
+        -lpcl_visualization
+
+LIBS += /usr/lib/aarch64-linux-gnu/libvtk*.so
+
+#LIBS += -lvtkCommonExecutionModel-9.1 -lvtkCommonCore-9.1 -lvtkRenderingLOD-9.1 -lvtkRenderingCore-9.1 \
+#       -lvtkFiltersSources-9.1 -lvtkCommonColor-9.1  -lvtkGUISupportQt-9.1  -lvtkInteractionStyle-9.1   -lvtkRenderingContextOpenGL2-9.1   -lvtkRenderingFreeType-9.1   \
+#       -lvtkRenderingOpenGL2-9.1