|
@@ -1277,17 +1277,17 @@ iv::decition::Decition iv::decition::DecideGps00::getDecideFromGPS(GPS_INS now_g
|
|
|
gpsTraceNow.assign(gpsTraceOri.begin(), gpsTraceOri.end());
|
|
|
getGpsTraceNowLeftRight(gpsTraceNow);
|
|
|
}
|
|
|
- else //if((vehState==preAvoid)||(vehState==normalRun)||(vehState))
|
|
|
- {
|
|
|
- gpsTraceNow.assign(gpsTraceOri.begin(), gpsTraceOri.end());
|
|
|
- gpsTraceNowLeft.assign(traceOriLeft.begin(),traceOriLeft.end());
|
|
|
- gpsTraceNowRight.assign(traceOriRight.begin(),traceOriRight.end());
|
|
|
- }
|
|
|
-// else
|
|
|
+// else //if((vehState==preAvoid)||(vehState==normalRun)||(vehState))
|
|
|
// {
|
|
|
-// gpsTraceNow = getGpsTraceOffset(gpsTraceOri, avoidXNew);
|
|
|
-// getGpsTraceNowLeftRight(gpsTraceNow);
|
|
|
+// gpsTraceNow.assign(gpsTraceOri.begin(), gpsTraceOri.end());
|
|
|
+// gpsTraceNowLeft.assign(traceOriLeft.begin(),traceOriLeft.end());
|
|
|
+// gpsTraceNowRight.assign(traceOriRight.begin(),traceOriRight.end());
|
|
|
// }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ gpsTraceNow = getGpsTraceOffset(gpsTraceOri, avoidXNew);
|
|
|
+ getGpsTraceNowLeftRight(gpsTraceNow);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
#else
|
|
@@ -1820,7 +1820,7 @@ iv::decition::Decition iv::decition::DecideGps00::getDecideFromGPS(GPS_INS now_g
|
|
|
{
|
|
|
vehState=normalRun;
|
|
|
obstacle_avoid_flag=0;
|
|
|
- avoidXNewPreVector.clear();
|
|
|
+ // avoidXNewPreVector.clear();//20230526,huifu
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1902,13 +1902,13 @@ iv::decition::Decition iv::decition::DecideGps00::getDecideFromGPS(GPS_INS now_g
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if(PathPoint+400<gpsMapLine.size()){
|
|
|
+ if(PathPoint+200<gpsMapLine.size()){ //400gaiwei 200
|
|
|
int road_permit_sum=0;
|
|
|
- for(int k=PathPoint;k<PathPoint+400;k++){
|
|
|
+ for(int k=PathPoint;k<PathPoint+200;k++){
|
|
|
if((gpsMapLine[k]->mbnoavoid==false))//&&(gpsMapLine[k]->roadSum>1))
|
|
|
road_permit_sum++;
|
|
|
}
|
|
|
- if(road_permit_sum>=400)
|
|
|
+ if(road_permit_sum>=200)
|
|
|
road_permit_avoid=true;
|
|
|
}
|
|
|
}
|
|
@@ -2015,118 +2015,156 @@ iv::decition::Decition iv::decition::DecideGps00::getDecideFromGPS(GPS_INS now_g
|
|
|
|
|
|
givlog->debug("decition_brain","======avoidXNewPre==========:%f",avoidXNewPre);
|
|
|
|
|
|
- const int nAvoidPreCount = 100;
|
|
|
+ //const int nAvoidPreCount = 100;
|
|
|
+ if(avoidXNewPreVector.size()<5){
|
|
|
+ avoidXNewPreVector.push_back(avoidXNewPre);
|
|
|
+ }else{
|
|
|
+ if(avoidXNewPreVector[0]!=avoidXNewLast){
|
|
|
+ for(unsigned int i=1;i<avoidXNewPreVector.size();i++){
|
|
|
+ if(avoidXNewPreVector[i]!=avoidXNewPreVector[0]){
|
|
|
+ avoidXNewPreFilter=avoidXNewLast;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if(i==avoidXNewPreVector.size()-1)
|
|
|
+ avoidXNewPreFilter=avoidXNewPreVector[0];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ avoidXNewPreVector.clear();
|
|
|
+ }
|
|
|
+ if(avoidXNewPreFilter!=avoidXNewLast){
|
|
|
+ avoidXNew=avoidXNewPre;
|
|
|
+ if(avoidXNew<0)
|
|
|
+ turnLampFlag=-1;
|
|
|
+ else if(avoidXNew>0)
|
|
|
+ turnLampFlag=1;
|
|
|
+ else
|
|
|
+ turnLampFlag=0;
|
|
|
+
|
|
|
+ gpsTraceNow.clear();
|
|
|
+ gpsTraceAvoidXY.clear();
|
|
|
+ givlog->debug("decition_brain","avoidXNew: %f,avoidXNewLast: %f",
|
|
|
+ avoidXNew,avoidXNewLast);
|
|
|
+ //gpsTraceAvoidXY = getGpsTraceOffsetAvoid(gpsTraceOri, avoidXNew,now_gps_ins);
|
|
|
+ gpsTraceAvoidXY = splinePlanner->chooseRoadBySpline(now_gps_ins,gpsMapLine,PathPoint,obsSpline,avoidXNew,avoidXNewLast);
|
|
|
+ vehState = avoiding;
|
|
|
+ startAvoidGpsIns = now_gps_ins;
|
|
|
+ obstacle_avoid_flag=1;
|
|
|
+ hasCheckedAvoidLidar = false;
|
|
|
+ avoidXNewLast=avoidXNew;
|
|
|
+ avoidXNewPreFilter=avoidXNew;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- if(avoidXNewPreVector.size()<nAvoidPreCount){
|
|
|
- avoidXNewPreVector.push_back(avoidXNewPre);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- avoidXNewPreVector.erase(avoidXNewPreVector.begin());
|
|
|
- avoidXNewPreVector.push_back(avoidXNewPre);
|
|
|
- }
|
|
|
+// if(avoidXNewPreVector.size()<nAvoidPreCount){
|
|
|
+// avoidXNewPreVector.push_back(avoidXNewPre);
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// avoidXNewPreVector.erase(avoidXNewPreVector.begin());
|
|
|
+// avoidXNewPreVector.push_back(avoidXNewPre);
|
|
|
+// }
|
|
|
|
|
|
- if(vehState == preAvoid)
|
|
|
- {
|
|
|
- avoidXNew = avoidXNewPre;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if(fabs(avoidXNewLast)>0.1)
|
|
|
- {
|
|
|
+// if(vehState == preAvoid)
|
|
|
+// {
|
|
|
+// avoidXNew = avoidXNewPre;
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// if(fabs(avoidXNewLast)>0.1)
|
|
|
+// {
|
|
|
|
|
|
- bool bOriginSafe = true;
|
|
|
+// bool bOriginSafe = true;
|
|
|
|
|
|
- if(avoidXNewPreVector.size()<nAvoidPreCount)
|
|
|
- {
|
|
|
- bOriginSafe = false;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- unsigned int j;
|
|
|
- unsigned int nSize = avoidXNewPreVector.size();
|
|
|
- for(j=0;j<nSize;j++)
|
|
|
- {
|
|
|
- if(fabs(avoidXNewPreVector[j])>0.1)
|
|
|
- {
|
|
|
- bOriginSafe = false;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if(bOriginSafe)
|
|
|
- {
|
|
|
- avoidXNew = 0;
|
|
|
- // avoidXNewPreVector.clear();
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- unsigned int j;
|
|
|
- unsigned int nSize = avoidXNewPreVector.size();
|
|
|
- if(avoidXNewPreVector.size()==nAvoidPreCount)
|
|
|
- {
|
|
|
- double filter = 0;
|
|
|
- for(j=0;j<nSize;j++)
|
|
|
- {
|
|
|
- if(fabs(avoidXNewPreVector[j])>0.1)
|
|
|
- {
|
|
|
- if(fabs(filter)<0.1)filter = avoidXNewPreVector[j];
|
|
|
- else
|
|
|
- {
|
|
|
- if(fabs(filter - avoidXNewPreVector[j])>0.1)
|
|
|
- {
|
|
|
- filter = 0;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if(fabs(filter)<0.1)
|
|
|
- {
|
|
|
- avoidXNew = avoidXNewLast;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if(fabs(filter - avoidXNewLast)>=2.0)
|
|
|
- {
|
|
|
- avoidXNew = filter;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- avoidXNew = avoidXNewLast;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- avoidXNew = avoidXNewLast;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+// if(avoidXNewPreVector.size()<nAvoidPreCount)
|
|
|
+// {
|
|
|
+// bOriginSafe = false;
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// unsigned int j;
|
|
|
+// unsigned int nSize = avoidXNewPreVector.size();
|
|
|
+// for(j=0;j<nSize;j++)
|
|
|
+// {
|
|
|
+// if(fabs(avoidXNewPreVector[j])>0.1)
|
|
|
+// {
|
|
|
+// bOriginSafe = false;
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if(bOriginSafe)
|
|
|
+// {
|
|
|
+// avoidXNew = 0;
|
|
|
+// // avoidXNewPreVector.clear();
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// unsigned int j;
|
|
|
+// unsigned int nSize = avoidXNewPreVector.size();
|
|
|
+// if(avoidXNewPreVector.size()==nAvoidPreCount)
|
|
|
+// {
|
|
|
+// double filter = 0;
|
|
|
+// for(j=0;j<nSize;j++)
|
|
|
+// {
|
|
|
+// if(fabs(avoidXNewPreVector[j])>0.1)
|
|
|
+// {
|
|
|
+// if(fabs(filter)<0.1)filter = avoidXNewPreVector[j];
|
|
|
+// else
|
|
|
+// {
|
|
|
+// if(fabs(filter - avoidXNewPreVector[j])>0.1)
|
|
|
+// {
|
|
|
+// filter = 0;
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if(fabs(filter)<0.1)
|
|
|
+// {
|
|
|
+// avoidXNew = avoidXNewLast;
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// if(fabs(filter - avoidXNewLast)>=2.0)
|
|
|
+// {
|
|
|
+// avoidXNew = filter;
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// avoidXNew = avoidXNewLast;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// avoidXNew = avoidXNewLast;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
|
|
|
- if(avoidXNew<0)
|
|
|
- turnLampFlag=-1;
|
|
|
- else if(avoidXNew>0)
|
|
|
- turnLampFlag=1;
|
|
|
- else
|
|
|
- turnLampFlag=0;
|
|
|
+// if(avoidXNew<0)
|
|
|
+// turnLampFlag=-1;
|
|
|
+// else if(avoidXNew>0)
|
|
|
+// turnLampFlag=1;
|
|
|
+// else
|
|
|
+// turnLampFlag=0;
|
|
|
|
|
|
- if(fabs(avoidXNew - avoidXNewLast)>0.1)
|
|
|
- {
|
|
|
- gpsTraceNow.clear();
|
|
|
- gpsTraceAvoidXY.clear();
|
|
|
- givlog->debug("decition_brain","avoidXNew: %f,avoidXNewLast: %f",
|
|
|
- avoidXNew,avoidXNewLast);
|
|
|
- //gpsTraceAvoidXY = getGpsTraceOffsetAvoid(gpsTraceOri, avoidXNew,now_gps_ins);
|
|
|
- gpsTraceAvoidXY = splinePlanner->chooseRoadBySpline(now_gps_ins,gpsMapLine,PathPoint,obsSpline,avoidXNew,avoidXNewLast);
|
|
|
- vehState = avoiding;
|
|
|
- startAvoidGpsIns = now_gps_ins;
|
|
|
- obstacle_avoid_flag=1;
|
|
|
- hasCheckedAvoidLidar = false;
|
|
|
- avoidXNewLast=avoidXNew;
|
|
|
- }
|
|
|
+// if(fabs(avoidXNew - avoidXNewLast)>0.1)
|
|
|
+// {
|
|
|
+// gpsTraceNow.clear();
|
|
|
+// gpsTraceAvoidXY.clear();
|
|
|
+// givlog->debug("decition_brain","avoidXNew: %f,avoidXNewLast: %f",
|
|
|
+// avoidXNew,avoidXNewLast);
|
|
|
+// //gpsTraceAvoidXY = getGpsTraceOffsetAvoid(gpsTraceOri, avoidXNew,now_gps_ins);
|
|
|
+// gpsTraceAvoidXY = splinePlanner->chooseRoadBySpline(now_gps_ins,gpsMapLine,PathPoint,obsSpline,avoidXNew,avoidXNewLast);
|
|
|
+// vehState = avoiding;
|
|
|
+// startAvoidGpsIns = now_gps_ins;
|
|
|
+// obstacle_avoid_flag=1;
|
|
|
+// hasCheckedAvoidLidar = false;
|
|
|
+// avoidXNewLast=avoidXNew;
|
|
|
+// }
|
|
|
|
|
|
// if(avoidXNewPreVector.size()<5){
|
|
|
// avoidXNewPreVector.push_back(avoidXNewPre);
|
|
@@ -2165,7 +2203,7 @@ iv::decition::Decition iv::decition::DecideGps00::getDecideFromGPS(GPS_INS now_g
|
|
|
// avoidXNewLast=avoidXNew;
|
|
|
// avoidXNewPreFilter=avoidXNew;
|
|
|
// }
|
|
|
- }
|
|
|
+// }
|
|
|
//20230407,
|
|
|
// if((vehState == preAvoid)||((avoidXNew!=0)))
|
|
|
// // if((vehState == preAvoid)||(avoidXNew!=0))
|
|
@@ -2673,9 +2711,9 @@ else
|
|
|
|
|
|
if(ServiceCarStatus.msysparam.mvehtype=="shenlan")
|
|
|
{
|
|
|
- if(dSpeed>10.0)
|
|
|
+ if(dSpeed>20.0)
|
|
|
{
|
|
|
- dSpeed=10.0; //shenlan bisai xiansu 10
|
|
|
+ dSpeed=20.0; //shenlan bisai xiansu 10
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -3007,7 +3045,7 @@ std::vector<iv::Point2D> iv::decition::DecideGps00::getGpsTrace(iv::GPS_INS now_
|
|
|
int tracesize=800;
|
|
|
if(ServiceCarStatus.msysparam.mvehtype=="shenlan")
|
|
|
{
|
|
|
- tracesize=400;
|
|
|
+ tracesize=400;//400;
|
|
|
}
|
|
|
else
|
|
|
{
|