Browse Source

change tool/map_lanetoxodr, fix a bug in turn create.

yuchuli 3 years ago
parent
commit
d8bcef8e0e
1 changed files with 28 additions and 2 deletions
  1. 28 2
      src/tool/map_lanetoxodr/mainwindow.cpp

+ 28 - 2
src/tool/map_lanetoxodr/mainwindow.cpp

@@ -4038,25 +4038,51 @@ std::vector<geobase> MainWindow::CreateTurnGeo(double startx, double starty, dou
     if((dis1<1.0)||(dis2<1.0))
     {
         std::cout<<"use line connect."<<std::endl;
+        char strinfo[256];
+        snprintf(strinfo,256,"Use Line Connect");
+        QMessageBox::information(this,"Info",strinfo,QMessageBox::YesAll);
         return CreateLineGeo(startx,starty,starthdg,endx,endy,endhdg);
 
     }
 
+    if((R>=dis1 )||(R>=dis2))
+    {
+        R = dis1 - 0.3;
+        if(R>=dis2)
+        {
+            R = dis2 - 0.3;
+        }
+        char strinfo[256];
+        snprintf(strinfo,256,"Change Radius to %f",R);
+        QMessageBox::information(this,"Info",strinfo,QMessageBox::YesAll);
+    }
+
     double hdgdiff = endhdg - starthdg;
     if(hdgdiff >= M_PI)hdgdiff = hdgdiff - 2.0*M_PI;
     if(hdgdiff <= (-M_PI))hdgdiff = hdgdiff + 2.0*M_PI;
 
 
     double slen = R*tan(fabs(hdgdiff/2.0));
+    if(slen <(R+0.3))
+    {
+        R = slen - 0.3;
+        std::cout<<"Change Radius to "<<R<<std::endl;
+
+        slen = R*tan(fabs(hdgdiff/2.0));
+    }
+
     if((dis1<slen)||(dis2<slen))
     {
         std::cout<<"radius is big. use line."<<std::endl;
+        char strinfo[256];
+        snprintf(strinfo,256,"Use Line Connect");
+        QMessageBox::information(this,"Info",strinfo,QMessageBox::YesAll);
         return CreateLineGeo(startx,starty,starthdg,endx,endy,endhdg);
     }
 
     double p1_x,p1_y,p2_x,p2_y;
-    p1_x = inter_x- slen * cos(starthdg);
-    p1_y = inter_y- slen * sin(starthdg);
+    p1_x = inter_x+ slen * cos(starthdg +M_PI);
+    p1_y = inter_y+ slen * sin(starthdg +M_PI);
     p2_x = inter_x+slen*cos(endhdg);
     p2_y = inter_y+slen*sin(endhdg);