2 Commits 814a4a12ce ... 212de7ddd4

Autor SHA1 Mensagem Data
  dongjunhong 212de7ddd4 Merge branch 'master' of http://116.63.46.168:3000/ADPilot/modularization 8 meses atrás
  dongjunhong b827ba1cf6 Fixed the error in calculating the correction value for traffic lights 8 meses atrás
1 arquivos alterados com 19 adições e 8 exclusões
  1. 19 8
      src/v2x/v2xpro/mainwindow.cpp

+ 19 - 8
src/v2x/v2xpro/mainwindow.cpp

@@ -1682,14 +1682,20 @@ void MainWindow::on_ea_cf_clicked()
 {
     double x,y,head;
     x= ui->ea_cf_x->text().toDouble();
-    x=-x;
+//    x=-x;
     y= ui->ea_cf_y->text().toDouble();
     head=m_structMGpsImu.yaw;
-
+    if (head>90)
+    {
+        head=360-(head-90);
+    }
+    else{
+        head=90-head;
+    }
     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));
+    add_x=y*qCos(qDegreesToRadians(head))+x*qSin(qDegreesToRadians(head));
+    add_y=y*qSin(qDegreesToRadians(head))-x*qCos(qDegreesToRadians(head));
 
     aim_x=now_x+add_x;
     aim_y=now_y+add_y;
@@ -1760,16 +1766,21 @@ void MainWindow::on_ns_cf_clicked()
     x=-x;
     y= ui->ns_cf_y->text().toDouble();
     head=m_structMGpsImu.yaw;
-
+    if (head>90)
+    {
+        head=360-(head-90);
+    }
+    else{
+        head=90-head;
+    }
     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));
+    add_x=y*qCos(qDegreesToRadians(head))+x*qSin(qDegreesToRadians(head));
+    add_y=y*qSin(qDegreesToRadians(head))-x*qCos(qDegreesToRadians(head));
 
     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)) {