|
@@ -173,7 +173,7 @@ enum VehState { normalRun, park, readyPark, stopObs, avoidObs, preAvoid, avoidin
|
|
|
|
|
|
|
|
|
|
std::vector<iv::Point2D> gpsTraceAim; //记录变道后的目标路径,若车辆经frenet规划行驶至该路径上后,就关闭frenet规划
|
|
std::vector<iv::Point2D> gpsTraceAim; //记录变道后的目标路径,若车辆经frenet规划行驶至该路径上后,就关闭frenet规划
|
|
-std::vector<iv::Point2D> gpsTraceAvoid,gpsTraceNow,gpsTraceBack,gpsTracePre,gpsTraceOri,gpsTraceRear,gpsTraceNowLeft,gpsTraceNowRight;
|
|
|
|
|
|
+std::vector<iv::Point2D> gpsTraceAvoid,gpsTraceNow,gpsTraceBack,gpsTracePre,gpsTraceOri,gpsTraceRear,gpsTraceNowLeft,gpsTraceNowRight,gpsTraceAvoidXY;
|
|
|
|
|
|
std::vector<double> esrDisVector(roadSum, -1);
|
|
std::vector<double> esrDisVector(roadSum, -1);
|
|
std::vector<double> lidarDisVector(roadSum, -1);
|
|
std::vector<double> lidarDisVector(roadSum, -1);
|
|
@@ -908,16 +908,6 @@ iv::decition::Decition iv::decition::DecideGps00::getDecideFromGPS(GPS_INS now_g
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
obsDistance = -1;
|
|
obsDistance = -1;
|
|
esrIndex = -1;
|
|
esrIndex = -1;
|
|
lidarDistance = -1;
|
|
lidarDistance = -1;
|
|
@@ -926,16 +916,6 @@ iv::decition::Decition iv::decition::DecideGps00::getDecideFromGPS(GPS_INS now_g
|
|
esrIndexAvoid = -1;
|
|
esrIndexAvoid = -1;
|
|
roadPre = -1;
|
|
roadPre = -1;
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
gpsTraceOri.clear();
|
|
gpsTraceOri.clear();
|
|
gpsTraceNow.clear();
|
|
gpsTraceNow.clear();
|
|
gpsTraceAim.clear();
|
|
gpsTraceAim.clear();
|
|
@@ -946,10 +926,6 @@ iv::decition::Decition iv::decition::DecideGps00::getDecideFromGPS(GPS_INS now_g
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
if (!isFirstRun)
|
|
if (!isFirstRun)
|
|
{
|
|
{
|
|
// PathPoint = Compute00().getNearestPointIndex(now_gps_ins, gpsMapLine, DecideGps00::lastGpsIndex, DecideGps00::minDis, DecideGps00::maxAngle);
|
|
// PathPoint = Compute00().getNearestPointIndex(now_gps_ins, gpsMapLine, DecideGps00::lastGpsIndex, DecideGps00::minDis, DecideGps00::maxAngle);
|
|
@@ -1006,10 +982,7 @@ iv::decition::Decition iv::decition::DecideGps00::getDecideFromGPS(GPS_INS now_g
|
|
gpsMapLine[PathPoint]->runMode=0;
|
|
gpsMapLine[PathPoint]->runMode=0;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
- // avoidX = (roadOri-roadNow)*roadWidth;
|
|
|
|
- avoidX=computeAvoidX(roadNow,roadOri,gpsMapLine[PathPoint],ServiceCarStatus.msysparam.vehWidth);
|
|
|
|
-
|
|
|
|
|
|
+ avoidX=computeAvoidX(roadNow,roadOri,gpsMapLine[PathPoint],ServiceCarStatus.msysparam.vehWidth);
|
|
|
|
|
|
if ( gpsMapLine[PathPoint]->runMode == 0 &&(vehState == avoidObs||vehState ==stopObs||vehState == preAvoid
|
|
if ( gpsMapLine[PathPoint]->runMode == 0 &&(vehState == avoidObs||vehState ==stopObs||vehState == preAvoid
|
|
||vehState == avoiding||vehState == backOri||vehState ==preBack||vehState ==waitAvoid ) )
|
|
||vehState == avoiding||vehState == backOri||vehState ==preBack||vehState ==waitAvoid ) )
|
|
@@ -1018,21 +991,13 @@ iv::decition::Decition iv::decition::DecideGps00::getDecideFromGPS(GPS_INS now_g
|
|
roadNow = roadOri;
|
|
roadNow = roadOri;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ gpsTraceOri= getGpsTrace(now_gps_ins, gpsMapLine, lastGpsIndex,circleMode);
|
|
|
|
|
|
|
|
+ if((vehState == avoiding)&&(gpsTraceAvoidXY.size()>0))
|
|
|
|
+ {
|
|
|
|
+ gpsTraceOri=getGpsTraceAvoid(now_gps_ins, gpsTraceAvoidXY, lastGpsIndex,circleMode);
|
|
|
|
+ }
|
|
|
|
|
|
- // if (PathPoint!=-1&&((now_gps_ins.rtk_status==6)||(now_gps_ins.rtk_status==5))&&GetDistance(now_gps_ins,*gpsMapLine[PathPoint])<30)
|
|
|
|
- // {
|
|
|
|
- // DecideGps00::lastGpsIndex = PathPoint;
|
|
|
|
- // gpsMissCount = 0;
|
|
|
|
-
|
|
|
|
- // }
|
|
|
|
- // else
|
|
|
|
- // {
|
|
|
|
- // gpsMissCount++;
|
|
|
|
- // }
|
|
|
|
-
|
|
|
|
- gpsTraceOri= getGpsTrace(now_gps_ins, gpsMapLine, lastGpsIndex,circleMode);
|
|
|
|
- // gpsTraceOri = laneChangePlanner->getPath(now_gps_ins,gpsMapLine,PathPoint,0,lidarGridPtr);
|
|
|
|
if(gpsTraceOri.empty()){
|
|
if(gpsTraceOri.empty()){
|
|
gps_decition->wheel_angle = 0;
|
|
gps_decition->wheel_angle = 0;
|
|
gps_decition->speed = dSpeed;
|
|
gps_decition->speed = dSpeed;
|
|
@@ -1097,9 +1062,16 @@ iv::decition::Decition iv::decition::DecideGps00::getDecideFromGPS(GPS_INS now_g
|
|
gpsTraceNowRight.assign(traceOriRight.begin(),traceOriRight.end());
|
|
gpsTraceNowRight.assign(traceOriRight.begin(),traceOriRight.end());
|
|
}else
|
|
}else
|
|
{
|
|
{
|
|
- gpsTraceNow = getGpsTraceOffset(gpsTraceOri, avoidX);
|
|
|
|
- gpsTraceNowLeft=getGpsTraceOffset(traceOriLeft, avoidX);
|
|
|
|
- gpsTraceNowRight=getGpsTraceOffset(traceOriRight, avoidX);
|
|
|
|
|
|
+ if(vehState == avoiding)
|
|
|
|
+ {
|
|
|
|
+ gpsTraceNow.assign(gpsTraceOri.begin(), gpsTraceOri.end());
|
|
|
|
+ gpsTraceNowLeft=getGpsTraceOffset(traceOriLeft, avoidX);
|
|
|
|
+ gpsTraceNowRight=getGpsTraceOffset(traceOriRight, avoidX);
|
|
|
|
+ }else{
|
|
|
|
+ gpsTraceNow = getGpsTraceOffset(gpsTraceOri, avoidX);
|
|
|
|
+ gpsTraceNowLeft=getGpsTraceOffset(traceOriLeft, avoidX);
|
|
|
|
+ gpsTraceNowRight=getGpsTraceOffset(traceOriRight, avoidX);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1107,18 +1079,14 @@ iv::decition::Decition iv::decition::DecideGps00::getDecideFromGPS(GPS_INS now_g
|
|
// dSpeed = getSpeed(gpsTraceNow);
|
|
// dSpeed = getSpeed(gpsTraceNow);
|
|
dSpeed = 80;
|
|
dSpeed = 80;
|
|
|
|
|
|
- //planTrace = gpsTraceNow; //Add By YuChuli, 2020.11.26
|
|
|
|
- planTrace.clear();
|
|
|
|
|
|
+ planTrace.clear();//Add By YuChuli, 2020.11.26
|
|
for(int i=0;i<gpsTraceNow.size();i++){
|
|
for(int i=0;i<gpsTraceNow.size();i++){
|
|
TracePoint pt(gpsTraceNow[i].x,gpsTraceNow[i].y);
|
|
TracePoint pt(gpsTraceNow[i].x,gpsTraceNow[i].y);
|
|
planTrace.push_back(pt);
|
|
planTrace.push_back(pt);
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
dSpeed = limitSpeed(controlAng, dSpeed);
|
|
dSpeed = limitSpeed(controlAng, dSpeed);
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
controlAng= getAngle(gpsTraceNow,now_gps_ins,gps_decition);
|
|
controlAng= getAngle(gpsTraceNow,now_gps_ins,gps_decition);
|
|
if(!circleMode && PathPoint>(gpsMapLine.size()-250)){
|
|
if(!circleMode && PathPoint>(gpsMapLine.size()-250)){
|
|
if(realspeed<0.5)
|
|
if(realspeed<0.5)
|
|
@@ -1473,7 +1441,7 @@ iv::decition::Decition iv::decition::DecideGps00::getDecideFromGPS(GPS_INS now_g
|
|
// useFrenet = false;
|
|
// useFrenet = false;
|
|
// useOldAvoid = true;
|
|
// useOldAvoid = true;
|
|
}
|
|
}
|
|
- else if (useOldAvoid && abs(gpsTraceNow[0].x)<1.0) {
|
|
|
|
|
|
+ else if (useOldAvoid && abs(gpsTraceNow[100].x)<0.2) { //zj 2021.06.21
|
|
// vehState = avoidObs; 0929
|
|
// vehState = avoidObs; 0929
|
|
vehState = normalRun;
|
|
vehState = normalRun;
|
|
}
|
|
}
|
|
@@ -1679,7 +1647,8 @@ iv::decition::Decition iv::decition::DecideGps00::getDecideFromGPS(GPS_INS now_g
|
|
avoidX=computeAvoidX(roadNow,roadOri,gpsMapLine[PathPoint],ServiceCarStatus.msysparam.vehWidth);
|
|
avoidX=computeAvoidX(roadNow,roadOri,gpsMapLine[PathPoint],ServiceCarStatus.msysparam.vehWidth);
|
|
gpsTraceNow.clear();
|
|
gpsTraceNow.clear();
|
|
//gpsTraceNow = getGpsTraceOffset(gpsTraceOri, avoidX);
|
|
//gpsTraceNow = getGpsTraceOffset(gpsTraceOri, avoidX);
|
|
- gpsTraceNow = getGpsTraceOffsetAvoid(gpsTraceOri, avoidX);
|
|
|
|
|
|
+ gpsTraceAvoidXY.clear();
|
|
|
|
+ gpsTraceAvoidXY = getGpsTraceOffsetAvoid(gpsTraceOri, avoidX,now_gps_ins);
|
|
}
|
|
}
|
|
else if(useFrenet){
|
|
else if(useFrenet){
|
|
if(roadPre != roadNow){
|
|
if(roadPre != roadNow){
|
|
@@ -1753,16 +1722,6 @@ iv::decition::Decition iv::decition::DecideGps00::getDecideFromGPS(GPS_INS now_g
|
|
hasZhuched = false;
|
|
hasZhuched = false;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
if ( vehState==changingRoad || vehState==chaocheBack)
|
|
if ( vehState==changingRoad || vehState==chaocheBack)
|
|
{
|
|
{
|
|
double lastAng = 0.0 - lastAngle;
|
|
double lastAng = 0.0 - lastAngle;
|
|
@@ -1941,10 +1900,6 @@ iv::decition::Decition iv::decition::DecideGps00::getDecideFromGPS(GPS_INS now_g
|
|
|
|
|
|
transferGpsMode2(gpsMapLine);
|
|
transferGpsMode2(gpsMapLine);
|
|
|
|
|
|
- // if(obsDistance>6.5){
|
|
|
|
- // obsDistance=500;
|
|
|
|
- //}
|
|
|
|
-
|
|
|
|
if(ServiceCarStatus.msysparam.mvehtype=="hapo"){
|
|
if(ServiceCarStatus.msysparam.mvehtype=="hapo"){
|
|
if(obsDistance>0 && obsDistance<8){
|
|
if(obsDistance>0 && obsDistance<8){
|
|
dSpeed=0;
|
|
dSpeed=0;
|
|
@@ -2041,9 +1996,6 @@ std::vector<iv::Point2D> iv::decition::DecideGps00::getGpsTrace(iv::GPS_INS now_
|
|
traceOriLeft.clear();
|
|
traceOriLeft.clear();
|
|
traceOriRight.clear();
|
|
traceOriRight.clear();
|
|
|
|
|
|
- ServiceCarStatus.obsTraceLeft.clear();
|
|
|
|
- ServiceCarStatus.obsTraceRight.clear();
|
|
|
|
-
|
|
|
|
if (gpsMapLine.size() > 600 && PathPoint >= 0) {
|
|
if (gpsMapLine.size() > 600 && PathPoint >= 0) {
|
|
int aimIndex;
|
|
int aimIndex;
|
|
if(circleMode){
|
|
if(circleMode){
|
|
@@ -2129,16 +2081,42 @@ std::vector<iv::Point2D> iv::decition::DecideGps00::getGpsTrace(iv::GPS_INS now_
|
|
traceOriLeft.push_back(ptLeft);
|
|
traceOriLeft.push_back(ptLeft);
|
|
traceOriRight.push_back(ptRight);
|
|
traceOriRight.push_back(ptRight);
|
|
|
|
|
|
- TracePoint obsptleft(ptLeft.x,ptLeft.y);
|
|
|
|
- ServiceCarStatus.obsTraceLeft.push_back(obsptleft);
|
|
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return trace;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+std::vector<iv::Point2D> iv::decition::DecideGps00::getGpsTraceAvoid(iv::GPS_INS now_gps_ins, const std::vector<Point2D> gpsTrace, int lastIndex, bool circleMode) {
|
|
|
|
+ vector<iv::Point2D> trace;
|
|
|
|
+
|
|
|
|
+ int index = -1;
|
|
|
|
+ float minDis = 10;
|
|
|
|
|
|
- TracePoint obsptright(ptRight.x,ptRight.y);
|
|
|
|
- ServiceCarStatus.obsTraceRight.push_back(obsptright);
|
|
|
|
|
|
+ for (unsigned int i = 0; i < gpsTrace.size(); i++)
|
|
|
|
+ {
|
|
|
|
+ double tmpdis = sqrt((now_gps_ins.gps_x - gpsTrace[i].x) * (now_gps_ins.gps_x - gpsTrace[i].x) + (now_gps_ins.gps_y - gpsTrace[i].y) * (now_gps_ins.gps_y - gpsTrace[i].y));
|
|
|
|
+
|
|
|
|
+ if (tmpdis < minDis)
|
|
|
|
+ {
|
|
|
|
+ index = i;
|
|
|
|
+ minDis = tmpdis;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ trace.clear();
|
|
|
|
+ if (index >= 0) {
|
|
|
|
+ for (unsigned int i = index; i < gpsTrace.size(); i++)
|
|
|
|
+ {
|
|
|
|
+ Point2D pt = Coordinate_Transfer(gpsTrace[i].x, gpsTrace[i].y, now_gps_ins);
|
|
|
|
+ trace.push_back(pt);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return trace;
|
|
return trace;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
std::vector<iv::Point2D> iv::decition::DecideGps00::getGpsTraceOffset(std::vector<Point2D> gpsTrace, double offset) {
|
|
std::vector<iv::Point2D> iv::decition::DecideGps00::getGpsTraceOffset(std::vector<Point2D> gpsTrace, double offset) {
|
|
|
|
|
|
if (offset==0)
|
|
if (offset==0)
|
|
@@ -2197,7 +2175,7 @@ std::vector<iv::Point2D> iv::decition::DecideGps00::getGpsTraceOffset(std::vect
|
|
return trace;
|
|
return trace;
|
|
}
|
|
}
|
|
|
|
|
|
-std::vector<iv::Point2D> iv::decition::DecideGps00::getGpsTraceOffsetAvoid(std::vector<Point2D> gpsTrace, double offset) {
|
|
|
|
|
|
+std::vector<iv::Point2D> iv::decition::DecideGps00::getGpsTraceOffsetAvoid(std::vector<Point2D> gpsTrace, double offset,GPS_INS nowgps) {
|
|
|
|
|
|
if (offset==0)
|
|
if (offset==0)
|
|
{
|
|
{
|
|
@@ -2205,6 +2183,7 @@ std::vector<iv::Point2D> iv::decition::DecideGps00::getGpsTraceOffsetAvoid(std:
|
|
}
|
|
}
|
|
|
|
|
|
std::vector<iv::Point2D> trace;
|
|
std::vector<iv::Point2D> trace;
|
|
|
|
+ std::vector<iv::Point2D> traceXY;
|
|
for (int j = 0; j < gpsTrace.size(); j++)
|
|
for (int j = 0; j < gpsTrace.size(); j++)
|
|
{
|
|
{
|
|
double sumx1 = 0, sumy1 = 0, count1 = 0;
|
|
double sumx1 = 0, sumy1 = 0, count1 = 0;
|
|
@@ -2253,7 +2232,7 @@ std::vector<iv::Point2D> iv::decition::DecideGps00::getGpsTraceOffsetAvoid(std:
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- bool use_new_method = false;
|
|
|
|
|
|
+ bool use_new_method = true;
|
|
if (use_new_method)
|
|
if (use_new_method)
|
|
{
|
|
{
|
|
const int val = 100;
|
|
const int val = 100;
|
|
@@ -2272,7 +2251,15 @@ std::vector<iv::Point2D> iv::decition::DecideGps00::getGpsTraceOffsetAvoid(std:
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- return trace;
|
|
|
|
|
|
+
|
|
|
|
+ traceXY.clear();
|
|
|
|
+ for(int j=0;j<trace.size();j++)
|
|
|
|
+ {
|
|
|
|
+ GPS_INS gpsxy = Coordinate_UnTransfer(trace[j].x,trace[j].y,nowgps);
|
|
|
|
+ Point2D gpsinxy(gpsxy.gps_x,gpsxy.gps_y);
|
|
|
|
+ traceXY.push_back(gpsinxy);
|
|
|
|
+ }
|
|
|
|
+ return traceXY;
|
|
}
|
|
}
|
|
|
|
|
|
double iv::decition::DecideGps00::getAngle(std::vector<Point2D> gpsTrace,GPS_INS gpsIns,iv::decition::Decition decition) {
|
|
double iv::decition::DecideGps00::getAngle(std::vector<Point2D> gpsTrace,GPS_INS gpsIns,iv::decition::Decition decition) {
|
|
@@ -2943,10 +2930,7 @@ int iv::decition::DecideGps00::chooseAvoidRoad(iv::LidarGridPtr lidarGridPtr, GP
|
|
gpsTraceAvoid.clear();
|
|
gpsTraceAvoid.clear();
|
|
avoidX=computeAvoidX(i,roadOri,gpsMapLine[PathPoint],ServiceCarStatus.msysparam.vehWidth);
|
|
avoidX=computeAvoidX(i,roadOri,gpsMapLine[PathPoint],ServiceCarStatus.msysparam.vehWidth);
|
|
gpsTraceAvoid = getGpsTraceOffset(gpsTraceOri, avoidX);
|
|
gpsTraceAvoid = getGpsTraceOffset(gpsTraceOri, avoidX);
|
|
- gpsTraceNowLeft=getGpsTraceOffset(traceOriLeft, avoidX);
|
|
|
|
- gpsTraceNowRight=getGpsTraceOffset(traceOriRight, avoidX);
|
|
|
|
- //computeObsOnRoad(lidarGridPtr, gpsTraceAvoid, i,gpsMapLine,lidar_per);
|
|
|
|
- computeObsOnRoadXY(lidarGridPtr, gpsTraceAvoid,gpsTraceNowLeft,gpsTraceNowRight,i,gpsMapLine,lidar_per);
|
|
|
|
|
|
+ computeObsOnRoad(lidarGridPtr, gpsTraceAvoid, i,gpsMapLine,lidar_per);
|
|
}
|
|
}
|
|
|
|
|
|
if (lidarGridPtr!=NULL)
|
|
if (lidarGridPtr!=NULL)
|
|
@@ -3015,10 +2999,7 @@ int iv::decition::DecideGps00::chooseBackRoad(iv::LidarGridPtr lidarGridPtr, GPS
|
|
gpsTraceBack.clear();
|
|
gpsTraceBack.clear();
|
|
avoidX=computeAvoidX(i,roadOri,gpsMapLine[PathPoint],ServiceCarStatus.msysparam.vehWidth);
|
|
avoidX=computeAvoidX(i,roadOri,gpsMapLine[PathPoint],ServiceCarStatus.msysparam.vehWidth);
|
|
gpsTraceBack = getGpsTraceOffset(gpsTraceOri, avoidX);
|
|
gpsTraceBack = getGpsTraceOffset(gpsTraceOri, avoidX);
|
|
- gpsTraceNowLeft=getGpsTraceOffset(traceOriLeft, avoidX);
|
|
|
|
- gpsTraceNowRight=getGpsTraceOffset(traceOriRight, avoidX);
|
|
|
|
- //computeObsOnRoad(lidarGridPtr, gpsTraceBack, i,gpsMapLine,lidar_per);
|
|
|
|
- computeObsOnRoadXY(lidarGridPtr, gpsTraceBack,gpsTraceNowLeft,gpsTraceNowRight,i,gpsMapLine,lidar_per);
|
|
|
|
|
|
+ computeObsOnRoad(lidarGridPtr, gpsTraceBack, i,gpsMapLine,lidar_per);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|