Sfoglia il codice sorgente

change tool/map_lanetoxodr. for fix circle fitting error.

yuchuli 4 anni fa
parent
commit
f2e370a662

+ 5 - 0
src/decition/common/main.cpp

@@ -8,6 +8,9 @@
 #include "ivversion.h"
 #include "ivbacktrace.h"
 
+#include "ivchart.h"
+iv::Ivchart * givchart;
+
 std::string gstrmemgps;
 std::string gstrmemradar;
 std::string gstrmemdecition;
@@ -16,6 +19,7 @@ std::string gstrmemchassis;
 
 iv::Ivlog * givlog;
 
+
 int main(int argc, char *argv[])
 {
     //RegisterIVBackTrace();
@@ -33,6 +37,7 @@ int main(int argc, char *argv[])
     iv::xmlparam::Xmlparam xp(strpath.toStdString());
 
     givlog = new iv::Ivlog("decition_brain");
+    givchart = new iv::Ivchart();
 
  //   givlog->info("brain.");
 

+ 8 - 0
src/decition/decition_brain/decition/brain.cpp

@@ -11,6 +11,9 @@
 #include "qcoreapplication.h"
 #include <QTime>
 
+#include "ivchart.h"
+extern iv::Ivchart * givchart;
+
 QTime  gps_update_times,gps_last_to_current;
 
 extern std::string gstrmemdecition;
@@ -1065,6 +1068,11 @@ void iv::decition::BrainDecition::ShareDecition(iv::decition::Decition decition)
     xdecition.set_air_on(decition->air_on);
     xdecition.set_door(decition->door);
 
+    givchart->chartvalue("wheel",decition->wheel_angle,-10.0,10.0);
+    givchart->chartvalue("brake",decition->brake,0,100.0);
+    givchart->chartvalue("torque",decition->torque,0,2000);
+
+
 
 
     std::cout<<"===================shareDecition========================"<<std::endl;

+ 2 - 0
src/decition/decition_brain/decition_brain.pro

@@ -55,6 +55,8 @@ INCLUDEPATH += $$PWD/../common
     error( "Couldn't find the iveigen.pri file!" )
 }
 
+LIBS += -livchart
+
 unix:!macx: INCLUDEPATH += $$PWD/.
 unix:!macx: DEPENDPATH += $$PWD/.
 

+ 18 - 0
src/tool/map_lanetoxodr/geofit.cpp

@@ -194,6 +194,12 @@ static int  PointLeftRight(QPointF p0,QPointF p1,QPointF  p2)
 
     QList<double> fr = pcirclefit->getResultList();
 
+    if(fr.at(2)== 0)
+    {
+        fdismax = 1000.0;
+        return fr;
+    }
+
     fdismax = 0;
     double dis1,dis2;
     for(i=0;i<xvals.size();i++)
@@ -297,8 +303,20 @@ static int  PointLeftRight(QPointF p0,QPointF p1,QPointF  p2)
     else
         farc = fhdgstart - fhdgend;
     if(farc < 0)farc = farc + M_PI*2.0;
+    if(farc == 0.0)
+    {
+        if(xvals.size()>2)
+        {
+            if((xvals[0] != xvals[1])||(yvals[0]!=yvals[1]))
+            {
+                farc = 2.0*M_PI; // A FULL Circle
+            }
+        }
+    }
     flen = farc * fr.at(2);
 
+
+
     return fr;
 }