|
@@ -5,8 +5,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
|
QMainWindow(parent),
|
|
QMainWindow(parent),
|
|
ui(new Ui::MainWindow)
|
|
ui(new Ui::MainWindow)
|
|
{
|
|
{
|
|
- //m_tbox=new Tbox();
|
|
|
|
- //initTboxMemory();
|
|
|
|
|
|
+ m_tbox=new Tbox();
|
|
|
|
+ initTboxMemory();
|
|
m_radio=new Radio();
|
|
m_radio=new Radio();
|
|
ui->setupUi(this);
|
|
ui->setupUi(this);
|
|
initUi();
|
|
initUi();
|
|
@@ -18,6 +18,10 @@ MainWindow::MainWindow(QWidget *parent) :
|
|
ModuleFun fungpsimu =std::bind(&MainWindow::UpdateGPSIMU,this,std::placeholders::_1, \
|
|
ModuleFun fungpsimu =std::bind(&MainWindow::UpdateGPSIMU,this,std::placeholders::_1, \
|
|
std::placeholders::_2,std::placeholders::_3,std::placeholders::_4,std::placeholders::_5);
|
|
std::placeholders::_2,std::placeholders::_3,std::placeholders::_4,std::placeholders::_5);
|
|
mpMemGps = iv::modulecomm::RegisterRecvPlus("hcp2_gpsimu",fungpsimu);
|
|
mpMemGps = iv::modulecomm::RegisterRecvPlus("hcp2_gpsimu",fungpsimu);
|
|
|
|
+ //ShareMem: ui
|
|
|
|
+ ModuleFun funUI =std::bind(&MainWindow::UpdateUI,this,std::placeholders::_1, \
|
|
|
|
+ std::placeholders::_2,std::placeholders::_3,std::placeholders::_4,std::placeholders::_5);
|
|
|
|
+ mpMemUI = iv::modulecomm::RegisterRecvPlus("hcp2_gpsimu",funUI);
|
|
}
|
|
}
|
|
|
|
|
|
MainWindow::~MainWindow()
|
|
MainWindow::~MainWindow()
|
|
@@ -244,3 +248,95 @@ void MainWindow::UpdateGPSIMU(const char * strdata,const unsigned int nSize,cons
|
|
// mfspeed = sqrt(pow(data->vel_E,2)+pow(data->vel_N,2)) * 3.6; //double pow(double x, double y) 返回 x 的 y 次幂,即 xy。
|
|
// mfspeed = sqrt(pow(data->vel_E,2)+pow(data->vel_N,2)) * 3.6; //double pow(double x, double y) 返回 x 的 y 次幂,即 xy。
|
|
//mistGPS = 0;
|
|
//mistGPS = 0;
|
|
}
|
|
}
|
|
|
|
+//UI DATA
|
|
|
|
+void MainWindow::UpdateUI(const char * strdata,const unsigned int nSize,const unsigned int index,\
|
|
|
|
+ const QDateTime * dt,const char * strmemname)
|
|
|
|
+{
|
|
|
|
+ double accX,accY,lat,lon,heading,rtk,ins,vd,ve,vn;
|
|
|
|
+ iv::hmi::hmimsg xhmi;
|
|
|
|
+ if(!xhmi.ParseFromArray(strdata,nSize))
|
|
|
|
+ {
|
|
|
|
+ mivlog->warn("ADCIntelligentVehicle::UpdateGPSIMU parse error. nSize is %d",nSize);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if(xhmi.has_obuen()) {
|
|
|
|
+ bool enRadio=xhmi.obuen();
|
|
|
|
+ setEnRadio(enRadio);
|
|
|
|
+ }
|
|
|
|
+ if(xhmi.has_platformen()) {
|
|
|
|
+ bool enTbox=xhmi.platformen();
|
|
|
|
+ if(enTbox) {
|
|
|
|
+ enableTbox();
|
|
|
|
+ } else {
|
|
|
|
+ disableTbox();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(xhmi.has_vin()) {
|
|
|
|
+ std::string str=xhmi.vin();
|
|
|
|
+ ui->lineEdit_VIN->setText(QString::fromStdString(str));
|
|
|
|
+ m_tbox->setTboxNewVin(str);
|
|
|
|
+ }
|
|
|
|
+ if(xhmi.has_rodeinfoen()) {
|
|
|
|
+ bool enRadioBroadcast = xhmi.rodeinfoen();
|
|
|
|
+ m_radio->getTrafficBroadcast(enRadioBroadcast);
|
|
|
|
+ ui->checkBox_trafficBroadcast->setChecked(enRadioBroadcast);
|
|
|
|
+ }
|
|
|
|
+ if(xhmi.has_rodefcwen()) {
|
|
|
|
+ bool enRadioWarning = xhmi.rodefcwen();
|
|
|
|
+ m_radio->getCollisonWarning(enRadioWarning);
|
|
|
|
+ ui->checkBox_collisionWarning->setChecked(enRadioWarning);
|
|
|
|
+ }
|
|
|
|
+ if(xhmi.has_roadjamsen()) {
|
|
|
|
+ bool enRadioIdenti = xhmi.roadjamsen();
|
|
|
|
+ m_radio->getBusyRoad(enRadioIdenti);
|
|
|
|
+ ui->checkBox_busyRoad->setChecked(enRadioIdenti);
|
|
|
|
+ }
|
|
|
|
+ if(xhmi.has_roaddricrimsen()) {
|
|
|
|
+ bool enRadioDanger =xhmi.roaddricrimsen();
|
|
|
|
+ m_radio->getDangerDrive(enRadioDanger);
|
|
|
|
+ ui->checkBox_dangerousDrive->setChecked(enRadioDanger);
|
|
|
|
+ }
|
|
|
|
+ if((xhmi.has_carcount())&&(xhmi.has_latup())&&(xhmi.has_latlow())
|
|
|
|
+ &&(xhmi.has_lonup())&&(xhmi.has_lonlow())
|
|
|
|
+ &&(xhmi.has_headingup())&&(xhmi.has_headinglow())
|
|
|
|
+ &&(xhmi.has_speedlow())&&(xhmi.has_speedup())) {
|
|
|
|
+ int virtualVehicleNum= int(xhmi.carcount());
|
|
|
|
+ ui->lineEdit_virtualVehicleNum->setText(QString::number(virtualVehicleNum));
|
|
|
|
+ double latMax = xhmi.latup();
|
|
|
|
+ ui->lineEdit_latMax->setText(QString("%1").arg(latMax));
|
|
|
|
+ double latMin= xhmi.latlow();
|
|
|
|
+ ui->lineEdit_latMin->setText(QString("%1").arg(latMin));
|
|
|
|
+ double lngMax= xhmi.lonup();
|
|
|
|
+ ui->lineEdit_lngMax->setText(QString("%1").arg(lngMax));
|
|
|
|
+ double lngMin= xhmi.lonlow();
|
|
|
|
+ ui->lineEdit_lngMin->setText(QString("%1").arg(lngMin));
|
|
|
|
+ float speedMax= xhmi.speedup();
|
|
|
|
+ ui->lineEdit_speedMax->setText(QString("%1").arg(speedMax));
|
|
|
|
+ float speedMin= xhmi.speedlow();
|
|
|
|
+ ui->lineEdit_speedMin->setText(QString("%1").arg(speedMin));
|
|
|
|
+ float yawMax=xhmi.headingup();
|
|
|
|
+ ui->lineEdit_yawMax->setText(QString("%1").arg(yawMax));
|
|
|
|
+ float yawMin=xhmi.headinglow();
|
|
|
|
+ ui->lineEdit_yawMin->setText(QString("%1").arg(yawMin));
|
|
|
|
+ int randId=qrand()%10000;
|
|
|
|
+ m_vectorRandom.push_back(randId);
|
|
|
|
+ virtualVehicleM structVirtualVehicle;
|
|
|
|
+ for(int i=1;i<virtualVehicleNum;i++) {
|
|
|
|
+ getRandomNum();
|
|
|
|
+ }
|
|
|
|
+ for(int i=0;i<virtualVehicleNum;i++) {
|
|
|
|
+ structVirtualVehicle.vin = m_vectorVin[i];
|
|
|
|
+ structVirtualVehicle.gps_lat=latMin+((double(m_vectorRandom[i]))/10000.0)*(latMax-latMin);
|
|
|
|
+ structVirtualVehicle.gps_lng=lngMin+((double(m_vectorRandom[i]))/10000.0)*(lngMax-lngMin);
|
|
|
|
+ structVirtualVehicle.speed=speedMin+((float(m_vectorRandom[i]))/10000.0)*(speedMax-speedMin);
|
|
|
|
+ structVirtualVehicle.yaw=yawMin+((float(m_vectorRandom[i]))/10000.0)*(yawMax-yawMin);
|
|
|
|
+ m_radio->upVirtualVehicle(structVirtualVehicle);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+}
|