|
@@ -252,12 +252,14 @@ MainWindow::MainWindow(QWidget *parent) :
|
|
|
|
|
|
ModuleFun fungpsimu =std::bind(&MainWindow::UpdateGPSIMU,this,std::placeholders::_1,std::placeholders::_2,std::placeholders::_3,std::placeholders::_4,std::placeholders::_5);
|
|
|
mpagpsimu = iv::modulecomm::RegisterRecvPlus("hcp2_gpsimu",fungpsimu);
|
|
|
+ mpafusiongpsimu = iv::modulecomm::RegisterRecvPlus("fusion_gpsimu",fungpsimu);
|
|
|
|
|
|
}
|
|
|
|
|
|
MainWindow::~MainWindow()
|
|
|
{
|
|
|
|
|
|
+ iv::modulecomm::Unregister(mpafusiongpsimu);
|
|
|
iv::modulecomm::Unregister(mpagpsimu);
|
|
|
iv::modulecomm::Unregister(mpatrace);
|
|
|
iv::modulecomm::Unregister(mpadst);
|
|
@@ -1503,9 +1505,13 @@ void MainWindow::UpdateMap(const char * strdata,const unsigned int nSize,const u
|
|
|
* @param strmemname
|
|
|
*/
|
|
|
|
|
|
+
|
|
|
+#include <thread>
|
|
|
+
|
|
|
void MainWindow::UpdateGPSIMU(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
|
|
|
{
|
|
|
|
|
|
+ static int64_t nlastfusionupdate = 0;// std::chrono::system_clock::now().time_since_epoch().count()/1000000 ;
|
|
|
iv::gps::gpsimu xgpsimu;
|
|
|
if(!xgpsimu.ParseFromArray(strdata,nSize))
|
|
|
{
|
|
@@ -1513,6 +1519,23 @@ void MainWindow::UpdateGPSIMU(const char * strdata,const unsigned int nSize,cons
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ int64_t nnow = std::chrono::system_clock::now().time_since_epoch().count()/1000000;
|
|
|
+
|
|
|
+ if(strncmp(strmemname,"fusion_gpsimu",255)!= 0)
|
|
|
+ {
|
|
|
+ if(abs(nnow - nlastfusionupdate)<1000)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // std::cout<<"use fusion."<<std::endl;
|
|
|
+ nlastfusionupdate = nnow;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
double flat,flon,fhead;
|
|
|
flat = xgpsimu.lat();
|
|
|
flon = xgpsimu.lon();
|