|
@@ -118,8 +118,15 @@ void ShowXODR(pcl::visualization::PCLVisualizer& viewer)
|
|
|
viewer.addLine(mass_center,kinectZ2,1.0f,1.0f,1.0f,"xodr2");
|
|
|
}
|
|
|
|
|
|
+pcl::visualization::PCLVisualizer *gpviewer;
|
|
|
+
|
|
|
+#include <vtkRenderer.h>
|
|
|
+#include <vtkRenderWindow.h>
|
|
|
+
|
|
|
void viewerOneOff (pcl::visualization::PCLVisualizer& viewer)
|
|
|
{
|
|
|
+ gpviewer = &viewer;
|
|
|
+// viewer.registerMouseCallback(mouseEventOccurred,(void *)&viewer);
|
|
|
//设置背景颜色
|
|
|
viewer.setBackgroundColor(0.0,0.0,0.0);
|
|
|
|
|
@@ -138,6 +145,8 @@ void viewerOneOff (pcl::visualization::PCLVisualizer& viewer)
|
|
|
viewer.resetCamera();
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
if (!pcl::io::loadOBJFile("./car.obj", mesh))
|
|
|
{
|
|
|
std::cout << "error"<<std::endl;
|
|
@@ -198,6 +207,8 @@ void viewerOneOff (pcl::visualization::PCLVisualizer& viewer)
|
|
|
// viewer.addCube(-0.9,0.9,-2.3,2.3,-1.9,-0.4,0.0,0.0,1.0,"car",0);
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
void viewerPsycho (pcl::visualization::PCLVisualizer& viewer)
|
|
@@ -401,6 +412,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|
|
mpthreadpcd = new std::thread(&MainWindow::threadpcdview,this);
|
|
|
|
|
|
|
|
|
+ mpadst = iv::modulecomm::RegisterSend("xodrreq",1000,1);
|
|
|
ModuleFun fun1 =std::bind(&MainWindow::UpdateNDTPos,this,std::placeholders::_1,std::placeholders::_2,std::placeholders::_3,std::placeholders::_4,std::placeholders::_5);
|
|
|
mpandtpos = iv::modulecomm::RegisterRecvPlus("ndtpos",fun1);
|
|
|
|
|
@@ -419,6 +431,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|
|
mpacnndetect = iv::modulecomm::RegisterRecvPlus("lidar_track",funcnndetect);
|
|
|
|
|
|
connect(this,SIGNAL(ndtposupdate()),this,SLOT(onndtposupdate()));
|
|
|
+ connect(this,SIGNAL(updatedst(double,double)),this,SLOT(onUpdateDst(double,double)));
|
|
|
|
|
|
setWindowTitle("NDT Matching View & Relocation Enable");
|
|
|
|
|
@@ -438,6 +451,8 @@ MainWindow::~MainWindow()
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
void MainWindow::threadpcdview()
|
|
|
{
|
|
|
mpviewer = new pcl::visualization::CloudViewer("Cloud View");
|
|
@@ -458,7 +473,7 @@ void MainWindow::threadpcdview()
|
|
|
|
|
|
|
|
|
//This will only get called once
|
|
|
- // mpviewer->runOnVisualizationThreadOnce (viewerOneOff);
|
|
|
+ mpviewer->runOnVisualizationThreadOnce (viewerOneOff);
|
|
|
|
|
|
|
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
|
@@ -466,6 +481,9 @@ void MainWindow::threadpcdview()
|
|
|
|
|
|
mpviewer->runOnVisualizationThread (viewerPsycho);
|
|
|
|
|
|
+// mpviewer->registerMouseCallback(mouseEventOccurred,(void *)mpviewer);
|
|
|
+ mpviewer->registerMouseCallback(&MainWindow::mouseEventOccurred,*this,(void *)mpviewer);
|
|
|
+
|
|
|
pcl::io::loadPCDFile<pcl::PointXYZI>(strpcpath,*point_cloud);
|
|
|
|
|
|
double flon,flat,fheading;
|
|
@@ -837,3 +855,60 @@ void MainWindow::ChangePointCloud(pcl::PointCloud<pcl::PointXYZI>::Ptr & point_c
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+void MainWindow::on_pushButton_Plan_clicked()
|
|
|
+{
|
|
|
+ QString strlon = ui->lineEdit_Lon->text();
|
|
|
+ QString strlat = ui->lineEdit_Lat->text();
|
|
|
+ if((strlon.length()<1) || (strlat.length()<1))
|
|
|
+ {
|
|
|
+ QMessageBox::warning(this,tr("Warning"),tr("Please Set Lon lat."),QMessageBox::YesAll);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ double lon,lat;
|
|
|
+ lon = ui->lineEdit_Lon->text().toDouble();
|
|
|
+ lat = ui->lineEdit_Lat->text().toDouble();
|
|
|
+
|
|
|
+ xodrobj xo;
|
|
|
+ xo.flon = lon;
|
|
|
+ xo.flat = lat;
|
|
|
+ xo.lane = 1;//mpLE_LaneSel->text().toInt();
|
|
|
+
|
|
|
+ iv::modulecomm::ModuleSendMsg(mpadst,(char *)&xo,sizeof(xodrobj));
|
|
|
+}
|
|
|
+
|
|
|
+void MainWindow::mouseEventOccurred (const pcl::visualization::MouseEvent &event,
|
|
|
+ void* viewer_void)
|
|
|
+{
|
|
|
+ if (event.getButton () == pcl::visualization::MouseEvent::LeftButton && event.getType () == pcl::visualization::MouseEvent::MouseDblClick)
|
|
|
+ {
|
|
|
+ vtkRenderer* renderer = gpviewer->getRenderWindow()->GetRenderers()->GetFirstRenderer() ;
|
|
|
+ renderer->SetDisplayPoint(event.getX (), event.getY (), 0);
|
|
|
+ renderer->DisplayToWorld();
|
|
|
+ double w_x = (renderer->GetWorldPoint())[0];
|
|
|
+ double w_y = (renderer->GetWorldPoint())[1];
|
|
|
+ double w_z = (renderer->GetWorldPoint())[2];
|
|
|
+
|
|
|
+ std::cout<<"w_x: "<<w_x<<" w_y:"<<w_y<<" w_z:"<<w_z<<std::endl;
|
|
|
+
|
|
|
+ emit updatedst(w_x,w_y);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void MainWindow::onUpdateDst(double w_x, double w_y)
|
|
|
+{
|
|
|
+ double x0,y0;
|
|
|
+ GaussProjCal(mflon0,mflat0,&x0,&y0);
|
|
|
+ double x, y;
|
|
|
+ x = x0 + w_x;
|
|
|
+ y = y0 + w_y;
|
|
|
+ double lon,lat;
|
|
|
+ GaussProjInvCal(x,y,&lon,&lat);
|
|
|
+ ui->lineEdit_Lon->setText(QString::number(lon,'f',7));
|
|
|
+ ui->lineEdit_Lat->setText(QString::number(lat,'f',7));
|
|
|
+}
|