Selaa lähdekoodia

Fixed the error in calculating the correction value for traffic lights

dongjunhong 8 kuukautta sitten
vanhempi
commit
45aaceec82
1 muutettua tiedostoa jossa 12 lisäystä ja 11 poistoa
  1. 12 11
      src/v2x/v2xpro/mainwindow.cpp

+ 12 - 11
src/v2x/v2xpro/mainwindow.cpp

@@ -1682,16 +1682,17 @@ void MainWindow::on_ea_cf_clicked()
 {
     double x,y,head;
     x= ui->ea_cf_x->text().toDouble();
+    x=-x;
     y= ui->ea_cf_y->text().toDouble();
     head=m_structMGpsImu.yaw;
 
-    double now_x,now_y,lat,lon,aim_x,aim_y,aim_lat,aim_lon;
+    double now_x,now_y,lat,lon,aim_x,aim_y,aim_lat,aim_lon,dis,add_x,add_y;
     GaussProjCal(m_structMGpsImu.gps_lng,m_structMGpsImu.gps_lat,now_x,now_y);
+    add_x=x*qCos(qDegreesToRadians(head))+y*qSin(qDegreesToRadians(head));
+    add_y=x*qSin(qDegreesToRadians(head))-y*qCos(qDegreesToRadians(head));
 
-    x=x*qCos(qDegreesToRadians(head));
-    y=y*qSin(qDegreesToRadians(head));
-    aim_x=now_x+x;
-    aim_y=now_y+y;
+    aim_x=now_x+add_x;
+    aim_y=now_y+add_y;
     GaussProjInvCal(aim_x,aim_y,&aim_lon,&aim_lat);
 
 
@@ -1756,19 +1757,19 @@ void MainWindow::on_ns_cf_clicked()
 {
     double x,y,head;
     x= ui->ns_cf_x->text().toDouble();
+    x=-x;
     y= ui->ns_cf_y->text().toDouble();
     head=m_structMGpsImu.yaw;
 
-    double now_x,now_y,lat,lon,aim_x,aim_y,aim_lat,aim_lon;
+    double now_x,now_y,lat,lon,aim_x,aim_y,aim_lat,aim_lon,dis,add_x,add_y;
     GaussProjCal(m_structMGpsImu.gps_lng,m_structMGpsImu.gps_lat,now_x,now_y);
+    add_x=x*qCos(qDegreesToRadians(head))+y*qSin(qDegreesToRadians(head));
+    add_y=x*qSin(qDegreesToRadians(head))-y*qCos(qDegreesToRadians(head));
 
-    x=x*qCos(qDegreesToRadians(head));
-    y=y*qSin(qDegreesToRadians(head));
-    aim_x=now_x+x;
-    aim_y=now_y+y;
+    aim_x=now_x+add_x;
+    aim_y=now_y+add_y;
     GaussProjInvCal(aim_x,aim_y,&aim_lon,&aim_lat);
 
-
     QFile inputFile("./v2xTcpClient.xml"); // 替换成你的XML文件路径
 
     if (!inputFile.open(QIODevice::ReadOnly | QIODevice::Text)) {