Browse Source

pointPillars ...............

nvidia 3 years ago
parent
commit
55143ecf6f

+ 19 - 4
src/detection/detection_lidar_PointPillars_MultiHead/detection_lidar_PointPillars_MultiHead.pro

@@ -1,6 +1,6 @@
 QT -= gui
 
-CONFIG += c++11 console
+CONFIG += c++14 console
 CONFIG -= app_bundle
 
 QMAKE_CXXFLAGS += -std=gnu++17
@@ -11,7 +11,7 @@ QMAKE_LFLAGS += -no-pie  -Wl,--no-as-needed
 # depend on your compiler). Please consult the documentation of the
 # deprecated API in order to know how to port your code away from it.
 DEFINES += QT_DEPRECATED_WARNINGS
-
+DEFINES += DEBUG_SHOW
 # You can also make your code fail to compile if you use deprecated APIs.
 # In order to do so, uncomment the following line.
 # You can also select to disable deprecated APIs only up to a certain version of Qt.
@@ -20,7 +20,11 @@ DEFINES += QT_DEPRECATED_WARNINGS
 SOURCES += main.cpp \
     pointpillars.cc \
     ../../include/msgtype/object.pb.cc \
-    ../../include/msgtype/objectarray.pb.cc
+    ../../include/msgtype/objectarray.pb.cc \
+    Tracker/Ctracker.cpp \
+    Tracker/HungarianAlg.cpp \
+    Tracker/Kalman.cpp \
+    Tracker/track.cpp
 
 DISTFILES += \
     nms.cu \
@@ -36,8 +40,16 @@ HEADERS += \
     preprocess.h \
     scatter.h \
     ../../include/msgtype/object.pb.h \
-    ../../include/msgtype/objectarray.pb.h
+    ../../include/msgtype/objectarray.pb.h \
+    Tracker/Ctracker.h \
+    Tracker/defines.h \
+    Tracker/HungarianAlg.h \
+    Tracker/Kalman.h \
+    Tracker/ShortPathCalculator.h \
+    Tracker/track.h \
+    Tracker/Tracking.hpp
 
+INCLUDEPATH+=Tracker
 
 CUDA_SOURCES +=  \
     nms.cu \
@@ -164,3 +176,6 @@ unix:LIBS +=  -lpcl_common\
         -lpcl_surface\
         -lpcl_tracking\
         -lpcl_visualization
+
+INCLUDEPATH += /usr/include/opencv4/
+LIBS += /usr/lib/aarch64-linux-gnu/libopencv*.so

+ 17 - 2
src/detection/detection_lidar_PointPillars_MultiHead/main.cpp

@@ -16,7 +16,7 @@
 #include <thread>
 #include "objectarray.pb.h"
 //#include "ivbacktrace.h"
-
+#include "Tracking.hpp"
 iv::Ivfault *gfault = nullptr;
 iv::Ivlog *givlog = nullptr;
 
@@ -30,6 +30,9 @@ const int kOutputNumBoxFeature = 7;
 std::string gstrinput;
 std::string gstroutput;
 
+TrackerSettings settings;
+CTracker tracker(settings);
+bool m_isTrackerInitialized = false;
 
 void PclToArray(
     const pcl::PointCloud<pcl::PointXYZI>::Ptr& in_pcl_pc_ptr,
@@ -159,7 +162,19 @@ void DectectOnePCD(const pcl::PointCloud<pcl::PointXYZI>::Ptr &pc_ptr)
     double timex = pc_ptr->header.stamp;
     timex = timex/1000.0;
     lidarobjvec.set_timestamp(pc_ptr->header.stamp);
+    //---------------------------------------------  init tracker  -------------------------------------------------
+    if (!m_isTrackerInitialized)
+    {
+        m_isTrackerInitialized = InitTracker(tracker);
+        if (!m_isTrackerInitialized)
+        {
+            std::cerr << "Tracker initialize error!!!" << std::endl;
+        }
+    }
+    Tracking(lidarobjvec, tracker);
+//    std::<<"track    end"<<std::endl;
 
+    //--------------------------------------------  end tracking  --------------------------------------------------
     int ntlen;
     std::string out = lidarobjvec.SerializeAsString();
     iv::modulecomm::ModuleSendMsg(gpdetect,out.data(),out.length());
@@ -269,7 +284,7 @@ int main(int argc, char *argv[])
     QCoreApplication a(argc, argv);
 
 //    RegisterIVBackTrace();
-
+    tracker.setSettings(settings);
     gfault = new iv::Ivfault("lidar_pointpillar");
     givlog = new iv::Ivlog("lidar_pointpillar");
 

+ 11 - 6
src/include/proto/object.proto

@@ -21,14 +21,18 @@ message Dimension {
   optional float z = 3 [default = 0];
 };
 
+message VelXY {
+  optional float x =1 [default = 0];
+  optional float y =2 [default = 0];
+};
 
 message lidarobject
 {
-  required PointXYZ min_point = 1;
-  required PointXYZ max_point = 2;
-  required PointXYZ centroid = 3;
-  required Dimension dimensions = 4;
-  required PointXYZ position = 5;
+  optional PointXYZ min_point = 1;
+  optional PointXYZ max_point = 2;
+  optional PointXYZ centroid = 3;
+  optional Dimension dimensions = 4;
+  optional PointXYZ position = 5;
   optional double angle =6;
   optional double velocity_linear_x = 7;
   optional double acceleration_linear_y = 8;
@@ -37,10 +41,11 @@ message lidarobject
   required int32 mnType = 11;
   optional int32 id = 12;
   optional int32 behavior_state = 13;
-  required float score = 14;
+  optional float score = 14;
   optional bool velocity_reliable = 15;
   optional bool pose_reliable = 16;
   repeated float type_probs = 17;
   repeated PointXYZI cloud = 18;
   optional string type_name = 19;
+  optional VelXY vel_relative = 20; //相对速度
 };