|
@@ -1989,41 +1989,76 @@ iv::decition::Decition iv::decition::DecideGps00::getDecideFromGPS(GPS_INS now_g
|
|
|
unsigned char traffic_type=ServiceCarStatus.rsu_traffic_type;//路况信息
|
|
|
unsigned char warning_type=ServiceCarStatus.rsu_warning_type;//预警信息,RSU获得
|
|
|
float distance_to_center=0;
|
|
|
+ GPS_INS traffic_center_gps;
|
|
|
+ traffic_center_gps.gps_lat=ServiceCarStatus.rsu_gps_lat;
|
|
|
+ traffic_center_gps.gps_lng=ServiceCarStatus.rsu_gps_lng;
|
|
|
float radiation_distance=ServiceCarStatus.rsu_radiation_distance;//事件辐射范围,从RSU获得
|
|
|
- float limit_spd=ServiceCarStatus.rsu_limit_spd; //从RSU获得的限速值
|
|
|
+ float trafficlimit_spd=ServiceCarStatus.rsu_trafficelimit_spd; //从RSU获得的限速值
|
|
|
+ float warnlimit_spd=ServiceCarStatus.rsu_warnlimit_spd; //从RSU获得的限速值
|
|
|
//以上变量信息都需要存储到log文件中
|
|
|
-// distance_to_center=GetDistance(now_gps_ins,gps_center);//因为是长直道路所以直接计算事件中心点和当前位置的距离即可
|
|
|
- if((traffic_type==0x01)||(traffic_type==0x02)||(traffic_type==0x03))//塌方,施工,道路结冰,事件范围外10米缓慢减速,事件范围内停车
|
|
|
+ distance_to_center=GetDistance(now_gps_ins,traffic_center_gps);//因为是长直道路所以直接计算事件中心点和当前位置的距离即可
|
|
|
+if((traffic_type==0x01)||(traffic_type==0x02)||(traffic_type==0x03)||(traffic_type==0x04)
|
|
|
+ ||(warning_type==0x01)||(warning_type==0x02))
|
|
|
+{
|
|
|
+ if((traffic_type==0x01)||(traffic_type==0x02)||(traffic_type==0x03))//塌方,施工,道路结冰,事件范围外10米缓慢减速,事件范围内停车
|
|
|
{
|
|
|
if((distance_to_center>=radiation_distance)&&(distance_to_center<=radiation_distance+10))
|
|
|
{
|
|
|
- dSpeed = min(1.0,realspeed-0.5);
|
|
|
+ dSpeed = min(1.0,realspeed-0.2);
|
|
|
+ ServiceCarStatus.vehicle_state_1x = 1;
|
|
|
+ ServiceCarStatus.target_spd_1x = 1.0;
|
|
|
}
|
|
|
else if(distance_to_center<radiation_distance)
|
|
|
{
|
|
|
dSpeed=0.0;
|
|
|
minDecelerate=-2.0;
|
|
|
+ ServiceCarStatus.vehicle_state_1x = 2;
|
|
|
+ ServiceCarStatus.target_spd_1x=0.0;
|
|
|
}
|
|
|
else
|
|
|
{}
|
|
|
}
|
|
|
else if(traffic_type==0x04)//如果事件类型是限速,则在辐射范围内限速,辐射范围外正常行驶
|
|
|
{
|
|
|
- if(distance_to_center<radiation_distance)
|
|
|
+ if((distance_to_center>=radiation_distance)&&(distance_to_center<=radiation_distance+2))
|
|
|
+ {
|
|
|
+ dSpeed=min((double)trafficlimit_spd,realspeed-0.5);//先让速度稍微减少一点
|
|
|
+ ServiceCarStatus.vehicle_state_1x = 1;
|
|
|
+ ServiceCarStatus.target_spd_1x = trafficlimit_spd;
|
|
|
+ }
|
|
|
+ else if(distance_to_center<radiation_distance)
|
|
|
{
|
|
|
- dSpeed=min((double)limit_spd,realspeed-0.5);
|
|
|
+ dSpeed=min((double)trafficlimit_spd,realspeed);
|
|
|
+ ServiceCarStatus.vehicle_state_1x = 1;
|
|
|
+ ServiceCarStatus.target_spd_1x = trafficlimit_spd;
|
|
|
}
|
|
|
+ else
|
|
|
+ {}
|
|
|
}
|
|
|
+ else
|
|
|
+ {}
|
|
|
//碰撞预警,1减速,2 停车
|
|
|
if(warning_type==0x01)
|
|
|
{
|
|
|
- dSpeed=limit_spd;//此处要判断限速值是不是在有效值范围以内
|
|
|
+ dSpeed=warnlimit_spd;//此处要判断限速值是不是在有效值范围以内
|
|
|
+ ServiceCarStatus.vehicle_state_1x = 1;
|
|
|
+ ServiceCarStatus.target_spd_1x = warnlimit_spd;
|
|
|
}
|
|
|
- else if(warning_type==0x01)
|
|
|
+ else if(warning_type==0x02)
|
|
|
{
|
|
|
dSpeed=0.0;
|
|
|
+ ServiceCarStatus.vehicle_state_1x = 2;
|
|
|
+ ServiceCarStatus.target_spd_1x = 0;
|
|
|
}
|
|
|
-//红绿灯信息处理,computeTrafficSpeedLimt由于车子最高5所以要对速度做调整
|
|
|
+ else
|
|
|
+ {}
|
|
|
+}
|
|
|
+else
|
|
|
+{
|
|
|
+ ServiceCarStatus.vehicle_state_1x = 0;
|
|
|
+}
|
|
|
+ //红绿灯信息处理,computeTrafficSpeedLimt由于车子最高5所以要对速度做调整
|
|
|
+
|
|
|
//-----------------------------------------1+X采集车车路协同,end---------------------------------------------
|
|
|
//-------------------------------traffic light----------------------------------------------------------------------------------------
|
|
|
|
|
@@ -2177,7 +2212,7 @@ iv::decition::Decition iv::decition::DecideGps00::getDecideFromGPS(GPS_INS now_g
|
|
|
<<"OBS_Speed"<< ","<<obsSpeed<< ","
|
|
|
<<"Traffic_Type"<< ","<<traffic_type<< ","
|
|
|
<<"Warn_Type"<< ","<<warning_type<< ","
|
|
|
- <<"Limit_Speed"<< ","<<limit_spd<< ","
|
|
|
+ <<"Limit_Speed"<< ","<<trafficlimit_spd<< ","
|
|
|
<<endl;
|
|
|
outfile.close();
|
|
|
}
|
|
@@ -2240,13 +2275,18 @@ iv::decition::Decition iv::decition::DecideGps00::getDecideFromGPS(GPS_INS now_g
|
|
|
else
|
|
|
{
|
|
|
float ttc = 0-(obsDistance/obsSpeed);
|
|
|
+ double obsDistance_log=0;
|
|
|
+ if(obsDistance>500)
|
|
|
+ obsDistance_log=100;
|
|
|
+ else
|
|
|
+ obsDistance_log=obsDistance;
|
|
|
QDateTime dt2=QDateTime::currentDateTime();
|
|
|
outfile <<dt2.time().hour()<<":"<<dt2.time().minute()<<":"<<dt2.time().second()<<":"<<dt2.time().msec()<<","
|
|
|
<<"Decide_Dspeed" << "," <<setprecision(2)<<dSpeed<< ","
|
|
|
<<"Decide_ACC" << "," <<setprecision(2)<<gps_decition->torque<< ","
|
|
|
<<"Decide_Brake"<< "," <<gps_decition->brake<< ","
|
|
|
<<"Vehicle_RealSpd"<< "," <<setprecision(2)<<now_gps_ins.speed<< ","
|
|
|
- <<"OBS_Distance"<< ","<<obsDistance<< ","
|
|
|
+ <<"OBS_Distance"<< ","<<obsDistance_log<< ","
|
|
|
<<"Min_Decelation"","<<minDecelerate<< ","
|
|
|
<<"Decide_Angle"<< "," << setprecision(2)<<gps_decition->wheel_angle<< ","
|
|
|
<<"Vehicle_GPS_heading"<< ","<< setprecision(10)<<now_gps_ins.ins_heading_angle<< ","
|
|
@@ -2255,12 +2295,22 @@ iv::decition::Decition iv::decition::DecideGps00::getDecideFromGPS(GPS_INS now_g
|
|
|
<<"Trace_Point"<< ","<<PathPoint<< ","
|
|
|
<<"OBS_Speed"<< ","<<obsSpeed<< ","
|
|
|
<<"TTC"<< ","<<ttc<< ","
|
|
|
+ <<"Traffic_Type"<< ","<<traffic_type<< ","
|
|
|
+ <<"Warn_Type"<< ","<<warning_type<< ","
|
|
|
+ <<"TrafficLimit_Speed"<< ","<<trafficlimit_spd<< ","
|
|
|
+ <<"Radation_Dis"<< ","<<radiation_distance<< ","
|
|
|
+ <<"Dis_to_center"<< ","<<distance_to_center<< ","
|
|
|
<<endl;
|
|
|
outfile.close();
|
|
|
}
|
|
|
}
|
|
|
- givlog->debug("decition_brain","vehState: %d,PathPoint: %d,dSpeed: %f,obsDistance: %f,obsSpeed: %f,realspeed: %f,minDecelerate: %f,torque: %f,brake: %f,wheel_angle: %f",
|
|
|
- vehState,PathPoint,dSpeed,obsDistance,obsSpeed,realspeed,minDecelerate,gps_decition->torque,gps_decition->brake,gps_decition->wheel_angle);
|
|
|
+ givlog->debug("decition_brain","vehState: %d,PathPoint: %d,dSpeed: %f,obsDistance: %f,"
|
|
|
+ "obsSpeed: %f,realspeed: %f,minDecelerate: %f,torque: %f,brake: %f,"
|
|
|
+ "wheel_angle: %f","Traffic_Type: %d","Warn_Type: %d","TrafficLimit_Speed: %f",
|
|
|
+ "radiation_dis: %f","Dis_to_center: %f","WarnLimit_Speed: %f",
|
|
|
+ vehState,PathPoint,dSpeed,obsDistance,obsSpeed,realspeed,minDecelerate,
|
|
|
+ gps_decition->torque,gps_decition->brake,gps_decition->wheel_angle,traffic_type,
|
|
|
+ warning_type,trafficlimit_spd,radiation_distance,distance_to_center,warnlimit_spd);
|
|
|
}
|
|
|
|
|
|
|