|
@@ -190,7 +190,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|
|
|
|
|
mpTimerRemote = new QTimer(this);
|
|
|
connect(mpTimerRemote,SIGNAL(timeout()),this,SLOT(onTimerRemote()));
|
|
|
- mpTimerRemote->start(10);
|
|
|
+ mpTimerRemote->start(50);
|
|
|
|
|
|
mpTimerUpdateView = new QTimer(this);
|
|
|
connect(mpTimerUpdateView,SIGNAL(timeout()),this,SLOT(onTimerUpdateView()));
|
|
@@ -198,7 +198,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|
|
|
|
|
QTimer * timer = new QTimer(this);
|
|
|
connect(timer,SIGNAL(timeout()),this,SLOT(onTimerUpdatePic()));
|
|
|
- timer->start(10);
|
|
|
+ timer->start(1000);
|
|
|
|
|
|
mpadst = iv::modulecomm::RegisterSend("xodrreq",1000,1);
|
|
|
|
|
@@ -221,6 +221,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|
|
mpthreadpic[i] = new std::thread(&MainWindow::threadpic,this,i);
|
|
|
|
|
|
}
|
|
|
+ mpthreadinfo = new std::thread(&MainWindow::threadinfo,this);
|
|
|
|
|
|
mstrVIN = mgrpcpc->GetVIN().data();
|
|
|
mstrVIN = " VIN:"+ mstrVIN+" ";
|
|
@@ -232,7 +233,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|
|
|
|
|
for(i=0;i<4;i++)
|
|
|
{
|
|
|
- mpPicSave[i]->start();
|
|
|
+// mpPicSave[i]->start();
|
|
|
}
|
|
|
|
|
|
mppicdlg = new DialogPic(this);
|
|
@@ -274,6 +275,7 @@ MainWindow::~MainWindow()
|
|
|
// delete mpbaiduapp;
|
|
|
mbThreadrun = false;
|
|
|
int i;
|
|
|
+ mpthreadinfo->join();
|
|
|
for(i=0;i<NUM_CAM;i++)
|
|
|
{
|
|
|
// mph264decode[i] = new ivh264framedecode(mnframewidth,mnframeheight);
|
|
@@ -457,33 +459,41 @@ void MainWindow::resizeEvent(QResizeEvent *event)
|
|
|
|
|
|
ui->groupBox_gps->setGeometry(groupgps_x,groupgps_y,groupgps_width,groupgps_height);
|
|
|
|
|
|
- int lablewidth = (groupgps_width-50)*2/10;
|
|
|
- int lewidth = (groupgps_width-50)*3/10;
|
|
|
+ int lablewidth =groupgps_width*3/10;// (groupgps_width-50)*2/10;
|
|
|
+ int lewidth = groupgps_width*6/10;
|
|
|
int leheight = 26;
|
|
|
|
|
|
int nypos = 40;
|
|
|
ui->label_gpsins->setGeometry(10,nypos,lablewidth,leheight);
|
|
|
ui->lineEdit_gpsins->setGeometry(20+lablewidth,nypos,lewidth,leheight);
|
|
|
- ui->label_gpsrtk->setGeometry(30+lablewidth+lewidth,nypos,lablewidth,leheight);
|
|
|
- ui->lineEdit_gpsrtk->setGeometry(40+2*lablewidth +lewidth,nypos,lewidth,leheight);
|
|
|
+
|
|
|
+ nypos = nypos + leheight*11/10;
|
|
|
+ ui->label_gpsrtk->setGeometry(10,nypos,lablewidth,leheight);
|
|
|
+ ui->lineEdit_gpsrtk->setGeometry(20+lablewidth,nypos,lewidth,leheight);
|
|
|
|
|
|
nypos = nypos + leheight*11/10;
|
|
|
ui->label_gpslon->setGeometry(10,nypos,lablewidth,leheight);
|
|
|
ui->lineEdit_gpslon->setGeometry(20+lablewidth,nypos,lewidth,leheight);
|
|
|
- ui->label_gpslat->setGeometry(30+lablewidth+lewidth,nypos,lablewidth,leheight);
|
|
|
- ui->lineEdit_gpslat->setGeometry(40+2*lablewidth +lewidth,nypos,lewidth,leheight);
|
|
|
+
|
|
|
+ nypos = nypos + leheight*11/10;
|
|
|
+ ui->label_gpslat->setGeometry(10,nypos,lablewidth,leheight);
|
|
|
+ ui->lineEdit_gpslat->setGeometry(20+lablewidth,nypos,lewidth,leheight);
|
|
|
|
|
|
nypos = nypos + leheight*11/10;
|
|
|
ui->label_gpsheading->setGeometry(10,nypos,lablewidth,leheight);
|
|
|
ui->lineEdit_gpsheading->setGeometry(20+lablewidth,nypos,lewidth,leheight);
|
|
|
- ui->label_gpsheight->setGeometry(30+lablewidth+lewidth,nypos,lablewidth,leheight);
|
|
|
- ui->lineEdit_gpsheight->setGeometry(40+2*lablewidth +lewidth,nypos,lewidth,leheight);
|
|
|
+
|
|
|
+ nypos = nypos + leheight*11/10;
|
|
|
+ ui->label_gpsheight->setGeometry(10,nypos,lablewidth,leheight);
|
|
|
+ ui->lineEdit_gpsheight->setGeometry(20+lablewidth,nypos,lewidth,leheight);
|
|
|
|
|
|
nypos = nypos + leheight*11/10;
|
|
|
ui->label_gpsspeed->setGeometry(10,nypos,lablewidth,leheight);
|
|
|
ui->lineEdit_gpsspeed->setGeometry(20+lablewidth,nypos,lewidth,leheight);
|
|
|
- ui->label_gpssat->setGeometry(30+lablewidth+lewidth,nypos,lablewidth,leheight);
|
|
|
- ui->lineEdit_gpssat->setGeometry(40+2*lablewidth +lewidth,nypos,lewidth,leheight);
|
|
|
+
|
|
|
+ nypos = nypos + leheight*11/10;
|
|
|
+ ui->label_gpssat->setGeometry(10,nypos,lablewidth,leheight);
|
|
|
+ ui->lineEdit_gpssat->setGeometry(20+lablewidth,nypos,lewidth,leheight);
|
|
|
|
|
|
|
|
|
double fscale = (sizemain.width()*2/3)*1.0/mnframewidth;
|
|
@@ -532,13 +542,16 @@ void MainWindow::on_radioButton_manual_clicked()
|
|
|
void MainWindow::onTimerManual()
|
|
|
{
|
|
|
|
|
|
-
|
|
|
+ static qint64 nLastKeepKeyTime = 0;
|
|
|
+ const qint64 nKeepTime = 3000; //if press c key, 5 seconds. in keep mode.
|
|
|
double fOldWheel = mfWheel;
|
|
|
double fOldAcc = mfAcc;
|
|
|
double fOldBrake = mfBrake;
|
|
|
int timediff = mManualTime.elapsed() - mnLastTime;
|
|
|
mnLastTime = mManualTime.elapsed();
|
|
|
|
|
|
+ bool bInKeepMode = false;
|
|
|
+
|
|
|
int nOldShift = mnShift;
|
|
|
|
|
|
if(mpJRT->isOK())
|
|
@@ -577,6 +590,16 @@ void MainWindow::onTimerManual()
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ if(mPressKeys.contains(Qt::Key_C)||(mPressKeys.contains(Qt::Key_A))||(mPressKeys.contains(Qt::Key_D))||(mPressKeys.contains(Qt::Key_W))||(mPressKeys.contains(Qt::Key_S)))
|
|
|
+ {
|
|
|
+ nLastKeepKeyTime = QDateTime::currentMSecsSinceEpoch();
|
|
|
+ }
|
|
|
+
|
|
|
+ if(abs(QDateTime::currentMSecsSinceEpoch() - nLastKeepKeyTime) < nKeepTime)
|
|
|
+ {
|
|
|
+ bInKeepMode = true;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
if(mPressKeys.contains(Qt::Key_A)&&(mPressKeys.contains((Qt::Key_D))))
|
|
|
{
|
|
@@ -586,30 +609,35 @@ void MainWindow::onTimerManual()
|
|
|
{
|
|
|
if(mPressKeys.contains(Qt::Key_A))
|
|
|
{
|
|
|
- if(mfWheel<0)mfWheel = 0;
|
|
|
- else
|
|
|
- {
|
|
|
+// if(mfWheel<0)mfWheel = 0;
|
|
|
+// else
|
|
|
+// {
|
|
|
mfWheel = mfWheel + timediff*mfWheelSpeed/1000;
|
|
|
if(mfWheel < -100)mfWheel = -100;
|
|
|
if(mfWheel > 100 )mfWheel = 100;
|
|
|
- }
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
if(mPressKeys.contains(Qt::Key_D))
|
|
|
{
|
|
|
- if(mfWheel>0)mfWheel = 0;
|
|
|
- else
|
|
|
- {
|
|
|
+// if(mfWheel>0)mfWheel = 0;
|
|
|
+// else
|
|
|
+// {
|
|
|
mfWheel = mfWheel - timediff*mfWheelSpeed/1000;
|
|
|
if(mfWheel < -100)mfWheel = -100;
|
|
|
if(mfWheel > 100 )mfWheel = 100;
|
|
|
- }
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
- if(!mPressKeys.contains(Qt::Key_A)&&(!mPressKeys.contains((Qt::Key_D))))
|
|
|
+ if(mPressKeys.contains(Qt::Key_Z))
|
|
|
+ {
|
|
|
+ mfWheel = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!mPressKeys.contains(Qt::Key_A)&&(!mPressKeys.contains((Qt::Key_D)))&&(bInKeepMode == false))
|
|
|
{
|
|
|
if(mfWheel != 0)
|
|
|
{
|
|
@@ -619,43 +647,91 @@ void MainWindow::onTimerManual()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(mPressKeys.contains(Qt::Key_W)&&(mPressKeys.contains((Qt::Key_S))))
|
|
|
+ if(mnVehMode == 2) //ACC BRAKE
|
|
|
{
|
|
|
- mfAcc = 0;
|
|
|
- mfBrake = mfBrake + timediff*mfBrakeSpeed/1000;
|
|
|
- if(mfBrake<0)mfBrake = 0;
|
|
|
- if(mfBrake > 100)mfBrake = 100;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if(mPressKeys.contains(Qt::Key_W))
|
|
|
- {
|
|
|
- mfBrake = 0;
|
|
|
- mfAcc = mfAcc + timediff*mfAccSpeed/1000;
|
|
|
- if(mfAcc<0)mfAcc = 0;
|
|
|
- if(mfAcc > 100)mfAcc = 100;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- if(mPressKeys.contains(Qt::Key_S))
|
|
|
+ if(mPressKeys.contains(Qt::Key_W)&&(mPressKeys.contains((Qt::Key_S))))
|
|
|
{
|
|
|
mfAcc = 0;
|
|
|
mfBrake = mfBrake + timediff*mfBrakeSpeed/1000;
|
|
|
if(mfBrake<0)mfBrake = 0;
|
|
|
if(mfBrake > 100)mfBrake = 100;
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if(mPressKeys.contains(Qt::Key_W))
|
|
|
+ {
|
|
|
+ mfBrake = 0;
|
|
|
+ mfAcc = mfAcc + timediff*mfAccSpeed/1000;
|
|
|
+ if(mfAcc<0)mfAcc = 0;
|
|
|
+ if(mfAcc > 100)mfAcc = 100;
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
+ if(mPressKeys.contains(Qt::Key_S))
|
|
|
+ {
|
|
|
+ mfAcc = 0;
|
|
|
+ mfBrake = mfBrake + timediff*mfBrakeSpeed/1000;
|
|
|
+ if(mfBrake<0)mfBrake = 0;
|
|
|
+ if(mfBrake > 100)mfBrake = 100;
|
|
|
+ }
|
|
|
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
+ else //Speed Mode
|
|
|
+ {
|
|
|
+ if(mPressKeys.contains(Qt::Key_W)&&(mPressKeys.contains((Qt::Key_S))))
|
|
|
+ {
|
|
|
+ if(mfAcc > 0)
|
|
|
+ {
|
|
|
+ mfAcc = mfAcc - 10*timediff*mfAccSpeed/1000;
|
|
|
+ if(mfAcc<0)mfAcc = 0;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ mfBrake = mfBrake + timediff*mfBrakeSpeed/1000;
|
|
|
+ if(mfBrake<0)mfBrake = 0;
|
|
|
+ if(mfBrake > 100)mfBrake = 100;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if(mPressKeys.contains(Qt::Key_W))
|
|
|
+ {
|
|
|
+ mfBrake = 0;
|
|
|
+ mfAcc = mfAcc + timediff*mfAccSpeed/1000;
|
|
|
+ if(mfAcc<0)mfAcc = 0;
|
|
|
+ if(mfAcc > 100)mfAcc = 100;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if(mPressKeys.contains(Qt::Key_S))
|
|
|
+ {
|
|
|
+ if(mfAcc > 0)
|
|
|
+ {
|
|
|
+ mfAcc = mfAcc - 10*timediff*mfAccSpeed/1000;
|
|
|
+ if(mfAcc<0)mfAcc = 0;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ mfBrake = mfBrake + timediff*mfBrakeSpeed/1000;
|
|
|
+ if(mfBrake<0)mfBrake = 0;
|
|
|
+ if(mfBrake > 100)mfBrake = 100;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- if(!mPressKeys.contains(Qt::Key_W)&&(!mPressKeys.contains((Qt::Key_S))))
|
|
|
+
|
|
|
+ if(!mPressKeys.contains(Qt::Key_W)&&(!mPressKeys.contains((Qt::Key_S)))&&(bInKeepMode == false))
|
|
|
{
|
|
|
if(mfBrake != 0)
|
|
|
{
|
|
|
- mfBrake = mfBrake - timediff*mfBrakeAutoDownSpeed/1000;
|
|
|
- if(mfBrake<0)mfBrake = 0;
|
|
|
- if(mfBrake > 100)mfBrake = 100;
|
|
|
+// mfBrake = mfBrake - timediff*mfBrakeAutoDownSpeed/1000;
|
|
|
+// if(mfBrake<0)mfBrake = 0;
|
|
|
+// if(mfBrake > 100)mfBrake = 100;
|
|
|
}
|
|
|
|
|
|
if(mfAcc != 0)
|
|
@@ -703,11 +779,13 @@ void MainWindow::onTimerRemote()
|
|
|
mremotectrl.set_wheel(mfWheel);
|
|
|
mremotectrl.set_shift(mnShift);
|
|
|
|
|
|
+
|
|
|
int nsersize = mremotectrl.ByteSize();
|
|
|
char * strbuf = new char[nsersize];
|
|
|
if(mremotectrl.SerializeToArray(strbuf,nsersize))
|
|
|
{
|
|
|
- iv::modulecomm::ModuleSendMsg(mpa,strbuf,nsersize);
|
|
|
+ mgrpcpc->SetCtrlMsg("remotectrl",strbuf,nsersize);
|
|
|
+// iv::modulecomm::ModuleSendMsg(mpa,strbuf,nsersize);
|
|
|
}
|
|
|
delete strbuf;
|
|
|
}
|
|
@@ -836,21 +914,26 @@ void MainWindow::onTimerUpdateView()
|
|
|
void MainWindow::paintEvent(QPaintEvent *)
|
|
|
{
|
|
|
int i;
|
|
|
+// QTime xTime;
|
|
|
for(i=0;i<NUM_CAM;i++)
|
|
|
{
|
|
|
if(mbCamUpdate[i])
|
|
|
{
|
|
|
+ // xTime.start();
|
|
|
std::cout<<" copy image. "<<std::endl;
|
|
|
mMutexCam[i].lock();
|
|
|
- QImage image = mpImageCam[i]->copy();
|
|
|
+// QImage image = mpImageCam[i]->copy();
|
|
|
mbCamUpdate[i] = false;
|
|
|
|
|
|
- mMutexCam[i].unlock();
|
|
|
+
|
|
|
// QImage image = mpPicView->GetImage();
|
|
|
mpsceneImg[i]->clear();
|
|
|
- mpsceneImg[i]->addPixmap(QPixmap::fromImage(image));
|
|
|
+ // mpsceneImg[i]->addPixmap(QPixmap::fromImage(image));
|
|
|
+ mpsceneImg[i]->addPixmap(QPixmap::fromImage(*mpImageCam[i]));
|
|
|
mpviewImg[i]->setScene(mpsceneImg[i]);
|
|
|
mpviewImg[i]->show();
|
|
|
+ mMutexCam[i].unlock();
|
|
|
+// std::cout<<" update a image use. "<<xTime.elapsed()<<std::endl;
|
|
|
}
|
|
|
}
|
|
|
// if(mbCamUpdate[0])
|
|
@@ -901,7 +984,9 @@ void MainWindow::on_pushButton_Go_clicked()
|
|
|
xo.flat = lat;
|
|
|
xo.lane = 3;
|
|
|
|
|
|
- iv::modulecomm::ModuleSendMsg(mpadst,(char *)&xo,sizeof(xodrobj));
|
|
|
+
|
|
|
+ mgrpcpc->SetCtrlMsg("xodrreq",(char *)&xo,sizeof(xodrobj));
|
|
|
+// iv::modulecomm::ModuleSendMsg(mpadst,(char *)&xo,sizeof(xodrobj));
|
|
|
}
|
|
|
|
|
|
void MainWindow::on_comboBox_Station_currentIndexChanged(int index)
|
|
@@ -942,7 +1027,7 @@ void MainWindow::on_radioButton_Drive_clicked()
|
|
|
{
|
|
|
mnShift = 1;
|
|
|
ui->radioButton_picfront->setChecked(true);
|
|
|
- on_radioButton_picfront_clicked();
|
|
|
+// on_radioButton_picfront_clicked();
|
|
|
mpbigpicdlg->SetFront();
|
|
|
}
|
|
|
|
|
@@ -956,7 +1041,7 @@ void MainWindow::on_radioButton_Rear_clicked()
|
|
|
{
|
|
|
mnShift = -1;
|
|
|
ui->radioButton_picrear->setChecked(true);
|
|
|
- on_radioButton_picrear_clicked();
|
|
|
+// on_radioButton_picrear_clicked();
|
|
|
mpbigpicdlg->SetRear();
|
|
|
}
|
|
|
|
|
@@ -1078,6 +1163,36 @@ void MainWindow::on_actionSet_Ctrl_Pass_triggered()
|
|
|
|
|
|
}
|
|
|
|
|
|
+void MainWindow::threadinfo()
|
|
|
+{
|
|
|
+ int nrtn;
|
|
|
+ iv::cloud::cloudmsg xcloudmsg;
|
|
|
+ while(mbThreadrun)
|
|
|
+ {
|
|
|
+ nrtn = mgrpcpc->GetQueryMsg(xcloudmsg,1000);
|
|
|
+ if(nrtn == 1)
|
|
|
+ {
|
|
|
+ int i;
|
|
|
+ for(i=0;i<xcloudmsg.xclouddata_size();i++)
|
|
|
+ {
|
|
|
+ iv::cloud::cloudunit * punit = xcloudmsg.mutable_xclouddata(i);
|
|
|
+ if(punit->msgname() == "hcp2_gpsimu")
|
|
|
+ {
|
|
|
+ iv::gps::gpsimu xgpsimu;
|
|
|
+ if(!xgpsimu.ParseFromArray(punit->data().data(),punit->data().size()))
|
|
|
+ {
|
|
|
+ std::cout<<"ListenRaw Parse error."<<std::endl;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ ggpsimu.CopyFrom(xgpsimu);
|
|
|
+ gTimeGPSIMUUpdate = QDateTime::currentMSecsSinceEpoch();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ std::cout<<" receive info msg. "<<std::endl;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
void MainWindow::threadframe(int ncamppos)
|
|
|
{
|
|
|
iv::h264rawframedata xframe;
|