Kaynağa Gözat

jiaotong biaozhipai shibie,debug ok

Your Name 1 yıl önce
ebeveyn
işleme
823fcdb71a

+ 3 - 0
src/decition/common/common/car_status.h

@@ -281,6 +281,9 @@ namespace iv {
         //std::vector<iv::vision::cameraobjectarray> xtrafficsign;
         double iTrafficsignSpeed = 200;//5,10 ,0
         int itrafficsignTurn = 200; //0,左转,1 右转
+        float objectCon=0.85;
+        float objectWidth =20;
+
 
     };
     typedef boost::serialization::singleton<iv::CarStatus> CarStatusSingleton;//非线程安全,注意多线程加锁,单例模式

+ 140 - 51
src/decition/decition_brain_sf_changan_shenlan/decition/brain.cpp

@@ -379,6 +379,13 @@ void iv::decition::BrainDecition::run() {
     ServiceCarStatus.aocfDis = atof(aocfDis.data());
     ServiceCarStatus.aocfTimes = atof(aocfTimes.data());
 
+    //20230814,jiaotong biaozhipaishibie
+
+    std::string objectCon = xp.GetParam("objectCon","0.80");
+    std::string objectWidth = xp.GetParam("objectWidth","29");
+    ServiceCarStatus.objectCon = atof(objectCon.data());
+    ServiceCarStatus.objectWidth = atof(objectWidth.data());
+
 
     std::string angdebug = xp.GetParam("angDebug","0.0");
     std::string tordebug = xp.GetParam("torqueDebug","0.0");
@@ -479,6 +486,36 @@ void iv::decition::BrainDecition::run() {
                 ServiceCarStatus.ang_debug=max((double)-430.0,ServiceCarStatus.ang_debug);
                 ServiceCarStatus.ang_debug=min((double)430.0,ServiceCarStatus.ang_debug);
                 decition_gps->wheel_angle = ServiceCarStatus.ang_debug;//0;
+
+
+                double dSpeed=200;
+                //20230814,交通标志识别添加 start
+                if(ServiceCarStatus.mTrafficSignUpdateTimer.elapsed()>10*1000)
+                 {
+                    ServiceCarStatus.iTrafficsignSpeed=200;
+                    ServiceCarStatus.itrafficsignTurn=200;
+                 }
+
+                if(ServiceCarStatus.itrafficsignTurn==2)
+                {
+                    decition_gps->leftlamp = true;
+                    decition_gps->rightlamp = false;
+                }
+                else if(ServiceCarStatus.itrafficsignTurn==3)
+                {
+                    decition_gps->leftlamp = false;
+                    decition_gps->rightlamp = true;
+                }
+                else
+                {
+                    decition_gps->leftlamp = false;
+                    decition_gps->rightlamp = false;;
+                }
+                std::cout<<"  left:"<<ServiceCarStatus.itrafficsignTurn<<std::endl;
+                std::cout<<"  right:"<<ServiceCarStatus.itrafficsignTurn<<std::endl;
+                std::cout<<"  dSpeed:"<<ServiceCarStatus.iTrafficsignSpeed<<std::endl;
+                dSpeed=min(dSpeed,ServiceCarStatus.iTrafficsignSpeed);
+                //20230814,交通标志识别添加 end
             }
             else
             {
@@ -897,6 +934,8 @@ void iv::decition::BrainDecition::ShareDecition(iv::decition::Decition decition)
     xdecition.set_angle_mode(decition->angle_mode);
     xdecition.set_angle_active(decition->angle_active);
     xdecition.set_auto_mode(decition->auto_mode);
+    xdecition.set_leftlamp(decition->leftlamp);
+    xdecition.set_rightlamp(decition->rightlamp);
     if(ServiceCarStatus.msysparam.mvehtype=="shenlan")
     {
         std::cout<<"===================shareDecition========================"<<std::endl;
@@ -905,6 +944,8 @@ void iv::decition::BrainDecition::ShareDecition(iv::decition::Decition decition)
                 <<"  decideAngle:"<<decition->wheel_angle
                 <<"  decideAngActive:"<<decition->angle_active
                 <<"  decideAutoMode:"<<decition->auto_mode
+               <<"  decideLeftTurn:"<<decition->leftlamp
+               <<"  decideRightTurn:"<<decition->rightlamp
                 <<std::endl;
         std::cout<<"========================================="<<std::endl;
     }
@@ -1198,8 +1239,8 @@ void iv::decition::BrainDecition::GetTrafficSign(const char *pdata, const int nd
     }
 
     ServiceCarStatus.mTrafficSignUpdateTimer.start();
-    ServiceCarStatus.iTrafficsignSpeed=200.0;
-    ServiceCarStatus.itrafficsignTurn=200.0;
+//    ServiceCarStatus.iTrafficsignSpeed=200.0;
+//    ServiceCarStatus.itrafficsignTurn=200.0;
 
     iv::decition::BrainDecition::UpdateTrafficSign(xtrafficsign);
 }
@@ -1210,56 +1251,104 @@ void iv::decition::BrainDecition::UpdateTrafficSign(std::shared_ptr<iv::vision::
 
     xtrafficsign.swap(mvision_obs_);
     int flag;
-    for(int i =0; i<mvision_obs_->obj_size();i++)//{"Speed10","Speed5","Left","Right","Nopassing","Park"}共六类
+    int objectID=0;
+    float objectCon=ServiceCarStatus.objectCon;  //W>30
+    float objectW=ServiceCarStatus.objectWidth;  //W>0.85
+    for(int i =0;mvision_obs_->obj_size();i++)//{"Speed10","Speed5","Left","Right","Nopassing","Park"}共六类
     {
-        if(mvision_obs_->obj(i).type()=="Speed10")
-            flag=0;
-        else if(mvision_obs_->obj(i).type()=="Speed5")
-            flag=1;
-        else if(mvision_obs_->obj(i).type()=="Left")
-            flag=2;
-        else if(mvision_obs_->obj(i).type()=="Right")
-            flag=3;
-        else if(mvision_obs_->obj(i).type()=="Nopassing")
-            flag=4;
-        else if(mvision_obs_->obj(i).type()=="Park")
-            flag=5;
-        else
-            flag =200;
-
-      if((flag==0) ||(flag==1)||(flag==4)|(flag==5))
-      {
-          switch(flag)
-          {
-              case 0:
-                    ServiceCarStatus.iTrafficsignSpeed=min(10.0 , ServiceCarStatus.iTrafficsignSpeed);
-              case 1:
-                    ServiceCarStatus.iTrafficsignSpeed=min(5.0,ServiceCarStatus.iTrafficsignSpeed);
-              case 4:
-                    ServiceCarStatus.iTrafficsignSpeed=min(0.0,ServiceCarStatus.iTrafficsignSpeed);
-              case 5:
-                    ServiceCarStatus.iTrafficsignSpeed=min(0.0,ServiceCarStatus.iTrafficsignSpeed);
-              default:
-                    ServiceCarStatus.iTrafficsignSpeed=200.0;
-          }
-      }
-      else if((flag==2) ||(flag==3))
-      {
-          switch(flag)
-          {
-              case 2:
-                    ServiceCarStatus.itrafficsignTurn=2;
-              case 3:
-                    ServiceCarStatus.itrafficsignTurn=3;
-              default:
-                    ServiceCarStatus.itrafficsignTurn=200.0;
-          }
-      }
-
-    }
-    givlog->debug("decition_brain","flag is : %d",flag);
-    givlog->debug("decition_brain","itrafficsignTurn is : %d",ServiceCarStatus.itrafficsignTurn);
-    givlog->debug("decition_brain","iTrafficsignSpeed is : %f",ServiceCarStatus.iTrafficsignSpeed);
+        if(mvision_obs_->obj(i).con()>=objectCon)
+        {
+            if(mvision_obs_->obj(i).w()>=objectW)
+            {
+                objectID=i;
+                //objectCon =mvision_obs_->obj(i).con();
+                objectW = mvision_obs_->obj(i).w();
+            }
+        }
+    }
+    if(mvision_obs_->obj(objectID).type()=="Speed10")
+        flag=0;
+    else if(mvision_obs_->obj(objectID).type()=="Speed5")
+        flag=1;
+    else if(mvision_obs_->obj(objectID).type()=="Left")
+        flag=2;
+    else if(mvision_obs_->obj(objectID).type()=="Right")
+        flag=3;
+    else if(mvision_obs_->obj(objectID).type()=="Nopassing")
+        flag=4;
+    else if(mvision_obs_->obj(objectID).type()=="Park")
+        flag=5;
+    else
+        flag =200;
+
+    if(flag==0)
+    {
+        ServiceCarStatus.iTrafficsignSpeed=10.0;
+        ServiceCarStatus.itrafficsignTurn=200;
+    }
+    else if(flag==1)
+    {
+        ServiceCarStatus.iTrafficsignSpeed=5.0;
+        ServiceCarStatus.itrafficsignTurn=200;
+    }
+    else if(flag==4)
+    {
+        ServiceCarStatus.iTrafficsignSpeed=0.0;
+        ServiceCarStatus.itrafficsignTurn=200;
+    }
+    else if(flag==5)
+    {
+        ServiceCarStatus.iTrafficsignSpeed=0.0;
+        ServiceCarStatus.itrafficsignTurn=200;
+    }
+    else if(flag==2)
+    {
+        ServiceCarStatus.iTrafficsignSpeed=200.0;
+        ServiceCarStatus.itrafficsignTurn=2;
+    }
+    else if(flag==3)
+    {
+        ServiceCarStatus.iTrafficsignSpeed=200.0;
+        ServiceCarStatus.itrafficsignTurn=3;
+    }
+    else
+    {
+        ServiceCarStatus.iTrafficsignSpeed=200.0;
+        ServiceCarStatus.itrafficsignTurn=200;
+    }
+
+//      if((flag==0)||(flag==1)||(flag==4)|(flag==5))
+//      {
+//          switch(flag)
+//          {
+//              case 0:
+//                    ServiceCarStatus.iTrafficsignSpeed=min(10.0 , ServiceCarStatus.iTrafficsignSpeed);
+//              case 1:
+//                    ServiceCarStatus.iTrafficsignSpeed=min(5.0,ServiceCarStatus.iTrafficsignSpeed);
+//              case 4:
+//                    ServiceCarStatus.iTrafficsignSpeed=min(0.0,ServiceCarStatus.iTrafficsignSpeed);
+//              case 5:
+//                    ServiceCarStatus.iTrafficsignSpeed=min(0.0,ServiceCarStatus.iTrafficsignSpeed);
+//              default:
+//                    ServiceCarStatus.iTrafficsignSpeed=200.0;
+//          }
+//      }
+//      else if((flag==2)||(flag==3))
+//      {
+//          if(flag==2)
+//          {
+//               ServiceCarStatus.itrafficsignTurn=2;
+//          }
+//           else if(flag==3)
+//          {
+//               ServiceCarStatus.itrafficsignTurn=3;
+//          }
+//      }
+
+//    }
+    //givlog->debug("decition_brain","flag is : %d",flag);
+    //givlog->debug("decition_brain","itrafficsignTurn is : %d",ServiceCarStatus.itrafficsignTurn);
+    //givlog->debug("decition_brain","iTrafficsignSpeed is : %f",ServiceCarStatus.iTrafficsignSpeed);
 
     mMutexVison_.unlock();
 }

+ 4 - 3
src/decition/decition_brain_sf_changan_shenlan/decition/decide_gps_00.cpp

@@ -2805,19 +2805,20 @@ else
         ServiceCarStatus.itrafficsignTurn=200;
      }
 
-    if (ServiceCarStatus.itrafficsignTurn==2)
+    if(ServiceCarStatus.itrafficsignTurn==2)
     {
         gps_decition->leftlamp = true;
         gps_decition->rightlamp = false;
     }
-    else if (ServiceCarStatus.itrafficsignTurn==3)
+    else if(ServiceCarStatus.itrafficsignTurn==3)
     {
         gps_decition->leftlamp = false;
         gps_decition->rightlamp = true;
     }
     else
     {
-        ;
+        gps_decition->leftlamp = false;
+        gps_decition->rightlamp = false;;
     }
     dSpeed=min(dSpeed,ServiceCarStatus.iTrafficsignSpeed);
     //20230814,交通标志识别添加 end