zhangjia 3 жил өмнө
parent
commit
ecbaa0820f

+ 10 - 2
src/decition/decition_brain_sf/decition/decide_gps_00.cpp

@@ -168,6 +168,7 @@ bool startingFlag = true;  //起步标志,在起步时需要进行frenet规划
 bool useFrenet = false;    //标志是否启用frenet算法避障
 bool useOldAvoid = true;   //标志是否用老方法避障
 bool front_car_decide_avoid=true;  //前后车距大于30米,后车允许根据自己障碍物情况避障,否则只能听从前车
+bool road_permit_avoid=false;  //true: 道路允许避障,false:道路不允许避障
 
 std::vector<std::vector<double>> doubledata;//大地坐标系下x,y,phi,delta,速度规划用变量
 
@@ -1780,11 +1781,18 @@ iv::decition::Decition iv::decition::DecideGps00::getDecideFromGPS(GPS_INS now_g
         avoid_speed_flag=true;
     }*/
 
+    road_permit_avoid=false;
+    if(PathPoint+600<gpsMapLine.size()){
+        for(int k=PathPoint;k<PathPoint+600;k++){
+                if((gpsMapLine[k]->mbnoavoid==false)&&(gpsMapLine[k]->roadSum>1))
+                                 road_permit_avoid=true;
+        }
+    }
 
     //shiyanbizhang 0929
     if(obsDistance>0&& (obsDistance<ServiceCarStatus.aocfDis)&&(obs_speed_for_avoid>-8.0)&&(obs_speed_for_avoid<3.0)&&(realspeed>1)//&& (avoid_speed_flag==true)        //
             &&(vehState==normalRun||vehState==backOri || vehState==avoiding) //&&(ObsTimeStart==-1)
-            && (gpsMapLine[PathPoint]->runMode==1)&& (gpsMapLine[PathPoint]->mbnoavoid==false)&&(gpsMapLine[PathPoint]->mode2!=3000)&&(gpsMapLine[PathPoint+300]->mode2!=3000)&&(gpsMapLine[PathPoint+100]->mode2!=3000)&&(gpsMapLine[PathPoint+300]->mode2!=23)){
+            && (gpsMapLine[PathPoint]->runMode==1)&& (road_permit_avoid==true)&&(gpsMapLine[PathPoint]->mode2!=3000)&&(gpsMapLine[PathPoint+300]->mode2!=3000)&&(gpsMapLine[PathPoint+100]->mode2!=3000)&&(gpsMapLine[PathPoint+300]->mode2!=23)){
 //        ObsTimeStart=GetTickCount();
         ObsTimeEnd+=1.0;
         //dSpeed = min(6.0,dSpeed);
@@ -1824,7 +1832,7 @@ iv::decition::Decition iv::decition::DecideGps00::getDecideFromGPS(GPS_INS now_g
         cout<<"\n====================preAvoid time count finish==================\n"<<endl;
     }
 
-    if((obsDistance<0 ||obsDistance>ServiceCarStatus.aocfDis)||(gpsMapLine[PathPoint]->mbnoavoid==true)||(front_car_decide_avoid==false)){
+    if((obsDistance<0 ||obsDistance>ServiceCarStatus.aocfDis)||(road_permit_avoid==false)||(front_car_decide_avoid==false)){
         ObsTimeStart=-1;
         ObsTimeEnd=-1;
         ObsTimeSpan=-1;