Browse Source

change decition_brain. now have test obs_mobieye, is ok.

yuchuli 3 years ago
parent
commit
7360c96eb7
1 changed files with 23 additions and 2 deletions
  1. 23 2
      src/decition/decition_brain/decision/obs_mobieye.cpp

+ 23 - 2
src/decition/decition_brain/decision/obs_mobieye.cpp

@@ -2,6 +2,10 @@
 
 #include <math.h>
 
+#include "ivlog.h"
+
+extern iv::Ivlog * givlog;
+
 obs_mobieye * gom;
 
 static void ListenMobieye(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
@@ -20,6 +24,7 @@ obs_mobieye::obs_mobieye()
 {
     gom = this;
     mpa = iv::modulecomm::RegisterRecv("mobileye",ListenMobieye);
+    mfangajust = 0.05;
 }
 
 obs_mobieye & obs_mobieye::GetInst()
@@ -63,7 +68,9 @@ int obs_mobieye::GetCandidataObs(std::vector<iv::Point2D> &xgpstrace, iv::mobile
 {
     unsigned int i;
     unsigned int nobjsize = xmobieye.xobj_size();
-    ;
+
+    givlog->debug("MOBS","obs size is %d",nobjsize);
+
     for(i=0;i<nobjsize;i++)
     {
         iv::mobileye::obs * pobs = xmobieye.mutable_xobj(i);
@@ -72,6 +79,8 @@ int obs_mobieye::GetCandidataObs(std::vector<iv::Point2D> &xgpstrace, iv::mobile
         double fobs_y = pobs->pos_x();
         ajustobspos(fobs_x,fobs_y,mfangajust);
 
+        givlog->debug("MOBS","obs pos X:%f y:%f",fobs_x,fobs_y);
+
         unsigned int j;
         unsigned int ntracecount = xgpstrace.size();
         double fdismin = 1000.0;
@@ -137,8 +146,9 @@ bool obs_mobieye::PointInObs(iv::mobileye::obs *pobs, iv::Point2D xpoint)
     xrot = rel_x *cos(beta) - rel_y*sin(beta);
     yrot = rel_x *sin(beta) + rel_y*cos(beta);
 
-    if(fabs(xrot)<=(pobs->obswidth()/2.0))
+    if(fabs(xrot)<=(0.2 + pobs->obswidth()/2.0))
     {
+
         return true;
     }
 
@@ -286,6 +296,7 @@ int obs_mobieye::GetObs(std::vector<iv::Point2D> &xgpstrace, iv::mobileye::mobil
         }
         if(bInObs)
         {
+//             givlog->debug("MOBS","have obs");
             iv::candidateobs x;
             x.xobsdis = GetTraceDis(xgpstrace,xvectoroptobs[i].traceindex);
             x.xttc = 15;
@@ -318,6 +329,16 @@ int obs_mobieye::GetObs(std::vector<iv::Point2D> &xgpstrace, iv::mobileye::mobil
                 }
             }
         }
+        else
+        {
+            if((xttc>15)||(xttc<0))
+            {
+                xttc = xvectorcand[i].xttc;
+                xobsspeed = xvectorcand[i].xobsspeed;
+                xobsdis = xvectorcand[i].xobsdis;
+                xobsid = xvectorcand[i].xobsid;
+            }
+        }
 
     }