|
@@ -45,6 +45,12 @@ static bool gbCarModelLoad = false;
|
|
|
extern bool gbShowPointCloud;
|
|
|
extern bool gbShowXODRAsLine;
|
|
|
extern double gfVehicleZOff;
|
|
|
+extern bool gbShowCNN;
|
|
|
+
|
|
|
+static std::vector<std::string> gvectorobjviewname;
|
|
|
+static int64_t gnLastLidarUpdatems = 0;
|
|
|
+static iv::lidar::objectarray gobjarray;
|
|
|
+static std::mutex gmutexlidarobj;
|
|
|
|
|
|
#include <cmath>
|
|
|
|
|
@@ -262,7 +268,7 @@ void viewerPsycho (pcl::visualization::PCLVisualizer& viewer)
|
|
|
// viewer.addCube(mpos_x+20 -0.9,mpos_x + 20+0.9,-2.3,2.3,-1.9,-0.4,0.0,0.0,1.0,"car",0);
|
|
|
// viewer.addCube(trans,quat,6.0,3.0,1.0,"car");
|
|
|
|
|
|
- Eigen::AngleAxisf rotation_vector(gCurPose.z, Eigen::Vector3f(0, 0, 1));
|
|
|
+ Eigen::AngleAxisf rotation_vector(gCurPose.yaw, Eigen::Vector3f(0, 0, 1));
|
|
|
|
|
|
viewer.addCube(Eigen::Vector3f(gCurPose.x,gCurPose.y,gCurPose.z-1.15),
|
|
|
Eigen::Quaternionf(rotation_vector), 4.6, 2.3, 1.5, "car");
|
|
@@ -300,6 +306,56 @@ void viewerPsycho (pcl::visualization::PCLVisualizer& viewer)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ if(gbShowCNN)
|
|
|
+ {
|
|
|
+ unsigned int i;
|
|
|
+ for(i=0;i<gvectorobjviewname.size();i++)
|
|
|
+ {
|
|
|
+ viewer.removeShape(gvectorobjviewname[i]);
|
|
|
+ }
|
|
|
+ gvectorobjviewname.clear();
|
|
|
+ int64_t nNow = std::chrono::system_clock::now().time_since_epoch().count()/1000000;
|
|
|
+
|
|
|
+ static int64_t nobjuptime = 0;
|
|
|
+ static iv::lidar::objectarray xlidarobjarray;
|
|
|
+
|
|
|
+ if(nobjuptime != gnLastLidarUpdatems)
|
|
|
+ {
|
|
|
+ gmutexlidarobj.lock();
|
|
|
+ xlidarobjarray.CopyFrom(gobjarray);
|
|
|
+ gmutexlidarobj.unlock();
|
|
|
+ nobjuptime = gnLastLidarUpdatems;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(abs(nNow - nobjuptime) < 3000)
|
|
|
+ {
|
|
|
+ unsigned int j;
|
|
|
+ for(j=0;j<xlidarobjarray.obj_size();j++)
|
|
|
+ {
|
|
|
+ iv::lidar::lidarobject * pobj = xlidarobjarray.mutable_obj(j);
|
|
|
+ double fobjpos_x,fobjpos_y,fobjpos_z;
|
|
|
+ fobjpos_x = gCurPose.x + pobj->position().x() * cos(gCurPose.yaw) - pobj->position().y() * sin(gCurPose.yaw);
|
|
|
+ fobjpos_y = gCurPose.y + pobj->position().x() * sin(gCurPose.yaw) - pobj->position().y() * cos(gCurPose.yaw);
|
|
|
+ fobjpos_z = pobj->position().z();
|
|
|
+ double fobj_yaw = gCurPose.yaw + pobj->tyaw();
|
|
|
+ char strname[256];
|
|
|
+ snprintf(strname,256,"obj%d",j);
|
|
|
+ std::string strobjname = strname;
|
|
|
+
|
|
|
+ Eigen::AngleAxisf rotation_vector(fobj_yaw, Eigen::Vector3f(0, 0, 1));
|
|
|
+
|
|
|
+ viewer.addCube(Eigen::Vector3f(fobjpos_x,fobjpos_y,fobjpos_z),
|
|
|
+ Eigen::Quaternionf(rotation_vector), pobj->dimensions().x(),pobj->dimensions().y(), pobj->dimensions().z(), strobjname);
|
|
|
+
|
|
|
+ gvectorobjviewname.push_back(strobjname);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
std::stringstream ss;
|
|
|
// viewer.setCameraPosition(mpos_x,0,30,mpos_x + 20,0,0,0,0,0);
|
|
|
// ss << "Once per viewer loop: " << count++;
|
|
@@ -316,6 +372,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
|
|
{
|
|
|
ui->setupUi(this);
|
|
|
|
|
|
+ gvectorobjviewname.clear();
|
|
|
+
|
|
|
mpLabelStatus = new QLabel("No NDT Pos",ui->statusbar);
|
|
|
mpLabelStatus->setMinimumWidth(350);
|
|
|
|
|
@@ -356,6 +414,9 @@ MainWindow::MainWindow(QWidget *parent) :
|
|
|
ModuleFun funfusiongpsimu =std::bind(&MainWindow::UpdateGPSIMU,this,std::placeholders::_1,std::placeholders::_2,std::placeholders::_3,std::placeholders::_4,std::placeholders::_5);
|
|
|
mpafusiongpsimu = iv::modulecomm::RegisterRecvPlus("fusion_gpsimu",funfusiongpsimu);
|
|
|
|
|
|
+ ModuleFun funcnndetect =std::bind(&MainWindow::Updatelidarcnndetect,this,std::placeholders::_1,std::placeholders::_2,std::placeholders::_3,std::placeholders::_4,std::placeholders::_5);
|
|
|
+ mpacnndetect = iv::modulecomm::RegisterRecvPlus("lidar_track",funcnndetect);
|
|
|
+
|
|
|
connect(this,SIGNAL(ndtposupdate()),this,SLOT(onndtposupdate()));
|
|
|
|
|
|
setWindowTitle("NDT Matching View & Relocation Enable");
|
|
@@ -367,6 +428,8 @@ MainWindow::~MainWindow()
|
|
|
{
|
|
|
mbRun = false;
|
|
|
mpthreadpcd->join();
|
|
|
+ iv::modulecomm::Unregister(mpacnndetect);
|
|
|
+ iv::modulecomm::Unregister(mpafusiongpsimu);
|
|
|
iv::modulecomm::Unregister(mpandtpos);
|
|
|
iv::modulecomm::Unregister(mparelocate);
|
|
|
iv::modulecomm::Unregister(mpapcdmap);
|
|
@@ -533,6 +596,23 @@ void MainWindow::on_comboBox_currentIndexChanged(int index)
|
|
|
gnViewMode = index;
|
|
|
}
|
|
|
|
|
|
+void MainWindow::Updatelidarcnndetect(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
|
|
|
+{
|
|
|
+ iv::lidar::objectarray lidarobj;
|
|
|
+
|
|
|
+ if(nSize<1)return;
|
|
|
+ if(false == lidarobj.ParseFromArray(strdata,nSize))
|
|
|
+ {
|
|
|
+ std::cout<<"Updatelidarcnndetect parse fail."<<std::endl;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ gmutexlidarobj.lock();
|
|
|
+ gnLastLidarUpdatems = std::chrono::system_clock::now().time_since_epoch().count()/1000000;
|
|
|
+ gobjarray.CopyFrom(lidarobj);
|
|
|
+ gmutexlidarobj.unlock();
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
void MainWindow::UpdateGPSIMU(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
|
|
|
{
|
|
|
|