|
@@ -69,10 +69,10 @@ void MyView::keyPressEvent(QKeyEvent *event)
|
|
{
|
|
{
|
|
emit CtrlManual(false);
|
|
emit CtrlManual(false);
|
|
}
|
|
}
|
|
- // qDebug("key count is %d",mPressKeys.count());
|
|
|
|
-// QDateTime dt;
|
|
|
|
-// qDebug("key press %ld",QDateTime::currentMSecsSinceEpoch());
|
|
|
|
-// qDebug(" key is %d",event->key());
|
|
|
|
|
|
+ // qDebug("key count is %d",mPressKeys.count());
|
|
|
|
+ // QDateTime dt;
|
|
|
|
+ // qDebug("key press %ld",QDateTime::currentMSecsSinceEpoch());
|
|
|
|
+ // qDebug(" key is %d",event->key());
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -80,8 +80,8 @@ void MyView::keyReleaseEvent(QKeyEvent *event)
|
|
{
|
|
{
|
|
if(!event->isAutoRepeat())mPressKeys.remove(event->key());
|
|
if(!event->isAutoRepeat())mPressKeys.remove(event->key());
|
|
qDebug("key count is %d",mPressKeys.count());
|
|
qDebug("key count is %d",mPressKeys.count());
|
|
-// QDateTime dt;
|
|
|
|
-// qDebug("key release %ld",QDateTime::currentMSecsSinceEpoch());
|
|
|
|
|
|
+ // QDateTime dt;
|
|
|
|
+ // qDebug("key release %ld",QDateTime::currentMSecsSinceEpoch());
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -125,7 +125,7 @@ ADCIntelligentVehicle * gAV;
|
|
*/
|
|
*/
|
|
void ListenCANState(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
|
|
void ListenCANState(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
|
|
{
|
|
{
|
|
-// gIvlog->debug("ListenCanState");
|
|
|
|
|
|
+ // gIvlog->debug("ListenCanState");
|
|
gAV->UpdateCANState(strdata,nSize);
|
|
gAV->UpdateCANState(strdata,nSize);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -172,9 +172,9 @@ void ListenOBS(const char * strdata,const unsigned int nSize,const unsigned int
|
|
//v2x使能状态请求
|
|
//v2x使能状态请求
|
|
void ListenV2xStReq(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
|
|
void ListenV2xStReq(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
|
|
{
|
|
{
|
|
-// gIvlog->info("hmi", "v2x enable request %d %d",nSize,sizeof(iv::v2x::v2xStReq));
|
|
|
|
-// if(nSize < sizeof(iv::v2x::v2xStReq))
|
|
|
|
-// return;
|
|
|
|
|
|
+ // gIvlog->info("hmi", "v2x enable request %d %d",nSize,sizeof(iv::v2x::v2xStReq));
|
|
|
|
+ // if(nSize < sizeof(iv::v2x::v2xStReq))
|
|
|
|
+ // return;
|
|
|
|
|
|
iv::v2x::v2xStReq xv2xStReqMsg;
|
|
iv::v2x::v2xStReq xv2xStReqMsg;
|
|
if(!xv2xStReqMsg.ParseFromArray(strdata,nSize))
|
|
if(!xv2xStReqMsg.ParseFromArray(strdata,nSize))
|
|
@@ -192,17 +192,13 @@ void ListenV2xStReq(const char * strdata,const unsigned int nSize,const unsigned
|
|
//vbu数据处理
|
|
//vbu数据处理
|
|
void ListenObu(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
|
|
void ListenObu(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
|
|
{
|
|
{
|
|
-// iv::v2x::v2xStReq xv2xStReqMsg;
|
|
|
|
-// if(!xv2xStReqMsg.ParseFromArray(strdata,nSize))
|
|
|
|
-// {
|
|
|
|
-// gIvlog->error("hmi", "iv::v2x::xv2xStReqMsg::ListenV2xStReq parse error");
|
|
|
|
-// return;
|
|
|
|
-// }
|
|
|
|
-// if(xv2xStReqMsg.v2xstreq())
|
|
|
|
-// {
|
|
|
|
-// gAV->UpdateV2xStEn(gAV->mv2xStEn);
|
|
|
|
-// gIvlog->info("hmi", "v2x enable request %d",gAV->mv2xStEn);
|
|
|
|
-// }
|
|
|
|
|
|
+ iv::v2r::v2r_send xv2rSendMsg;
|
|
|
|
+ if(!xv2rSendMsg.ParseFromArray(strdata,nSize))
|
|
|
|
+ {
|
|
|
|
+ gIvlog->error("hmi", "iv::v2r::xv2rSendMsg::ListenObu parse error");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ gAV->updateV2R(xv2rSendMsg);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -226,7 +222,7 @@ ADCIntelligentVehicle::ADCIntelligentVehicle(QWidget *parent)
|
|
gAV = this;
|
|
gAV = this;
|
|
gIvlog->info("ADCIntelligentVehicle Start Initialize");
|
|
gIvlog->info("ADCIntelligentVehicle Start Initialize");
|
|
mTime.start();
|
|
mTime.start();
|
|
-/*
|
|
|
|
|
|
+ /*
|
|
QString strpath = QCoreApplication::applicationDirPath();
|
|
QString strpath = QCoreApplication::applicationDirPath();
|
|
strpath = strpath + "/ADS_decision.xml";
|
|
strpath = strpath + "/ADS_decision.xml";
|
|
iv::xmlparam::Xmlparam xp(strpath.toStdString());
|
|
iv::xmlparam::Xmlparam xp(strpath.toStdString());
|
|
@@ -253,15 +249,15 @@ ADCIntelligentVehicle::ADCIntelligentVehicle(QWidget *parent)
|
|
ui->listWidget->setIconSize(QSize(40,40));
|
|
ui->listWidget->setIconSize(QSize(40,40));
|
|
ui->stackedWidget->setCurrentIndex(0);
|
|
ui->stackedWidget->setCurrentIndex(0);
|
|
|
|
|
|
- // QObject::connect(ui->listWidget,SIGNAL(currentRowChanged(int)),ui->stackedWidget,SLOT(on_listWidget_clicked()));//信号与槽
|
|
|
|
|
|
+ // QObject::connect(ui->listWidget,SIGNAL(currentRowChanged(int)),ui->stackedWidget,SLOT(on_listWidget_clicked()));//信号与槽
|
|
QObject::connect(ui->listWidget,SIGNAL(currentRowChanged(int)),this,SLOT(on_listWidget_clicked()));//信号与槽
|
|
QObject::connect(ui->listWidget,SIGNAL(currentRowChanged(int)),this,SLOT(on_listWidget_clicked()));//信号与槽
|
|
|
|
|
|
-// /********************************** 百度地图显示 ********************************/
|
|
|
|
-// mMapview = new QWebEngineView(ui->stackedWidget->widget(0));
|
|
|
|
-//// qDebug((QDir::currentPath()).toLatin1().data());
|
|
|
|
-// mMapview->load(QUrl(QString("file:///%1/%2").arg(QApplication::applicationDirPath()).arg("BaiDuMap.html")));
|
|
|
|
-// mMapview->setGeometry(750,250,400,400);
|
|
|
|
-// /********************************************************************************/
|
|
|
|
|
|
+ // /********************************** 百度地图显示 ********************************/
|
|
|
|
+ // mMapview = new QWebEngineView(ui->stackedWidget->widget(0));
|
|
|
|
+ //// qDebug((QDir::currentPath()).toLatin1().data());
|
|
|
|
+ // mMapview->load(QUrl(QString("file:///%1/%2").arg(QApplication::applicationDirPath()).arg("BaiDuMap.html")));
|
|
|
|
+ // mMapview->setGeometry(750,250,400,400);
|
|
|
|
+ // /********************************************************************************/
|
|
|
|
|
|
ui->listWidget->setCurrentRow(1); //apollo_fu debug 20200409
|
|
ui->listWidget->setCurrentRow(1); //apollo_fu debug 20200409
|
|
|
|
|
|
@@ -275,7 +271,7 @@ ADCIntelligentVehicle::ADCIntelligentVehicle(QWidget *parent)
|
|
myview_small->setGeometry(QRect(1000,100,500,500));
|
|
myview_small->setGeometry(QRect(1000,100,500,500));
|
|
myview_small->setAlignment(Qt::AlignLeft | Qt::AlignTop);
|
|
myview_small->setAlignment(Qt::AlignLeft | Qt::AlignTop);
|
|
#endif
|
|
#endif
|
|
-// myview_small->scale(0.7,0.7);
|
|
|
|
|
|
+ // myview_small->scale(0.7,0.7);
|
|
//myview_small->centerOn(-200,-200);
|
|
//myview_small->centerOn(-200,-200);
|
|
|
|
|
|
image = new QImage(900 * 2, 900 * 2, QImage::Format_RGB32);//画布的初始化大小设为600*500,使用32位颜色
|
|
image = new QImage(900 * 2, 900 * 2, QImage::Format_RGB32);//画布的初始化大小设为600*500,使用32位颜色
|
|
@@ -357,13 +353,11 @@ ADCIntelligentVehicle::ADCIntelligentVehicle(QWidget *parent)
|
|
gIvlog->debug("canState ptr: %x",mpacanstate);
|
|
gIvlog->debug("canState ptr: %x",mpacanstate);
|
|
|
|
|
|
ModuleFun funbrainstate =std::bind(&ADCIntelligentVehicle::UpdateVehicleState,this,std::placeholders::_1,std::placeholders::_2,std::placeholders::_3,std::placeholders::_4,std::placeholders::_5);
|
|
ModuleFun funbrainstate =std::bind(&ADCIntelligentVehicle::UpdateVehicleState,this,std::placeholders::_1,std::placeholders::_2,std::placeholders::_3,std::placeholders::_4,std::placeholders::_5);
|
|
- // mpaVechicleState = iv::modulecomm::RegisterRecvPlus("vehiclestate",funbrainstate);
|
|
|
|
|
|
+ // mpaVechicleState = iv::modulecomm::RegisterRecvPlus("vehiclestate",funbrainstate);
|
|
mpaVechicleState = iv::modulecomm::RegisterRecvPlus("brainstate",funbrainstate);
|
|
mpaVechicleState = iv::modulecomm::RegisterRecvPlus("brainstate",funbrainstate);
|
|
|
|
|
|
ModuleFun fundecition =std::bind(&ADCIntelligentVehicle::UpdateDecition,this,std::placeholders::_1,std::placeholders::_2,std::placeholders::_3,std::placeholders::_4,std::placeholders::_5);
|
|
ModuleFun fundecition =std::bind(&ADCIntelligentVehicle::UpdateDecition,this,std::placeholders::_1,std::placeholders::_2,std::placeholders::_3,std::placeholders::_4,std::placeholders::_5);
|
|
-
|
|
|
|
-// mpaDecition = iv::modulecomm::RegisterRecvPlus("decition",fundecition);
|
|
|
|
- mpaDecition = iv::modulecomm::RegisterRecvPlus("deciton",fundecition);
|
|
|
|
|
|
+ mpaDecition = iv::modulecomm::RegisterRecvPlus("deciton",fundecition);
|
|
mpaLidar = iv::modulecomm::RegisterRecv("lidar_obs",ListenOBS);
|
|
mpaLidar = iv::modulecomm::RegisterRecv("lidar_obs",ListenOBS);
|
|
mpaObu = iv::modulecomm::RegisterRecv("obu",ListenObu);
|
|
mpaObu = iv::modulecomm::RegisterRecv("obu",ListenObu);
|
|
mpaHMI = iv::modulecomm::RegisterSend("hmi",10*sizeof(iv::hmi::HMIBasic),10);
|
|
mpaHMI = iv::modulecomm::RegisterSend("hmi",10*sizeof(iv::hmi::HMIBasic),10);
|
|
@@ -379,7 +373,7 @@ ADCIntelligentVehicle::ADCIntelligentVehicle(QWidget *parent)
|
|
connect(mTimerManual,SIGNAL(timeout()),this,SLOT(onTimerManual()));
|
|
connect(mTimerManual,SIGNAL(timeout()),this,SLOT(onTimerManual()));
|
|
connect(myview,SIGNAL(CtrlManual(bool)),this,SLOT(onCtrlManual(bool)));
|
|
connect(myview,SIGNAL(CtrlManual(bool)),this,SLOT(onCtrlManual(bool)));
|
|
mnCtrlValue[0] = 0; mnCtrlValue[1] = 0; mnCtrlValue[2] = 0;
|
|
mnCtrlValue[0] = 0; mnCtrlValue[1] = 0; mnCtrlValue[2] = 0;
|
|
-// timermanualctrl->start(10);
|
|
|
|
|
|
+ // timermanualctrl->start(10);
|
|
|
|
|
|
//connect(ui->lineEdit_6, SIGNAL(textEdited(const QString &)), this, SLOT(savestabuyEditinfo(const QString &)));
|
|
//connect(ui->lineEdit_6, SIGNAL(textEdited(const QString &)), this, SLOT(savestabuyEditinfo(const QString &)));
|
|
|
|
|
|
@@ -445,7 +439,7 @@ ADCIntelligentVehicle::ADCIntelligentVehicle(QWidget *parent)
|
|
connect(&mTimerState1,SIGNAL(timeout()),this,SLOT(onStateTimerTraffic()));//广播发送UDP数据报
|
|
connect(&mTimerState1,SIGNAL(timeout()),this,SLOT(onStateTimerTraffic()));//广播发送UDP数据报
|
|
mTimerState1.start(100); //定时100ms
|
|
mTimerState1.start(100); //定时100ms
|
|
|
|
|
|
- #endif
|
|
|
|
|
|
+#endif
|
|
|
|
|
|
ui->lineEdit_vin->setText(QString::fromStdString(gstrvin));
|
|
ui->lineEdit_vin->setText(QString::fromStdString(gstrvin));
|
|
mdLon = QString::fromStdString(gstrLon).toDouble();
|
|
mdLon = QString::fromStdString(gstrLon).toDouble();
|
|
@@ -612,6 +606,42 @@ void ADCIntelligentVehicle::timeoutslot()
|
|
|
|
|
|
//}
|
|
//}
|
|
|
|
|
|
|
|
+void ADCIntelligentVehicle::updateV2R(iv::v2r::v2r_send xv2rMsg)
|
|
|
|
+{
|
|
|
|
+ if(xv2rMsg.has_radiolighttype())
|
|
|
|
+ {
|
|
|
|
+ miLightType = xv2rMsg.radiolighttype();
|
|
|
|
+ miLightRemain = xv2rMsg.radiolightremain();
|
|
|
|
+ ServiceCarStatus.st_straight = miLightType;
|
|
|
|
+ ServiceCarStatus.time_straight = miLightRemain;
|
|
|
|
+ miobuSt = 0;
|
|
|
|
+ }
|
|
|
|
+ if(xv2rMsg.has_radiobroadcastgpslat())
|
|
|
|
+ {
|
|
|
|
+ miBroadcastGpsLat = xv2rMsg.radiobroadcastgpslat();
|
|
|
|
+ miBroadcastGpsLon = xv2rMsg.radiobroadcastgpslon();
|
|
|
|
+ miBroadcastRange = xv2rMsg.radiobroadcastrange();
|
|
|
|
+ miBroadcastTrafficType = xv2rMsg.radiobroadcasttraffictype();
|
|
|
|
+ }
|
|
|
|
+ if(xv2rMsg.has_radiowarningspeedlimit())
|
|
|
|
+ {
|
|
|
|
+ miBroadcastSpeedLimit = xv2rMsg.radiobroadcastspeedlimit();
|
|
|
|
+ }
|
|
|
|
+ if(xv2rMsg.has_radiowarningtype())
|
|
|
|
+ {
|
|
|
|
+ miWarningType = xv2rMsg.radiowarningtype();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(xv2rMsg.has_radiowarningspeedlimit())
|
|
|
|
+ {
|
|
|
|
+ miWarningSpeedLimit = xv2rMsg.radiowarningspeedlimit();
|
|
|
|
+ }
|
|
|
|
+ if(xv2rMsg.has_radioidentistart())
|
|
|
|
+ {
|
|
|
|
+ miIdentiStart = xv2rMsg.radioidentistart();
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* @brief ADCIntelligentVehicle::onRecvUDP
|
|
* @brief ADCIntelligentVehicle::onRecvUDP
|
|
*/
|
|
*/
|
|
@@ -752,118 +782,100 @@ void ADCIntelligentVehicle::AutoStart()
|
|
|
|
|
|
void ADCIntelligentVehicle::onStateTimerTraffic()
|
|
void ADCIntelligentVehicle::onStateTimerTraffic()
|
|
{
|
|
{
|
|
- ui->lcdTurn->display((int)ServiceCarStatus.time_turn);
|
|
|
|
- ui->lcdLeft->display((int)ServiceCarStatus.time_left);
|
|
|
|
- ui->lcdStraight->display((int)ServiceCarStatus.time_straight);
|
|
|
|
- ui->lcdRight->display((int)ServiceCarStatus.time_right);
|
|
|
|
- switch (ServiceCarStatus.st_turn) {
|
|
|
|
- case 0:
|
|
|
|
- img.load(":/light_image/diaotou-black.png");
|
|
|
|
- img = img.scaled(66,66,Qt::IgnoreAspectRatio);
|
|
|
|
- ui->label_38->setPixmap(QPixmap::fromImage(img));
|
|
|
|
- break;
|
|
|
|
- case 1:
|
|
|
|
- img.load(":/light_image/diaotou-green.png");
|
|
|
|
- img = img.scaled(66,66,Qt::IgnoreAspectRatio);
|
|
|
|
- ui->label_38->setPixmap(QPixmap::fromImage(img));
|
|
|
|
- break;
|
|
|
|
- case 2:
|
|
|
|
- img.load(":/light_image/diaotou-red.png");
|
|
|
|
- img = img.scaled(66,66,Qt::IgnoreAspectRatio);
|
|
|
|
- ui->label_38->setPixmap(QPixmap::fromImage(img));
|
|
|
|
- break;
|
|
|
|
- case 3:
|
|
|
|
- img.load(":/light_image/diaotou-yellow.png");
|
|
|
|
- img = img.scaled(66,66,Qt::IgnoreAspectRatio);
|
|
|
|
- ui->label_38->setPixmap(QPixmap::fromImage(img));
|
|
|
|
- break;
|
|
|
|
- default:
|
|
|
|
- img.load(":/light_image/diaotou-black.png");
|
|
|
|
- img = img.scaled(66,66,Qt::IgnoreAspectRatio);
|
|
|
|
- ui->label_38->setPixmap(QPixmap::fromImage(img));
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- switch (ServiceCarStatus.st_left) {
|
|
|
|
- case 0:
|
|
|
|
- img2.load(":/light_image/zuoguai-black.png");
|
|
|
|
- img2 = img2.scaled(66,66,Qt::IgnoreAspectRatio);
|
|
|
|
- ui->label_33->setPixmap(QPixmap::fromImage(img2));
|
|
|
|
- break;
|
|
|
|
- case 1:
|
|
|
|
- img2.load(":/light_image/zuoguai-green.png");
|
|
|
|
- img2 = img2.scaled(66,66,Qt::IgnoreAspectRatio);
|
|
|
|
- ui->label_33->setPixmap(QPixmap::fromImage(img2));
|
|
|
|
- break;
|
|
|
|
- case 2:
|
|
|
|
- img2.load(":/light_image/zuoguai-red.png");
|
|
|
|
- img2 = img2.scaled(66,66,Qt::IgnoreAspectRatio);
|
|
|
|
- ui->label_33->setPixmap(QPixmap::fromImage(img2));
|
|
|
|
- break;
|
|
|
|
- case 3:
|
|
|
|
- img2.load(":/light_image/zuoguai-yellow.png");
|
|
|
|
- img2 = img2.scaled(66,66,Qt::IgnoreAspectRatio);
|
|
|
|
- ui->label_33->setPixmap(QPixmap::fromImage(img2));
|
|
|
|
- break;
|
|
|
|
- default:
|
|
|
|
- img2.load(":/light_image/zuoguai-black.png");
|
|
|
|
- img2 = img2.scaled(66,66,Qt::IgnoreAspectRatio);
|
|
|
|
- ui->label_33->setPixmap(QPixmap::fromImage(img2));
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- switch (ServiceCarStatus.st_straight) {
|
|
|
|
- case 0:
|
|
|
|
- img3.load(":/light_image/zhixing-black.png");
|
|
|
|
- img3 = img3.scaled(66,66,Qt::IgnoreAspectRatio);
|
|
|
|
- ui->label_35->setPixmap(QPixmap::fromImage(img3));
|
|
|
|
- break;
|
|
|
|
- case 1:
|
|
|
|
- img3.load(":/light_image/zhixing-green.png");
|
|
|
|
- img3 = img3.scaled(66,66,Qt::IgnoreAspectRatio);
|
|
|
|
- ui->label_35->setPixmap(QPixmap::fromImage(img3));
|
|
|
|
- break;
|
|
|
|
- case 2:
|
|
|
|
- img3.load(":/light_image/zhixing-red.png");
|
|
|
|
- img3 = img3.scaled(66,66,Qt::IgnoreAspectRatio);
|
|
|
|
- ui->label_35->setPixmap(QPixmap::fromImage(img3));
|
|
|
|
- break;
|
|
|
|
- case 3:
|
|
|
|
- img3.load(":/light_image/zhixing-yellow.png");
|
|
|
|
- img3 = img3.scaled(66,66,Qt::IgnoreAspectRatio);
|
|
|
|
- ui->label_35->setPixmap(QPixmap::fromImage(img3));
|
|
|
|
- break;
|
|
|
|
- default:
|
|
|
|
- img3.load(":/light_image/zhixing-black.png");
|
|
|
|
- img3 = img3.scaled(66,66,Qt::IgnoreAspectRatio);
|
|
|
|
- ui->label_35->setPixmap(QPixmap::fromImage(img3));
|
|
|
|
- break;
|
|
|
|
|
|
+ if(miobuSt < 10)
|
|
|
|
+ {
|
|
|
|
+ miobuSt++;
|
|
|
|
+ ui->lcdStraight->display((int)ServiceCarStatus.time_straight);
|
|
|
|
+ switch (ServiceCarStatus.st_straight) {
|
|
|
|
+ case 0:
|
|
|
|
+ img3.load(":/light_image/zhixing-black.png");
|
|
|
|
+ img3 = img3.scaled(66,66,Qt::IgnoreAspectRatio);
|
|
|
|
+ ui->label_35->setPixmap(QPixmap::fromImage(img3));
|
|
|
|
+ break;
|
|
|
|
+ case 1:
|
|
|
|
+ img3.load(":/light_image/zhixing-green.png");
|
|
|
|
+ img3 = img3.scaled(66,66,Qt::IgnoreAspectRatio);
|
|
|
|
+ ui->label_35->setPixmap(QPixmap::fromImage(img3));
|
|
|
|
+ break;
|
|
|
|
+ case 2:
|
|
|
|
+ img3.load(":/light_image/zhixing-red.png");
|
|
|
|
+ img3 = img3.scaled(66,66,Qt::IgnoreAspectRatio);
|
|
|
|
+ ui->label_35->setPixmap(QPixmap::fromImage(img3));
|
|
|
|
+ break;
|
|
|
|
+ case 3:
|
|
|
|
+ img3.load(":/light_image/zhixing-yellow.png");
|
|
|
|
+ img3 = img3.scaled(66,66,Qt::IgnoreAspectRatio);
|
|
|
|
+ ui->label_35->setPixmap(QPixmap::fromImage(img3));
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ img3.load(":/light_image/zhixing-black.png");
|
|
|
|
+ img3 = img3.scaled(66,66,Qt::IgnoreAspectRatio);
|
|
|
|
+ ui->label_35->setPixmap(QPixmap::fromImage(img3));
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- switch (ServiceCarStatus.st_right) {
|
|
|
|
- case 0:
|
|
|
|
- img4.load(":/light_image/youguai-black.png");
|
|
|
|
- img4 = img4.scaled(66,66,Qt::IgnoreAspectRatio);
|
|
|
|
- ui->label_32->setPixmap(QPixmap::fromImage(img4));
|
|
|
|
- break;
|
|
|
|
- case 1:
|
|
|
|
- img4.load(":/light_image/youguai-green.png");
|
|
|
|
- img4 = img4.scaled(66,66,Qt::IgnoreAspectRatio);
|
|
|
|
- ui->label_32->setPixmap(QPixmap::fromImage(img4));
|
|
|
|
- break;
|
|
|
|
- case 2:
|
|
|
|
- img4.load(":/light_image/youguai-red.png");
|
|
|
|
- img4 = img4.scaled(66,66,Qt::IgnoreAspectRatio);
|
|
|
|
- ui->label_32->setPixmap(QPixmap::fromImage(img4));
|
|
|
|
- break;
|
|
|
|
- case 3:
|
|
|
|
- img4.load(":/light_image/youguai-yellow.png");
|
|
|
|
- img4 = img4.scaled(66,66,Qt::IgnoreAspectRatio);
|
|
|
|
- ui->label_32->setPixmap(QPixmap::fromImage(img4));
|
|
|
|
- break;
|
|
|
|
- default:
|
|
|
|
- img4.load(":/light_image/youguai-black.png");
|
|
|
|
- img4 = img4.scaled(66,66,Qt::IgnoreAspectRatio);
|
|
|
|
- ui->label_32->setPixmap(QPixmap::fromImage(img4));
|
|
|
|
- break;
|
|
|
|
|
|
+ if(mobuEn)
|
|
|
|
+ {
|
|
|
|
+ if(mbTrafficInfoEn)
|
|
|
|
+ {
|
|
|
|
+ if(miobuSt<10)
|
|
|
|
+ {
|
|
|
|
+ ui->button_trafficInfoLight_st->setStyleSheet("background-color: green");
|
|
|
|
+ ui->lineEd_trafficInfo->setText("减速至xx km/h");
|
|
|
|
+ ui->textBr_trafficInfo->append(QTime::currentTime().toString("hh:mm:ss.zzz") + "xxxxx");
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ ui->button_trafficInfoLight_st->setStyleSheet("background-color: red");
|
|
|
|
+ ui->textBr_trafficInfo->clear();
|
|
|
|
+ ui->lineEd_trafficInfo->clear();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else if(mbFCWEn)//碰撞预警
|
|
|
|
+ {
|
|
|
|
+ if(miobuSt<10)
|
|
|
|
+ {
|
|
|
|
+ ui->textBr_FCW->append(QTime::currentTime().toString("hh:mm:ss.zzz") + "xxxxx");
|
|
|
|
+ ui->button_FWCLight_st->setStyleSheet("background-color: green");
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ ui->textBr_FCW->clear();
|
|
|
|
+ ui->button_FWCLight_st->setStyleSheet("background-color: red");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else if(mbjamsEn)//交通拥堵
|
|
|
|
+ {
|
|
|
|
+ if(miobuSt<10)
|
|
|
|
+ {
|
|
|
|
+ ui->button_jamsLight_st->setStyleSheet("background-color: green");
|
|
|
|
+ ui->lineEdit_jamsMode->setText("xxx");
|
|
|
|
+ ui->lineEdit_jamsVIN->setText(QString::fromStdString(gstrvin));
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ ui->button_jamsLight_st->setStyleSheet("background-color: red");
|
|
|
|
+ ui->lineEdit_jamsMode->clear();
|
|
|
|
+ ui->lineEdit_jamsVIN->clear();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else if(mbdriCrimsEn)//危险驾驶
|
|
|
|
+ {
|
|
|
|
+ if(miobuSt<10)
|
|
|
|
+ {
|
|
|
|
+ ui->button_DriCrimsLight_st->setStyleSheet("background-color: green");
|
|
|
|
+ ui->textBr_FCW_2->append(QTime::currentTime().toString("hh:mm:ss.zzz")+"进入危险驾驶模式");
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ ui->button_DriCrimsLight_st->setStyleSheet("background-color: red");
|
|
|
|
+ ui->textBr_FCW_2->clear();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -967,11 +979,11 @@ void ADCIntelligentVehicle::paintEvent(QPaintEvent *)
|
|
mnTimeLastUpdatePaint = mTime.elapsed();
|
|
mnTimeLastUpdatePaint = mTime.elapsed();
|
|
// qDebug("enter paint. time is %d",mTime.elapsed());
|
|
// qDebug("enter paint. time is %d",mTime.elapsed());
|
|
painter->begin(image);
|
|
painter->begin(image);
|
|
-// painter_small->begin(image_small);
|
|
|
|
|
|
+ // painter_small->begin(image_small);
|
|
|
|
|
|
- // image->fill(QColor(60, 60, 60));//对画布进行填充
|
|
|
|
- image->fill(QColor(220, 220, 220));//对画布进行填充
|
|
|
|
- image_small->fill(QColor(220,220,220));
|
|
|
|
|
|
+ // image->fill(QColor(60, 60, 60));//对画布进行填充
|
|
|
|
+ image->fill(QColor(220, 220, 220));//对画布进行填充
|
|
|
|
+ image_small->fill(QColor(220,220,220));
|
|
std::vector<iv::GPSData> navigation_data;
|
|
std::vector<iv::GPSData> navigation_data;
|
|
mMutexNavi.lock();
|
|
mMutexNavi.lock();
|
|
navigation_data = m_navigation_data;
|
|
navigation_data = m_navigation_data;
|
|
@@ -989,7 +1001,7 @@ void ADCIntelligentVehicle::paintEvent(QPaintEvent *)
|
|
mMutexPlan_right.lock();
|
|
mMutexPlan_right.lock();
|
|
myplan_right = m_plan_right;
|
|
myplan_right = m_plan_right;
|
|
mMutexPlan_right.unlock();
|
|
mMutexPlan_right.unlock();
|
|
-// std::cout<<"plan size is "<<myplan.size()<<std::endl;
|
|
|
|
|
|
+ // std::cout<<"plan size is "<<myplan.size()<<std::endl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -999,27 +1011,27 @@ void ADCIntelligentVehicle::paintEvent(QPaintEvent *)
|
|
|
|
|
|
|
|
|
|
int pointx = 450, pointy = 700;//确定坐标轴起点坐标,这里定义(35,280)
|
|
int pointx = 450, pointy = 700;//确定坐标轴起点坐标,这里定义(35,280)
|
|
-// int pointx_small = 450, pointy_small = 700;
|
|
|
|
|
|
+ // int pointx_small = 450, pointy_small = 700;
|
|
// double x0[22000], y0[22000], lng[22000], x1[22000], y1[22000], x2[22000], y2[22000];
|
|
// double x0[22000], y0[22000], lng[22000], x1[22000], y1[22000], x2[22000], y2[22000];
|
|
|
|
|
|
- double * x0, * y0, * lng, * x1, * y1, * x2, * y2;
|
|
|
|
- std::shared_ptr<double> ptrx0,ptry0,ptrlng,ptrx1,ptry1,ptrx2,ptry2;
|
|
|
|
- int nmapsize = navigation_data.size();
|
|
|
|
- x0 = new double[nmapsize];
|
|
|
|
- y0 = new double[nmapsize];
|
|
|
|
- lng = new double[nmapsize];
|
|
|
|
- x1 = new double[nmapsize];
|
|
|
|
- y1 = new double[nmapsize];
|
|
|
|
- x2 = new double[nmapsize];
|
|
|
|
- y2 = new double[nmapsize];
|
|
|
|
-
|
|
|
|
- ptrx0.reset(x0);
|
|
|
|
- ptry0.reset(y0);
|
|
|
|
- ptrlng.reset(lng);
|
|
|
|
- ptrx1.reset(x1);
|
|
|
|
- ptry1.reset(y1);
|
|
|
|
- ptrx2.reset(x2);
|
|
|
|
- ptry2.reset(y2);
|
|
|
|
|
|
+ double * x0, * y0, * lng, * x1, * y1, * x2, * y2;
|
|
|
|
+ std::shared_ptr<double> ptrx0,ptry0,ptrlng,ptrx1,ptry1,ptrx2,ptry2;
|
|
|
|
+ int nmapsize = navigation_data.size();
|
|
|
|
+ x0 = new double[nmapsize];
|
|
|
|
+ y0 = new double[nmapsize];
|
|
|
|
+ lng = new double[nmapsize];
|
|
|
|
+ x1 = new double[nmapsize];
|
|
|
|
+ y1 = new double[nmapsize];
|
|
|
|
+ x2 = new double[nmapsize];
|
|
|
|
+ y2 = new double[nmapsize];
|
|
|
|
+
|
|
|
|
+ ptrx0.reset(x0);
|
|
|
|
+ ptry0.reset(y0);
|
|
|
|
+ ptrlng.reset(lng);
|
|
|
|
+ ptrx1.reset(x1);
|
|
|
|
+ ptry1.reset(y1);
|
|
|
|
+ ptrx2.reset(x2);
|
|
|
|
+ ptry2.reset(y2);
|
|
double xx = 0, yy = 0;
|
|
double xx = 0, yy = 0;
|
|
double sumx = 0, sumy = 0;//, ave_x = 0, ave_y = 0;
|
|
double sumx = 0, sumy = 0;//, ave_x = 0, ave_y = 0;
|
|
int sizeN = navigation_data.size();
|
|
int sizeN = navigation_data.size();
|
|
@@ -1032,19 +1044,19 @@ void ADCIntelligentVehicle::paintEvent(QPaintEvent *)
|
|
//先绘制车位置点及框图
|
|
//先绘制车位置点及框图
|
|
static const QPointF points1[2] = { QPointF(300, 700), QPointF(600, 700) };
|
|
static const QPointF points1[2] = { QPointF(300, 700), QPointF(600, 700) };
|
|
static const QPointF points2[2] = { QPointF(450, 0), QPointF(450, 900) };
|
|
static const QPointF points2[2] = { QPointF(450, 0), QPointF(450, 900) };
|
|
-// static const QPointF points1_small[2] = { QPointF(300, 700), QPointF(600, 700) };
|
|
|
|
-// static const QPointF points2_small[2] = { QPointF(450, 0), QPointF(450, 900) };
|
|
|
|
|
|
+ // static const QPointF points1_small[2] = { QPointF(300, 700), QPointF(600, 700) };
|
|
|
|
+ // static const QPointF points2_small[2] = { QPointF(450, 0), QPointF(450, 900) };
|
|
|
|
|
|
penPoint.setColor(Qt::red);
|
|
penPoint.setColor(Qt::red);
|
|
penPoint.setWidth(2);
|
|
penPoint.setWidth(2);
|
|
painter->setPen(penPoint);
|
|
painter->setPen(penPoint);
|
|
-// painter_small->setPen(penPoint);
|
|
|
|
|
|
+ // painter_small->setPen(penPoint);
|
|
painter->drawPoint(pointx, pointy);
|
|
painter->drawPoint(pointx, pointy);
|
|
-// painter_small->drawPoint(pointx_small,pointy_small);
|
|
|
|
|
|
+ // painter_small->drawPoint(pointx_small,pointy_small);
|
|
painter->drawPolyline(points1, 2);
|
|
painter->drawPolyline(points1, 2);
|
|
painter->drawPolyline(points2, 2);
|
|
painter->drawPolyline(points2, 2);
|
|
-// painter_small->drawPolyline(points1_small, 2);
|
|
|
|
-// painter_small->drawPolyline(points2_small, 2);
|
|
|
|
|
|
+ // painter_small->drawPolyline(points1_small, 2);
|
|
|
|
+ // painter_small->drawPolyline(points2_small, 2);
|
|
|
|
|
|
//路径点的预处理
|
|
//路径点的预处理
|
|
for (int i = 0; i < sizeN; i++)
|
|
for (int i = 0; i < sizeN; i++)
|
|
@@ -1079,7 +1091,7 @@ void ADCIntelligentVehicle::paintEvent(QPaintEvent *)
|
|
if (ServiceCarStatus.location->gps_x == 0)
|
|
if (ServiceCarStatus.location->gps_x == 0)
|
|
{
|
|
{
|
|
painter->drawText(rect(), Qt::AlignLeft, QString::fromLocal8Bit("等待车辆实时GPS位置信息"));
|
|
painter->drawText(rect(), Qt::AlignLeft, QString::fromLocal8Bit("等待车辆实时GPS位置信息"));
|
|
-// painter_small->drawText(rect(), Qt::AlignLeft, QString::fromLocal8Bit("等待车辆实时GPS位置信息"));
|
|
|
|
|
|
+ // painter_small->drawText(rect(), Qt::AlignLeft, QString::fromLocal8Bit("等待车辆实时GPS位置信息"));
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
@@ -1100,21 +1112,21 @@ void ADCIntelligentVehicle::paintEvent(QPaintEvent *)
|
|
y0[i] = xx * sin(lng[0] * PI / 180) + yy * cos(lng[0] * PI / 180);
|
|
y0[i] = xx * sin(lng[0] * PI / 180) + yy * cos(lng[0] * PI / 180);
|
|
k1 = sin((90 + (lng[i] - lng[0])) * PI / 180);
|
|
k1 = sin((90 + (lng[i] - lng[0])) * PI / 180);
|
|
k2 = cos((90 + (lng[i] - lng[0])) * PI / 180);
|
|
k2 = cos((90 + (lng[i] - lng[0])) * PI / 180);
|
|
- #if 0
|
|
|
|
|
|
+#if 0
|
|
x1[i] = x0[i] + k1 * 5;
|
|
x1[i] = x0[i] + k1 * 5;
|
|
y1[i] = y0[i] + k2 * 5;
|
|
y1[i] = y0[i] + k2 * 5;
|
|
x2[i] = x0[i] - k1 * 5;
|
|
x2[i] = x0[i] - k1 * 5;
|
|
y2[i] = y0[i] - k2 * 5;
|
|
y2[i] = y0[i] - k2 * 5;
|
|
- #else
|
|
|
|
|
|
+#else
|
|
x1[i] = x0[i] + k1 * 1.75;
|
|
x1[i] = x0[i] + k1 * 1.75;
|
|
y1[i] = y0[i] + k2 * 1.75;
|
|
y1[i] = y0[i] + k2 * 1.75;
|
|
x2[i] = x0[i] - k1 * 1.75;
|
|
x2[i] = x0[i] - k1 * 1.75;
|
|
y2[i] = y0[i] - k2 * 1.75;
|
|
y2[i] = y0[i] - k2 * 1.75;
|
|
- #endif
|
|
|
|
|
|
+#endif
|
|
}
|
|
}
|
|
|
|
|
|
-// double kx_small = (double)(1200) / (abs(y_max - y_min));//x轴的系数
|
|
|
|
-// double ky_small = (double)(1200) / (abs(y_max - y_min));//y方向的比例系数
|
|
|
|
|
|
+ // double kx_small = (double)(1200) / (abs(y_max - y_min));//x轴的系数
|
|
|
|
+ // double ky_small = (double)(1200) / (abs(y_max - y_min));//y方向的比例系数
|
|
|
|
|
|
double kx = 10;
|
|
double kx = 10;
|
|
double ky = 10;
|
|
double ky = 10;
|
|
@@ -1130,22 +1142,22 @@ void ADCIntelligentVehicle::paintEvent(QPaintEvent *)
|
|
for (int i = 1; i < sizeN - 1; i++)
|
|
for (int i = 1; i < sizeN - 1; i++)
|
|
{
|
|
{
|
|
painter->setPen(penPoint);//蓝色的笔,用于标记各个点
|
|
painter->setPen(penPoint);//蓝色的笔,用于标记各个点
|
|
-// painter_small->setPen(penPoint);//蓝色的笔,用于标记各个点
|
|
|
|
|
|
+ // painter_small->setPen(penPoint);//蓝色的笔,用于标记各个点
|
|
painter->drawPoint(pointx + x0[i] * kx, pointy - y0[i] * ky);
|
|
painter->drawPoint(pointx + x0[i] * kx, pointy - y0[i] * ky);
|
|
-// painter_small->drawPoint(pointx_small + x0[i] * kx_small, pointy_small - y0[i] * ky_small);
|
|
|
|
|
|
+ // painter_small->drawPoint(pointx_small + x0[i] * kx_small, pointy_small - y0[i] * ky_small);
|
|
painter->drawPoint(pointx + x1[i] * kx, pointy - y1[i] * ky);
|
|
painter->drawPoint(pointx + x1[i] * kx, pointy - y1[i] * ky);
|
|
-// painter_small->drawPoint(pointx_small + x1[i] * kx_small, pointy_small - y1[i] * ky_small);
|
|
|
|
|
|
+ // painter_small->drawPoint(pointx_small + x1[i] * kx_small, pointy_small - y1[i] * ky_small);
|
|
painter->drawPoint(pointx + x2[i] * kx, pointy - y2[i] * ky);
|
|
painter->drawPoint(pointx + x2[i] * kx, pointy - y2[i] * ky);
|
|
-// painter_small->drawPoint(pointx_small + x2[i] * kx_small, pointy_small - y2[i] * ky_small);
|
|
|
|
|
|
+ // painter_small->drawPoint(pointx_small + x2[i] * kx_small, pointy_small - y2[i] * ky_small);
|
|
}
|
|
}
|
|
painter->drawPoint(pointx + x0[sizeN - 1] * kx, pointy - y0[sizeN - 1] * ky);//绘制最后一个点
|
|
painter->drawPoint(pointx + x0[sizeN - 1] * kx, pointy - y0[sizeN - 1] * ky);//绘制最后一个点
|
|
-// painter_small->drawPoint(pointx_small + x0[sizeN - 1] * kx_small, pointy_small - y0[sizeN - 1] * ky_small);//绘制最后一个点
|
|
|
|
|
|
+ // painter_small->drawPoint(pointx_small + x0[sizeN - 1] * kx_small, pointy_small - y0[sizeN - 1] * ky_small);//绘制最后一个点
|
|
|
|
|
|
penPoint.setColor(Qt::red);
|
|
penPoint.setColor(Qt::red);
|
|
penPoint.setWidth(2);
|
|
penPoint.setWidth(2);
|
|
|
|
|
|
painter->drawPoint(pointx + x0[0] * kx, pointy - y0[0] * ky);
|
|
painter->drawPoint(pointx + x0[0] * kx, pointy - y0[0] * ky);
|
|
-// painter_small->drawPoint(pointx_small + x0[0] * kx_small, pointy_small - y0[0] * ky_small);
|
|
|
|
|
|
+ // painter_small->drawPoint(pointx_small + x0[0] * kx_small, pointy_small - y0[0] * ky_small);
|
|
|
|
|
|
#if 1
|
|
#if 1
|
|
// draw plan trace
|
|
// draw plan trace
|
|
@@ -1165,7 +1177,7 @@ void ADCIntelligentVehicle::paintEvent(QPaintEvent *)
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
#if 1
|
|
#if 1
|
|
-// penPoint.setColor(Qt::gray);
|
|
|
|
|
|
+ // penPoint.setColor(Qt::gray);
|
|
penPoint.setColor(QColor(187, 255, 255, 100));
|
|
penPoint.setColor(QColor(187, 255, 255, 100));
|
|
penPoint.setWidth(2);
|
|
penPoint.setWidth(2);
|
|
painter->setPen(penPoint);
|
|
painter->setPen(penPoint);
|
|
@@ -1181,9 +1193,9 @@ void ADCIntelligentVehicle::paintEvent(QPaintEvent *)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-// penPoint.setColor(Qt::gray);
|
|
|
|
-// penPoint.setWidth(2);
|
|
|
|
-// painter->setPen(penPoint);
|
|
|
|
|
|
+ // penPoint.setColor(Qt::gray);
|
|
|
|
+ // penPoint.setWidth(2);
|
|
|
|
+ // painter->setPen(penPoint);
|
|
QPointF tracePoints_right[myplan_right.size()];
|
|
QPointF tracePoints_right[myplan_right.size()];
|
|
if(myplan_right.size()>2)
|
|
if(myplan_right.size()>2)
|
|
{
|
|
{
|
|
@@ -1196,15 +1208,15 @@ void ADCIntelligentVehicle::paintEvent(QPaintEvent *)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
- // painter->drawPolyline(tracePoints,myplan.size());
|
|
|
|
|
|
+ // painter->drawPolyline(tracePoints,myplan.size());
|
|
// draw plan trace end
|
|
// draw plan trace end
|
|
-/////////////////////////////////////apollo add car icon 20200409
|
|
|
|
|
|
+ /////////////////////////////////////apollo add car icon 20200409
|
|
QPixmap pix;
|
|
QPixmap pix;
|
|
//pix.load("car.png");
|
|
//pix.load("car.png");
|
|
pix.load(":/ADCIntelligentVehicle/car1.png");
|
|
pix.load(":/ADCIntelligentVehicle/car1.png");
|
|
painter->drawPixmap(435,667,30,67,pix);
|
|
painter->drawPixmap(435,667,30,67,pix);
|
|
-// painter_small->drawPixmap(442,683,16,34,pix);
|
|
|
|
-///////////////////////////////////////////////////////////////////
|
|
|
|
|
|
+ // painter_small->drawPixmap(442,683,16,34,pix);
|
|
|
|
+ ///////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
penPoint.setColor(Qt::blue);
|
|
penPoint.setColor(Qt::blue);
|
|
@@ -1263,21 +1275,21 @@ void ADCIntelligentVehicle::paintEvent(QPaintEvent *)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
painter->end();
|
|
painter->end();
|
|
-// painter_small->end();
|
|
|
|
|
|
+ // painter_small->end();
|
|
scene->clear();
|
|
scene->clear();
|
|
-// scene_small->clear();
|
|
|
|
|
|
+ // scene_small->clear();
|
|
scene->addPixmap(QPixmap::fromImage(*image));
|
|
scene->addPixmap(QPixmap::fromImage(*image));
|
|
-// scene_small->addPixmap(QPixmap::fromImage(*image_small));
|
|
|
|
|
|
+ // scene_small->addPixmap(QPixmap::fromImage(*image_small));
|
|
myview->setScene(scene);
|
|
myview->setScene(scene);
|
|
-// myview_small->setScene(scene_small);
|
|
|
|
|
|
+ // myview_small->setScene(scene_small);
|
|
myview->show();
|
|
myview->show();
|
|
-// myview_small->show();
|
|
|
|
|
|
+ // myview_small->show();
|
|
navigation_data.clear();
|
|
navigation_data.clear();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1340,7 +1352,7 @@ void ADCIntelligentVehicle::UpdatePlanTrace_left(const char * strdata,const unsi
|
|
int nplansize = nSize/sizeof(iv::Point2D);
|
|
int nplansize = nSize/sizeof(iv::Point2D);
|
|
if(nplansize < 1)
|
|
if(nplansize < 1)
|
|
std::cout<<"UpdatePlanTrace_left size is 0................. "<<std::endl;
|
|
std::cout<<"UpdatePlanTrace_left size is 0................. "<<std::endl;
|
|
-// return;
|
|
|
|
|
|
+ // return;
|
|
int npsize = sizeof(iv::Point2D);
|
|
int npsize = sizeof(iv::Point2D);
|
|
int i;
|
|
int i;
|
|
for(i=0;i<nplansize;i++)
|
|
for(i=0;i<nplansize;i++)
|
|
@@ -1525,7 +1537,7 @@ void GaussProjCal(double longitude, double latitude, double *X, double *Y)
|
|
iPI = 0.0174532925199433; ////3.1415926535898/180.0;
|
|
iPI = 0.0174532925199433; ////3.1415926535898/180.0;
|
|
ZoneWide = 6; ////6度带宽
|
|
ZoneWide = 6; ////6度带宽
|
|
a = 6378245.0; f = 1.0 / 298.3; //54年北京坐标系参数
|
|
a = 6378245.0; f = 1.0 / 298.3; //54年北京坐标系参数
|
|
- ////a=6378140.0; f=1/298.257; //80年西安坐标系参数
|
|
|
|
|
|
+ ////a=6378140.0; f=1/298.257; //80年西安坐标系参数
|
|
ProjNo = (int)(longitude / ZoneWide);
|
|
ProjNo = (int)(longitude / ZoneWide);
|
|
longitude0 = ProjNo * ZoneWide + ZoneWide / 2;
|
|
longitude0 = ProjNo * ZoneWide + ZoneWide / 2;
|
|
longitude0 = longitude0 * iPI;
|
|
longitude0 = longitude0 * iPI;
|
|
@@ -1539,11 +1551,11 @@ void GaussProjCal(double longitude, double latitude, double *X, double *Y)
|
|
C = ee * cos(latitude1)*cos(latitude1);
|
|
C = ee * cos(latitude1)*cos(latitude1);
|
|
A = (longitude1 - longitude0)*cos(latitude1);
|
|
A = (longitude1 - longitude0)*cos(latitude1);
|
|
M = a * ((1 - e2 / 4 - 3 * e2*e2 / 64 - 5 * e2*e2*e2 / 256)*latitude1 - (3 * e2 / 8 + 3 * e2*e2 / 32 + 45 * e2*e2
|
|
M = a * ((1 - e2 / 4 - 3 * e2*e2 / 64 - 5 * e2*e2*e2 / 256)*latitude1 - (3 * e2 / 8 + 3 * e2*e2 / 32 + 45 * e2*e2
|
|
- *e2 / 1024)*sin(2 * latitude1)
|
|
|
|
- + (15 * e2*e2 / 256 + 45 * e2*e2*e2 / 1024)*sin(4 * latitude1) - (35 * e2*e2*e2 / 3072)*sin(6 * latitude1));
|
|
|
|
|
|
+ *e2 / 1024)*sin(2 * latitude1)
|
|
|
|
+ + (15 * e2*e2 / 256 + 45 * e2*e2*e2 / 1024)*sin(4 * latitude1) - (35 * e2*e2*e2 / 3072)*sin(6 * latitude1));
|
|
xval = NN * (A + (1 - T + C)*A*A*A / 6 + (5 - 18 * T + T * T + 72 * C - 58 * ee)*A*A*A*A*A / 120);
|
|
xval = NN * (A + (1 - T + C)*A*A*A / 6 + (5 - 18 * T + T * T + 72 * C - 58 * ee)*A*A*A*A*A / 120);
|
|
yval = M + NN * tan(latitude1)*(A*A / 2 + (5 - T + 9 * C + 4 * C*C)*A*A*A*A / 24
|
|
yval = M + NN * tan(latitude1)*(A*A / 2 + (5 - T + 9 * C + 4 * C*C)*A*A*A*A / 24
|
|
- + (61 - 58 * T + T * T + 600 * C - 330 * ee)*A*A*A*A*A*A / 720);
|
|
|
|
|
|
+ + (61 - 58 * T + T * T + 600 * C - 330 * ee)*A*A*A*A*A*A / 720);
|
|
X0 = 1000000L * (ProjNo + 1) + 500000L;
|
|
X0 = 1000000L * (ProjNo + 1) + 500000L;
|
|
Y0 = 0;
|
|
Y0 = 0;
|
|
xval = xval + X0; yval = yval + Y0;
|
|
xval = xval + X0; yval = yval + Y0;
|
|
@@ -1667,7 +1679,7 @@ void ADCIntelligentVehicle::UpdateRADAR(const char * strdata,const unsigned int
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- // gIvlog->verbose("radar time is %ld",QDateTime::currentMSecsSinceEpoch());
|
|
|
|
|
|
+ // gIvlog->verbose("radar time is %ld",QDateTime::currentMSecsSinceEpoch());
|
|
|
|
|
|
if((QDateTime::currentMSecsSinceEpoch() - oldrecvtime)>100)
|
|
if((QDateTime::currentMSecsSinceEpoch() - oldrecvtime)>100)
|
|
{
|
|
{
|
|
@@ -1687,7 +1699,7 @@ void ADCIntelligentVehicle::UpdateRADAR(const char * strdata,const unsigned int
|
|
// memcpy(&x,pdata + i*sizeof(iv::ObstacleBasic),sizeof(iv::ObstacleBasic));
|
|
// memcpy(&x,pdata + i*sizeof(iv::ObstacleBasic),sizeof(iv::ObstacleBasic));
|
|
// ServiceCarStatus.obs_radar[i] = x;
|
|
// ServiceCarStatus.obs_radar[i] = x;
|
|
// }
|
|
// }
|
|
- ServiceCarStatus.mRadarS = 10;
|
|
|
|
|
|
+ ServiceCarStatus.mRadarS = 10;
|
|
// mnTimeUpdateRadar = mTimeState.elapsed();
|
|
// mnTimeUpdateRadar = mTimeState.elapsed();
|
|
// mnTimeUpdateCANState = mTimeState.elapsed();
|
|
// mnTimeUpdateCANState = mTimeState.elapsed();
|
|
}
|
|
}
|
|
@@ -1706,36 +1718,36 @@ void ADCIntelligentVehicle::UpdateCANState(const char *pdata, const int ndatasiz
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
-// if(ndatasize<sizeof(iv::can_state))return;
|
|
|
|
-// char ccanstate[ndatasize];
|
|
|
|
|
|
+ // if(ndatasize<sizeof(iv::can_state))return;
|
|
|
|
+ // char ccanstate[ndatasize];
|
|
|
|
|
|
-// memcpy(ccanstate,pdata,4);
|
|
|
|
|
|
+ // memcpy(ccanstate,pdata,4);
|
|
#if 1
|
|
#if 1
|
|
if(recCanstate.b_canstate())
|
|
if(recCanstate.b_canstate())
|
|
- {
|
|
|
|
-// gIvlog->debug("UpdateCANState<success>");
|
|
|
|
|
|
+ {
|
|
|
|
+ // gIvlog->debug("UpdateCANState<success>");
|
|
mDataToUI.mInfo.is_initSuccess = 1;
|
|
mDataToUI.mInfo.is_initSuccess = 1;
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
-// gIvlog->debug("UpdateCANState<failed>size %d %s ");
|
|
|
|
|
|
+ // gIvlog->debug("UpdateCANState<failed>size %d %s ");
|
|
mDataToUI.mInfo.is_initSuccess = 0;
|
|
mDataToUI.mInfo.is_initSuccess = 0;
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-// iv::can_state x;
|
|
|
|
-// memcpy(&x,pdata,sizeof(iv::can_state));
|
|
|
|
|
|
+ // iv::can_state x;
|
|
|
|
+ // memcpy(&x,pdata,sizeof(iv::can_state));
|
|
|
|
|
|
-// if(x.mbCANOpen)
|
|
|
|
-// {
|
|
|
|
-// mDataToUI.mInfo.is_initSuccess = 1;
|
|
|
|
-// }
|
|
|
|
-// else
|
|
|
|
-// {
|
|
|
|
-// mDataToUI.mInfo.is_initSuccess = 0;
|
|
|
|
-// }
|
|
|
|
|
|
+ // if(x.mbCANOpen)
|
|
|
|
+ // {
|
|
|
|
+ // mDataToUI.mInfo.is_initSuccess = 1;
|
|
|
|
+ // }
|
|
|
|
+ // else
|
|
|
|
+ // {
|
|
|
|
+ // mDataToUI.mInfo.is_initSuccess = 0;
|
|
|
|
+ // }
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1928,7 +1940,7 @@ void ADCIntelligentVehicle::UpdateChassis(const char *strdata, const unsigned in
|
|
|
|
|
|
void ADCIntelligentVehicle::onTimerManual()
|
|
void ADCIntelligentVehicle::onTimerManual()
|
|
{
|
|
{
|
|
-// if(myview->mPressKeys.count() == 0)return;
|
|
|
|
|
|
+ // if(myview->mPressKeys.count() == 0)return;
|
|
|
|
|
|
if(mbManual == false)
|
|
if(mbManual == false)
|
|
{
|
|
{
|
|
@@ -2032,6 +2044,8 @@ void ADCIntelligentVehicle::UpdateVbox(const char * strdata,const unsigned int n
|
|
ServiceCarStatus.time_turn = xvbox.time_turn();
|
|
ServiceCarStatus.time_turn = xvbox.time_turn();
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
void ADCIntelligentVehicle::on_button_start_clicked()
|
|
void ADCIntelligentVehicle::on_button_start_clicked()
|
|
@@ -2057,7 +2071,7 @@ void ADCIntelligentVehicle::on_button_platform_en_clicked()
|
|
mplatformEn = 1;
|
|
mplatformEn = 1;
|
|
}
|
|
}
|
|
gIvlog->info("hmi","platform enable:%d", mplatformEn);
|
|
gIvlog->info("hmi","platform enable:%d", mplatformEn);
|
|
-// UpdateV2xStEn(mv2xStEn);
|
|
|
|
|
|
+ // UpdateV2xStEn(mv2xStEn);
|
|
iv::hmi::hmimsg hmi;
|
|
iv::hmi::hmimsg hmi;
|
|
hmi.set_platformen(mplatformEn);
|
|
hmi.set_platformen(mplatformEn);
|
|
ShareHMIMsgPro(hmi);
|
|
ShareHMIMsgPro(hmi);
|
|
@@ -2074,7 +2088,7 @@ void ADCIntelligentVehicle::on_button_obu_en_clicked()
|
|
mobuEn = 1;
|
|
mobuEn = 1;
|
|
}
|
|
}
|
|
gIvlog->info("hmi","platform enable:%d", mobuEn);
|
|
gIvlog->info("hmi","platform enable:%d", mobuEn);
|
|
-// UpdateV2xStEn(mv2xStEn);
|
|
|
|
|
|
+ // UpdateV2xStEn(mv2xStEn);
|
|
iv::hmi::hmimsg hmi;
|
|
iv::hmi::hmimsg hmi;
|
|
hmi.set_obuen(mobuEn);
|
|
hmi.set_obuen(mobuEn);
|
|
ShareHMIMsgPro(hmi);
|
|
ShareHMIMsgPro(hmi);
|
|
@@ -2082,33 +2096,33 @@ void ADCIntelligentVehicle::on_button_obu_en_clicked()
|
|
|
|
|
|
void ADCIntelligentVehicle::on_button_map_set_clicked()
|
|
void ADCIntelligentVehicle::on_button_map_set_clicked()
|
|
{
|
|
{
|
|
- QString fileName = QFileDialog::getOpenFileName(this,
|
|
|
|
- tr("选择地图文件"),
|
|
|
|
- "/home/nvidia",
|
|
|
|
- tr("Text Files (*.xodr)"));
|
|
|
|
- if (fileName.isEmpty())
|
|
|
|
- {
|
|
|
|
|
|
+ QString fileName = QFileDialog::getOpenFileName(this,
|
|
|
|
+ tr("选择地图文件"),
|
|
|
|
+ "/home/nvidia",
|
|
|
|
+ tr("Text Files (*.xodr)"));
|
|
|
|
+ if (fileName.isEmpty())
|
|
|
|
+ {
|
|
QMessageBox msgBox(QMessageBox::Warning, tr("警告"),
|
|
QMessageBox msgBox(QMessageBox::Warning, tr("警告"),
|
|
- "No Map Selected", 0, this);
|
|
|
|
|
|
+ "No Map Selected", 0, this);
|
|
msgBox.addButton(tr("OK"), QMessageBox::AcceptRole);
|
|
msgBox.addButton(tr("OK"), QMessageBox::AcceptRole);
|
|
-// msgBox.addButton(tr("&Continue"), QMessageBox::RejectRole);
|
|
|
|
-// if (msgBox.exec() == QMessageBox::AcceptRole)
|
|
|
|
-// qDebug()<<"accept";
|
|
|
|
-// else
|
|
|
|
-// qDebug()<<"reject";
|
|
|
|
- }else{
|
|
|
|
- //发送地图文件名到driver_map_xodrload
|
|
|
|
- iv::hmi::hmimsg hmi;
|
|
|
|
- hmi.set_mapname(fileName.toStdString());
|
|
|
|
- ShareHMIMsgPro(hmi);
|
|
|
|
-
|
|
|
|
- //发送站点gps信息
|
|
|
|
- xodrobj xo;
|
|
|
|
- xo.flon = mdLon;
|
|
|
|
- xo.flat = mdLat;
|
|
|
|
- xo.lane = 1;
|
|
|
|
- iv::modulecomm::ModuleSendMsg(mpadst,(char *)&xo,sizeof(xodrobj));
|
|
|
|
- }
|
|
|
|
|
|
+ // msgBox.addButton(tr("&Continue"), QMessageBox::RejectRole);
|
|
|
|
+ // if (msgBox.exec() == QMessageBox::AcceptRole)
|
|
|
|
+ // qDebug()<<"accept";
|
|
|
|
+ // else
|
|
|
|
+ // qDebug()<<"reject";
|
|
|
|
+ }else{
|
|
|
|
+ //发送地图文件名到driver_map_xodrload
|
|
|
|
+ iv::hmi::hmimsg hmi;
|
|
|
|
+ hmi.set_mapname(fileName.toStdString());
|
|
|
|
+ ShareHMIMsgPro(hmi);
|
|
|
|
+
|
|
|
|
+ //发送站点gps信息
|
|
|
|
+ xodrobj xo;
|
|
|
|
+ xo.flon = mdLon;
|
|
|
|
+ xo.flat = mdLat;
|
|
|
|
+ xo.lane = 1;
|
|
|
|
+ iv::modulecomm::ModuleSendMsg(mpadst,(char *)&xo,sizeof(xodrobj));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
void ADCIntelligentVehicle::on_button_vin_set_clicked()
|
|
void ADCIntelligentVehicle::on_button_vin_set_clicked()
|
|
@@ -2134,7 +2148,7 @@ void ADCIntelligentVehicle::on_button_speedLimit_set_clicked()
|
|
tr("Amount:"), 0.0, 0, 30, 1, &ok);
|
|
tr("Amount:"), 0.0, 0, 30, 1, &ok);
|
|
if (ok)
|
|
if (ok)
|
|
{
|
|
{
|
|
-// doubleLabel->setText(QString("$%1").arg(d));
|
|
|
|
|
|
+ // doubleLabel->setText(QString("$%1").arg(d));
|
|
mdspeedLimit = d;
|
|
mdspeedLimit = d;
|
|
iv::hmi::hmimsg hmi;
|
|
iv::hmi::hmimsg hmi;
|
|
hmi.set_speedlimit(mdspeedLimit);
|
|
hmi.set_speedlimit(mdspeedLimit);
|
|
@@ -2162,7 +2176,7 @@ void ADCIntelligentVehicle::on_button_trafficInfo_en_clicked()
|
|
mbTrafficInfoEn = true;
|
|
mbTrafficInfoEn = true;
|
|
}
|
|
}
|
|
gIvlog->info("hmi","traffic info enable:%d", mbTrafficInfoEn);
|
|
gIvlog->info("hmi","traffic info enable:%d", mbTrafficInfoEn);
|
|
-// UpdateV2xStEn(mv2xStEn);
|
|
|
|
|
|
+ // UpdateV2xStEn(mv2xStEn);
|
|
iv::hmi::hmimsg hmi;
|
|
iv::hmi::hmimsg hmi;
|
|
mbFCWEn = false;
|
|
mbFCWEn = false;
|
|
mbjamsEn = false;
|
|
mbjamsEn = false;
|
|
@@ -2186,7 +2200,7 @@ void ADCIntelligentVehicle::on_button_FCW_en_clicked()
|
|
mbFCWEn = true;
|
|
mbFCWEn = true;
|
|
}
|
|
}
|
|
gIvlog->info("hmi","traffic FCW enable:%d", mbFCWEn);
|
|
gIvlog->info("hmi","traffic FCW enable:%d", mbFCWEn);
|
|
-// UpdateV2xStEn(mv2xStEn);
|
|
|
|
|
|
+ // UpdateV2xStEn(mv2xStEn);
|
|
iv::hmi::hmimsg hmi;
|
|
iv::hmi::hmimsg hmi;
|
|
mbTrafficInfoEn = false;
|
|
mbTrafficInfoEn = false;
|
|
mbjamsEn = false;
|
|
mbjamsEn = false;
|
|
@@ -2210,7 +2224,7 @@ void ADCIntelligentVehicle::on_button_jams_en_clicked()
|
|
mbjamsEn = true;
|
|
mbjamsEn = true;
|
|
}
|
|
}
|
|
gIvlog->info("hmi","traffic jams enable:%d", mbjamsEn);
|
|
gIvlog->info("hmi","traffic jams enable:%d", mbjamsEn);
|
|
-// UpdateV2xStEn(mv2xStEn);
|
|
|
|
|
|
+ // UpdateV2xStEn(mv2xStEn);
|
|
iv::hmi::hmimsg hmi;
|
|
iv::hmi::hmimsg hmi;
|
|
mbTrafficInfoEn = false;
|
|
mbTrafficInfoEn = false;
|
|
mbFCWEn = false;
|
|
mbFCWEn = false;
|
|
@@ -2247,7 +2261,7 @@ void ADCIntelligentVehicle::on_button_DriCrims_en_clicked()
|
|
mbdriCrimsEn = true;
|
|
mbdriCrimsEn = true;
|
|
}
|
|
}
|
|
gIvlog->info("hmi","traffic jams enable:%d", mbdriCrimsEn);
|
|
gIvlog->info("hmi","traffic jams enable:%d", mbdriCrimsEn);
|
|
-// UpdateV2xStEn(mv2xStEn);
|
|
|
|
|
|
+ // UpdateV2xStEn(mv2xStEn);
|
|
iv::hmi::hmimsg hmi;
|
|
iv::hmi::hmimsg hmi;
|
|
mbTrafficInfoEn = false;
|
|
mbTrafficInfoEn = false;
|
|
mbFCWEn = false;
|
|
mbFCWEn = false;
|