|
@@ -338,6 +338,65 @@ ADCIntelligentVehicle::ADCIntelligentVehicle(QWidget *parent)
|
|
|
mpamapreq = iv::modulecomm::RegisterSend("mapreq",1000,1);
|
|
|
shareMapReqMsg();
|
|
|
|
|
|
+ ModuleFun funvbox = std::bind(&ADCIntelligentVehicle::UpdateVbox,this,std::placeholders::_1,std::placeholders::_2,std::placeholders::_3,std::placeholders::_4,std::placeholders::_5);
|
|
|
+ mpaplantrace = iv::modulecomm::RegisterRecvPlus("vbox",funvbox);
|
|
|
+
|
|
|
+ ui->lcdNumber->setDigitCount(3); //设置显示几个数字
|
|
|
+ ui->lcdNumber->setMode(QLCDNumber::Dec);
|
|
|
+ ui->lcdNumber->setSegmentStyle(QLCDNumber::Flat);//设置数字字体:Outline,轮廓突出,颜色为背景色;Filled,内部填充型,颜色为黑色;Flat,平面型
|
|
|
+ // 设置数字颜色时要注意: 函数setSegmentStyle(QLCDNumber::Flat)中选择Flat属性,否则在setColor()设置数字颜色时不生效
|
|
|
+ // 设置背景色直接用setStyleSheet()函数设定就可以了。
|
|
|
+ //调色板
|
|
|
+ QPalette lcdpat = ui->lcdNumber->palette();
|
|
|
+ /*设置颜色,整体背景颜色 颜色蓝色,此函数的第一个参数可以设置多种。如文本、按钮按钮文字、多种*/
|
|
|
+ lcdpat.setColor(QPalette::Normal,QPalette::WindowText,Qt::red);
|
|
|
+ //设置当前窗口的调色板
|
|
|
+ ui->lcdNumber->setPalette(lcdpat);
|
|
|
+ //设置背景色
|
|
|
+ ui->lcdNumber->setStyleSheet("background-color: black");
|
|
|
+ //ui->lcdNumber->display(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"));
|
|
|
+ ui->lcdNumber->display(0);
|
|
|
+
|
|
|
+ ui->lcdNumber_2->setDigitCount(3);
|
|
|
+ ui->lcdNumber_2->setMode(QLCDNumber::Dec);
|
|
|
+ ui->lcdNumber_2->setSegmentStyle(QLCDNumber::Flat);
|
|
|
+ ui->lcdNumber_2->setPalette(lcdpat);
|
|
|
+ ui->lcdNumber_2->setStyleSheet("background-color: black");
|
|
|
+ ui->lcdNumber_2->display(0);
|
|
|
+
|
|
|
+ ui->lcdNumber_3->setDigitCount(3);
|
|
|
+ ui->lcdNumber_3->setMode(QLCDNumber::Dec);
|
|
|
+ ui->lcdNumber_3->setSegmentStyle(QLCDNumber::Flat);
|
|
|
+ ui->lcdNumber_3->setPalette(lcdpat);
|
|
|
+ ui->lcdNumber_3->setStyleSheet("background-color: black");
|
|
|
+ ui->lcdNumber_3->display(0);
|
|
|
+
|
|
|
+ ui->lcdNumber_4->setDigitCount(3);
|
|
|
+ ui->lcdNumber_4->setMode(QLCDNumber::Dec);
|
|
|
+ ui->lcdNumber_4->setSegmentStyle(QLCDNumber::Flat);
|
|
|
+ ui->lcdNumber_4->setPalette(lcdpat);
|
|
|
+ ui->lcdNumber_4->setStyleSheet("background-color: black");
|
|
|
+ ui->lcdNumber_4->display(0);
|
|
|
+
|
|
|
+ // 新建qimage
|
|
|
+ // QImage img,img2,img3,img4;
|
|
|
+ // 加载图片
|
|
|
+ img.load(":/light_image/diaotou-black.png");
|
|
|
+ img = img.scaled(66,66,Qt::IgnoreAspectRatio);
|
|
|
+ ui->label_38->setPixmap(QPixmap::fromImage(img));
|
|
|
+ img2.load(":/light_image/zuoguai-black.png");
|
|
|
+ img2 = img2.scaled(66,66,Qt::IgnoreAspectRatio);
|
|
|
+ ui->label_33->setPixmap(QPixmap::fromImage(img2));
|
|
|
+ img3.load(":/light_image/zhixing-black.png");
|
|
|
+ img3 = img3.scaled(66,66,Qt::IgnoreAspectRatio);
|
|
|
+ ui->label_35->setPixmap(QPixmap::fromImage(img3));
|
|
|
+ img4.load(":/light_image/youguai-black.png");
|
|
|
+ img4 = img4.scaled(66,66,Qt::IgnoreAspectRatio);
|
|
|
+ ui->label_32->setPixmap(QPixmap::fromImage(img4));
|
|
|
+
|
|
|
+ mTimerState1.setTimerType(Qt::PreciseTimer); //设置计时器的精确程度 Qt::PreciseTimer值为0,含义:精确定时器试图保持毫秒精度
|
|
|
+ connect(&mTimerState1,SIGNAL(timeout()),this,SLOT(onStateTimer1()));//广播发送UDP数据报
|
|
|
+ mTimerState1.start(100); //定时100ms
|
|
|
|
|
|
}
|
|
|
|
|
@@ -1867,3 +1926,139 @@ void ADCIntelligentVehicle::shareMapReqMsg()
|
|
|
std::cout<<"iv::map::mapreq serialize OK."<<std::endl;
|
|
|
delete str;
|
|
|
}
|
|
|
+
|
|
|
+void ADCIntelligentVehicle::UpdateVbox(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
|
|
|
+{
|
|
|
+ iv::vbox::vbox xvbox;
|
|
|
+ if(!xvbox.ParseFromArray(strdata,nSize))
|
|
|
+ {
|
|
|
+ gIvlog->warn("ADCIntelligentVehicle::UpdateVbox parse errror. nSize is %d",nSize);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ ServiceCarStatus.st_straight = xvbox.st_straight();
|
|
|
+ ServiceCarStatus.st_left = xvbox.st_left();
|
|
|
+ ServiceCarStatus.st_right = xvbox.st_right();
|
|
|
+ ServiceCarStatus.st_turn = xvbox.st_turn();
|
|
|
+ ServiceCarStatus.time_straight = xvbox.time_straight();
|
|
|
+ ServiceCarStatus.time_left = xvbox.time_left();
|
|
|
+ ServiceCarStatus.time_right = xvbox.time_right();
|
|
|
+ ServiceCarStatus.time_turn = xvbox.time_turn();
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+void ADCIntelligentVehicle::onStateTimer1()
|
|
|
+{
|
|
|
+ ui->lcdNumber->display((int)ServiceCarStatus.time_turn);
|
|
|
+ ui->lcdNumber_2->display((int)ServiceCarStatus.time_left);
|
|
|
+ ui->lcdNumber_3->display((int)ServiceCarStatus.time_straight);
|
|
|
+ ui->lcdNumber_4->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;
|
|
|
+ }
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+}
|