|
@@ -132,8 +132,13 @@ MainWindow::MainWindow(QWidget *parent) :
|
|
|
{
|
|
|
ui->setupUi(this);
|
|
|
|
|
|
+ mpLabelStatus = new QLabel("No NDT Pos",ui->statusbar);
|
|
|
+ mpLabelStatus->setMinimumWidth(350);
|
|
|
+
|
|
|
ui->pushButton_EnableRelocation->setEnabled(false);
|
|
|
|
|
|
+ ui->pushButton_Test->setVisible(false);
|
|
|
+
|
|
|
ui->horizontalSlider->setRange(5,300);
|
|
|
ui->horizontalSlider->setValue(100);
|
|
|
|
|
@@ -151,6 +156,12 @@ MainWindow::MainWindow(QWidget *parent) :
|
|
|
\
|
|
|
mpthreadpcd = new std::thread(&MainWindow::threadpcdview,this);
|
|
|
|
|
|
+
|
|
|
+ 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);
|
|
|
+
|
|
|
+ connect(this,SIGNAL(ndtposupdate()),this,SLOT(onndtposupdate()));
|
|
|
+
|
|
|
setWindowTitle("NDT Matching View & Relocation Enable");
|
|
|
|
|
|
}
|
|
@@ -159,6 +170,7 @@ MainWindow::~MainWindow()
|
|
|
{
|
|
|
mbRun = false;
|
|
|
mpthreadpcd->join();
|
|
|
+ iv::modulecomm::Unregister(mpandtpos);
|
|
|
delete ui;
|
|
|
}
|
|
|
|
|
@@ -243,3 +255,53 @@ void MainWindow::on_comboBox_currentIndexChanged(int index)
|
|
|
{
|
|
|
gnViewMode = index;
|
|
|
}
|
|
|
+
|
|
|
+void MainWindow::UpdateNDTPos(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
|
|
|
+{
|
|
|
+ (void)index;
|
|
|
+ (void)dt;
|
|
|
+ (void)strmemname;
|
|
|
+
|
|
|
+ iv::lidar::ndtpos xndtpos;
|
|
|
+ if(xndtpos.ParseFromArray(strdata,nSize))
|
|
|
+ {
|
|
|
+ mmutexndtpos.lock();
|
|
|
+ mndtpos.CopyFrom(xndtpos);
|
|
|
+ mbndtposupdate = true;
|
|
|
+ mmutexndtpos.unlock();
|
|
|
+ emit ndtposupdate();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ std::cout<<"MainWindow::UpdateNDTPos Parse NDTPos Fail."<<std::endl;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+void MainWindow::onndtposupdate()
|
|
|
+{
|
|
|
+ if(mbndtposupdate)
|
|
|
+ {
|
|
|
+ iv::lidar::ndtpos xndtpos;
|
|
|
+ mmutexndtpos.lock();
|
|
|
+ xndtpos.CopyFrom(mndtpos);
|
|
|
+ mbndtposupdate = false;
|
|
|
+ mmutexndtpos.unlock();
|
|
|
+ gCurPose.x = xndtpos.pose_x();
|
|
|
+ gCurPose.y = xndtpos.pose_y();
|
|
|
+ gCurPose.z = xndtpos.pose_z();
|
|
|
+ gCurPose.yaw = xndtpos.pose_yaw();
|
|
|
+ gCurPose.pitch = xndtpos.pose_pitch();
|
|
|
+ gCurPose.roll = xndtpos.pose_roll();
|
|
|
+ ui->lineEdit_prob->setText(QString::number(xndtpos.trans_probability(),'f',3));
|
|
|
+ ui->lineEdit_score->setText(QString::number(xndtpos.fitness_score(),'f',3));
|
|
|
+ ui->lineEdit_x->setText(QString::number(gCurPose.x,'f',3));
|
|
|
+ ui->lineEdit_y->setText(QString::number(gCurPose.y,'f',3));
|
|
|
+ ui->lineEdit_z->setText(QString::number(gCurPose.z,'f',3));
|
|
|
+ ui->lineEdit_yaw->setText(QString::number(gCurPose.yaw,'f',3));
|
|
|
+ ui->lineEdit_pitch->setText(QString::number(gCurPose.pitch,'f',3));
|
|
|
+ ui->lineEdit_roll->setText(QString::number(gCurPose.roll,'f',3));
|
|
|
+
|
|
|
+ mpLabelStatus->setText("NDT Update Time:" + QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss:zzz"));
|
|
|
+ }
|
|
|
+}
|