Browse Source

change trafficlight case

chenxiaowei 3 years ago
parent
commit
890442fe43

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

@@ -213,7 +213,6 @@ namespace iv {
         unsigned char rsu_traffic_type=0;//路况信息
         unsigned char rsu_warning_type=0;//碰撞预警信息
         float rsu_radiation_distance=0;//事件辐射范围
-
         float rsu_trafficelimit_spd=200;  //200代表没有限速
         float rsu_warnlimit_spd=200;  //200代表没有限速
         double rsu_gps_lat=0.0;
@@ -224,8 +223,8 @@ namespace iv {
         int vehicle_state_1x=0; //0正常行驶,1减速,2 停车
         float target_spd_1x=0;//减速时的目标速度
 
-        float rsu_limit_spd=200;  //200代表没有限速
-        int iTrafficeLightColor = 2;    //0x0: 红色
+//        float rsu_limit_spd=200;  //200代表没有限速
+        //int iTrafficeLightColor = 2;    //0x0: 红色
         //0x1: 黄色
         //0x2: 绿色
 

+ 1 - 1
src/decition/decition_brain_sf_1x/decition/brain.cpp

@@ -1664,7 +1664,7 @@ void iv::decition::BrainDecition::UpdateV2r(const char *pdata, const int ndatasi
     {
         ServiceCarStatus.rsu_gps_lat = group_message.radiobroadcastgpslon();
     }
-    if(group_message.has_radiolighttype())
+    if(group_message.has_radiolighttype()) //1:绿灯 2:红灯 3:黄灯
     {
         ServiceCarStatus.iTrafficeLightColor = group_message.radiolighttype();
     }

+ 7 - 11
src/decition/decition_brain_sf_1x/decition/decide_gps_00.cpp

@@ -2050,25 +2050,24 @@ if((traffic_type==0x01)||(traffic_type==0x02)||(traffic_type==0x03)||(traffic_ty
          ServiceCarStatus.vehicle_state_1x = 2;
          ServiceCarStatus.target_spd_1x = 0;
     }
-<<<<<<< Updated upstream
     else
     {}
 }
 else
 {
     ServiceCarStatus.vehicle_state_1x = 0;
+    ServiceCarStatus.target_spd_1x = dSpeed;
 }
     //红绿灯信息处理,computeTrafficSpeedLimt由于车子最高5所以要对速度做调整
 
-=======
 //红绿灯信息处理,computeTrafficSpeedLimt由于车子最高5所以要对速度做调整
->>>>>>> Stashed changes
     //-----------------------------------------1+X采集车车路协同,end---------------------------------------------
     //-------------------------------traffic light----------------------------------------------------------------------------------------
 
     if(traffic_light_gps.gps_lat!=0 && traffic_light_gps.gps_lng!=0){
         traffic_light_pathpoint = Compute00().getNoAngleNearestPointIndex(traffic_light_gps, gpsMapLine);
         //    traffic_light_pathpoint=130;
+        //1:绿灯 2:红灯 3:黄灯
         float traffic_speed=ComputeTrafficLightSpeed(ServiceCarStatus.iTrafficeLightColor,ServiceCarStatus.iTrafficeLightTime,gpsMapLine,
                                                      traffic_light_pathpoint ,PathPoint,secSpeed,dSpeed);
         dSpeed = min((double)traffic_speed,dSpeed);
@@ -2216,11 +2215,7 @@ else
                   <<"OBS_Speed"<< ","<<obsSpeed<< ","
                   <<"Traffic_Type"<< ","<<traffic_type<< ","
                   <<"Warn_Type"<< ","<<warning_type<< ","
-<<<<<<< Updated upstream
                   <<"Limit_Speed"<< ","<<trafficlimit_spd<< ","
-=======
-                  <<"Limit_Speed"<< ","<<limit_spd<< ","
->>>>>>> Stashed changes
                   <<endl;
            outfile.close();
        }
@@ -3771,24 +3766,25 @@ float  iv::decition::DecideGps00::ComputeTrafficLightSpeed(int traffic_light_col
 
 
 
-
+//1+x V2R    //1:绿灯 2:红灯 3:黄灯
+    //最开始0x0: 红色 0x1: 黄色 0x2: 绿色
 
     switch(traffic_light_color){
-    case 0:
+    case 2://case 0: //for 1+x修改
         if(passTime>traffic_light_time+1 && traffic_dis>10){
             passEnable=true;
         }else{
             passEnable=false;
         }
         break;
-    case 1:
+   case 3:// case 1:
         if(passTime<traffic_light_time-1 && traffic_dis<10){
             passEnable=true;
         }else{
             passEnable = false;
         }
         break;
-    case 2:
+    case 1://case 2:
         if(passTime<traffic_light_time){
             passEnable= true;
         }else{