|
@@ -462,11 +462,11 @@ iv::Point2D iv::decition::Compute00::getLidarObsPoint(std::vector<Point2D> gpsTr
|
|
double carFrontx = gpsTrace[j].x;// -Form1.CarRear * Math.Cos(anglevalue);
|
|
double carFrontx = gpsTrace[j].x;// -Form1.CarRear * Math.Cos(anglevalue);
|
|
double carFronty = gpsTrace[j].y;// -Form1.CarRear * Math.Sin(anglevalue);
|
|
double carFronty = gpsTrace[j].y;// -Form1.CarRear * Math.Sin(anglevalue);
|
|
|
|
|
|
- Point2D ptLeft(carFrontx + Veh_Width / 2 * cos(anglevalue + PI / 2),
|
|
|
|
- carFronty + Veh_Width / 2 * sin(anglevalue + PI / 2));
|
|
|
|
|
|
+ Point2D ptLeft(carFrontx + ServiceCarStatus.msysparam.vehWidth / 2 * cos(anglevalue + PI / 2),
|
|
|
|
+ carFronty + ServiceCarStatus.msysparam.vehWidth / 2 * sin(anglevalue + PI / 2));
|
|
|
|
|
|
- Point2D ptRight(carFrontx + Veh_Width / 2 * cos(anglevalue - PI / 2),
|
|
|
|
- carFronty + Veh_Width / 2 * sin(anglevalue - PI / 2));
|
|
|
|
|
|
+ Point2D ptRight(carFrontx + ServiceCarStatus.msysparam.vehWidth / 2 * cos(anglevalue - PI / 2),
|
|
|
|
+ carFronty + ServiceCarStatus.msysparam.vehWidth / 2 * sin(anglevalue - PI / 2));
|
|
|
|
|
|
gpsTraceLeft.push_back(ptLeft);
|
|
gpsTraceLeft.push_back(ptLeft);
|
|
gpsTraceRight.push_back(ptRight);
|
|
gpsTraceRight.push_back(ptRight);
|
|
@@ -483,10 +483,10 @@ iv::Point2D iv::decition::Compute00::getLidarObsPoint(std::vector<Point2D> gpsTr
|
|
{
|
|
{
|
|
int count = 0;
|
|
int count = 0;
|
|
|
|
|
|
- for (double length = 0; length <= Veh_Width; length += 0.4)
|
|
|
|
|
|
+ for (double length = 0; length <= ServiceCarStatus.msysparam.vehWidth; length += 0.4)
|
|
{
|
|
{
|
|
- double ptx = gpsTraceLeft[j].x + (gpsTraceRight[j].x - gpsTraceLeft[j].x) / Veh_Width * length;
|
|
|
|
- double pty = gpsTraceLeft[j].y + (gpsTraceRight[j].y - gpsTraceLeft[j].y) / Veh_Width * length;
|
|
|
|
|
|
+ double ptx = gpsTraceLeft[j].x + (gpsTraceRight[j].x - gpsTraceLeft[j].x) / ServiceCarStatus.msysparam.vehWidth * length;
|
|
|
|
+ double pty = gpsTraceLeft[j].y + (gpsTraceRight[j].y - gpsTraceLeft[j].y) / ServiceCarStatus.msysparam.vehWidth * length;
|
|
|
|
|
|
// int dx = (int)(ptx / gridwide * 2 + (ptx / abs(ptx))) / 2 + centerx; //+(ptx / abs(ptx))) / 2左右多出一半的车宽(1米)
|
|
// int dx = (int)(ptx / gridwide * 2 + (ptx / abs(ptx))) / 2 + centerx; //+(ptx / abs(ptx))) / 2左右多出一半的车宽(1米)
|
|
// int dy = (int)(pty / gridwide * 2 + (pty / abs(pty))) / 2 + centery;
|
|
// int dy = (int)(pty / gridwide * 2 + (pty / abs(pty))) / 2 + centery;
|
|
@@ -505,10 +505,10 @@ iv::Point2D iv::decition::Compute00::getLidarObsPoint(std::vector<Point2D> gpsTr
|
|
|
|
|
|
j++;
|
|
j++;
|
|
|
|
|
|
- for (double length = 0; length <= Veh_Width; length += 0.4)
|
|
|
|
|
|
+ for (double length = 0; length <= ServiceCarStatus.msysparam.vehWidth; length += 0.4)
|
|
{
|
|
{
|
|
- double ptx = gpsTraceLeft[j].x + (gpsTraceRight[j].x - gpsTraceLeft[j].x) / Veh_Width * length;
|
|
|
|
- double pty = gpsTraceLeft[j].y + (gpsTraceRight[j].y - gpsTraceLeft[j].y) / Veh_Width * length;
|
|
|
|
|
|
+ double ptx = gpsTraceLeft[j].x + (gpsTraceRight[j].x - gpsTraceLeft[j].x) / ServiceCarStatus.msysparam.vehWidth * length;
|
|
|
|
+ double pty = gpsTraceLeft[j].y + (gpsTraceRight[j].y - gpsTraceLeft[j].y) / ServiceCarStatus.msysparam.vehWidth * length;
|
|
|
|
|
|
// int dx = (int)(ptx / gridwide * 2 + (ptx / abs(ptx))) / 2 + centerx;
|
|
// int dx = (int)(ptx / gridwide * 2 + (ptx / abs(ptx))) / 2 + centerx;
|
|
// int dy = (int)(pty / gridwide * 2 + (pty / abs(pty))) / 2 + centery;
|
|
// int dy = (int)(pty / gridwide * 2 + (pty / abs(pty))) / 2 + centery;
|
|
@@ -574,11 +574,11 @@ iv::Point2D iv::decition::Compute00::getLidarRearObsPoint(std::vector<Point2D> g
|
|
double carFrontx = gpsTrace[j].x;// -Form1.CarRear * Math.Cos(anglevalue);
|
|
double carFrontx = gpsTrace[j].x;// -Form1.CarRear * Math.Cos(anglevalue);
|
|
double carFronty = gpsTrace[j].y;// -Form1.CarRear * Math.Sin(anglevalue);
|
|
double carFronty = gpsTrace[j].y;// -Form1.CarRear * Math.Sin(anglevalue);
|
|
|
|
|
|
- Point2D ptLeft(carFrontx + (Veh_Width-0.3) / 2 * cos(anglevalue + PI / 2),
|
|
|
|
- carFronty + (Veh_Width-0.3) / 2 * sin(anglevalue + PI / 2));
|
|
|
|
|
|
+ Point2D ptLeft(carFrontx + (ServiceCarStatus.msysparam.vehWidth-0.3) / 2 * cos(anglevalue + PI / 2),
|
|
|
|
+ carFronty + (ServiceCarStatus.msysparam.vehWidth-0.3) / 2 * sin(anglevalue + PI / 2));
|
|
|
|
|
|
- Point2D ptRight(carFrontx + (Veh_Width-0.3) / 2 * cos(anglevalue - PI / 2),
|
|
|
|
- carFronty + (Veh_Width-0.3) / 2 * sin(anglevalue - PI / 2));
|
|
|
|
|
|
+ Point2D ptRight(carFrontx + (ServiceCarStatus.msysparam.vehWidth-0.3) / 2 * cos(anglevalue - PI / 2),
|
|
|
|
+ carFronty + (ServiceCarStatus.msysparam.vehWidth-0.3) / 2 * sin(anglevalue - PI / 2));
|
|
|
|
|
|
gpsTraceLeft.push_back(ptLeft);
|
|
gpsTraceLeft.push_back(ptLeft);
|
|
gpsTraceRight.push_back(ptRight);
|
|
gpsTraceRight.push_back(ptRight);
|
|
@@ -595,10 +595,10 @@ iv::Point2D iv::decition::Compute00::getLidarRearObsPoint(std::vector<Point2D> g
|
|
{
|
|
{
|
|
int count = 0;
|
|
int count = 0;
|
|
|
|
|
|
- for (double length = 0; length <= Veh_Width; length += 0.4)
|
|
|
|
|
|
+ for (double length = 0; length <= ServiceCarStatus.msysparam.vehWidth; length += 0.4)
|
|
{
|
|
{
|
|
- double ptx = gpsTraceLeft[j].x + (gpsTraceRight[j].x - gpsTraceLeft[j].x) / Veh_Width * length;
|
|
|
|
- double pty = gpsTraceLeft[j].y + (gpsTraceRight[j].y - gpsTraceLeft[j].y) / Veh_Width * length;
|
|
|
|
|
|
+ double ptx = gpsTraceLeft[j].x + (gpsTraceRight[j].x - gpsTraceLeft[j].x) / ServiceCarStatus.msysparam.vehWidth * length;
|
|
|
|
+ double pty = gpsTraceLeft[j].y + (gpsTraceRight[j].y - gpsTraceLeft[j].y) / ServiceCarStatus.msysparam.vehWidth * length;
|
|
|
|
|
|
// int dx = (int)(ptx / gridwide * 2 + (ptx / abs(ptx))) / 2 + centerx; //+(ptx / abs(ptx))) / 2左右多出一半的车宽(1米)
|
|
// int dx = (int)(ptx / gridwide * 2 + (ptx / abs(ptx))) / 2 + centerx; //+(ptx / abs(ptx))) / 2左右多出一半的车宽(1米)
|
|
// int dy = (int)(pty / gridwide * 2 + (pty / abs(pty))) / 2 + centery;
|
|
// int dy = (int)(pty / gridwide * 2 + (pty / abs(pty))) / 2 + centery;
|
|
@@ -620,10 +620,10 @@ iv::Point2D iv::decition::Compute00::getLidarRearObsPoint(std::vector<Point2D> g
|
|
|
|
|
|
j++;
|
|
j++;
|
|
|
|
|
|
- for (double length = 0; length <= Veh_Width; length += 0.4)
|
|
|
|
|
|
+ for (double length = 0; length <= ServiceCarStatus.msysparam.vehWidth; length += 0.4)
|
|
{
|
|
{
|
|
- double ptx = gpsTraceLeft[j].x + (gpsTraceRight[j].x - gpsTraceLeft[j].x) / Veh_Width * length;
|
|
|
|
- double pty = gpsTraceLeft[j].y + (gpsTraceRight[j].y - gpsTraceLeft[j].y) / Veh_Width * length;
|
|
|
|
|
|
+ double ptx = gpsTraceLeft[j].x + (gpsTraceRight[j].x - gpsTraceLeft[j].x) / ServiceCarStatus.msysparam.vehWidth * length;
|
|
|
|
+ double pty = gpsTraceLeft[j].y + (gpsTraceRight[j].y - gpsTraceLeft[j].y) / ServiceCarStatus.msysparam.vehWidth * length;
|
|
|
|
|
|
// int dx = (int)(ptx / gridwide * 2 + (ptx / abs(ptx))) / 2 + centerx;
|
|
// int dx = (int)(ptx / gridwide * 2 + (ptx / abs(ptx))) / 2 + centerx;
|
|
// int dy = (int)(pty / gridwide * 2 + (pty / abs(pty))) / 2 + centery;
|
|
// int dy = (int)(pty / gridwide * 2 + (pty / abs(pty))) / 2 + centery;
|
|
@@ -689,11 +689,11 @@ iv::Point2D iv::decition::Compute00::getLidarObsPointAvoid(std::vector<Point2D>
|
|
|
|
|
|
//1127 fanwei xiuzheng
|
|
//1127 fanwei xiuzheng
|
|
float buchang=0;
|
|
float buchang=0;
|
|
- Point2D ptLeft(carFrontx + (Veh_Width+(buchang)*2) / 2 * cos(anglevalue + PI / 2),
|
|
|
|
- carFronty + (Veh_Width+(buchang)*2) / 2 * sin(anglevalue + PI / 2));
|
|
|
|
|
|
+ Point2D ptLeft(carFrontx + (ServiceCarStatus.msysparam.vehWidth+(buchang)*2) / 2 * cos(anglevalue + PI / 2),
|
|
|
|
+ carFronty + (ServiceCarStatus.msysparam.vehWidth+(buchang)*2) / 2 * sin(anglevalue + PI / 2));
|
|
|
|
|
|
- Point2D ptRight(carFrontx + (Veh_Width+(buchang)*2) / 2 * cos(anglevalue - PI / 2),
|
|
|
|
- carFronty + (Veh_Width+(buchang)*2) / 2 * sin(anglevalue - PI / 2));
|
|
|
|
|
|
+ Point2D ptRight(carFrontx + (ServiceCarStatus.msysparam.vehWidth+(buchang)*2) / 2 * cos(anglevalue - PI / 2),
|
|
|
|
+ carFronty + (ServiceCarStatus.msysparam.vehWidth+(buchang)*2) / 2 * sin(anglevalue - PI / 2));
|
|
|
|
|
|
gpsTraceLeft.push_back(ptLeft);
|
|
gpsTraceLeft.push_back(ptLeft);
|
|
gpsTraceRight.push_back(ptRight);
|
|
gpsTraceRight.push_back(ptRight);
|
|
@@ -710,10 +710,10 @@ iv::Point2D iv::decition::Compute00::getLidarObsPointAvoid(std::vector<Point2D>
|
|
{
|
|
{
|
|
int count = 0;
|
|
int count = 0;
|
|
|
|
|
|
- for (double length = 0; length <= Veh_Width; length += 0.4)
|
|
|
|
|
|
+ for (double length = 0; length <= ServiceCarStatus.msysparam.vehWidth; length += 0.4)
|
|
{
|
|
{
|
|
- double ptx = gpsTraceLeft[j].x + (gpsTraceRight[j].x - gpsTraceLeft[j].x) / Veh_Width * length;
|
|
|
|
- double pty = gpsTraceLeft[j].y + (gpsTraceRight[j].y - gpsTraceLeft[j].y) / Veh_Width * length;
|
|
|
|
|
|
+ double ptx = gpsTraceLeft[j].x + (gpsTraceRight[j].x - gpsTraceLeft[j].x) / ServiceCarStatus.msysparam.vehWidth * length;
|
|
|
|
+ double pty = gpsTraceLeft[j].y + (gpsTraceRight[j].y - gpsTraceLeft[j].y) / ServiceCarStatus.msysparam.vehWidth * length;
|
|
|
|
|
|
int dx = (int)(ptx / gridwide * 2 + (ptx / abs(ptx))) / 2 + centerx; //*2左右多出一半的车宽(1米)
|
|
int dx = (int)(ptx / gridwide * 2 + (ptx / abs(ptx))) / 2 + centerx; //*2左右多出一半的车宽(1米)
|
|
int dy = (int)(pty / gridwide * 2 + (pty / abs(pty))) / 2 + centery;
|
|
int dy = (int)(pty / gridwide * 2 + (pty / abs(pty))) / 2 + centery;
|
|
@@ -729,10 +729,10 @@ iv::Point2D iv::decition::Compute00::getLidarObsPointAvoid(std::vector<Point2D>
|
|
|
|
|
|
j++;
|
|
j++;
|
|
|
|
|
|
- for (double length = 0; length <= Veh_Width; length += 0.4)
|
|
|
|
|
|
+ for (double length = 0; length <= ServiceCarStatus.msysparam.vehWidth; length += 0.4)
|
|
{
|
|
{
|
|
- double ptx = gpsTraceLeft[j].x + (gpsTraceRight[j].x - gpsTraceLeft[j].x) / Veh_Width * length;
|
|
|
|
- double pty = gpsTraceLeft[j].y + (gpsTraceRight[j].y - gpsTraceLeft[j].y) / Veh_Width * length;
|
|
|
|
|
|
+ double ptx = gpsTraceLeft[j].x + (gpsTraceRight[j].x - gpsTraceLeft[j].x) / ServiceCarStatus.msysparam.vehWidth * length;
|
|
|
|
+ double pty = gpsTraceLeft[j].y + (gpsTraceRight[j].y - gpsTraceLeft[j].y) / ServiceCarStatus.msysparam.vehWidth * length;
|
|
|
|
|
|
int dx = (int)(ptx / gridwide * 2 + (ptx / abs(ptx))) / 2 + centerx;
|
|
int dx = (int)(ptx / gridwide * 2 + (ptx / abs(ptx))) / 2 + centerx;
|
|
int dy = (int)(pty / gridwide * 2 + (pty / abs(pty))) / 2 + centery;
|
|
int dy = (int)(pty / gridwide * 2 + (pty / abs(pty))) / 2 + centery;
|
|
@@ -777,7 +777,7 @@ iv::Point2D iv::decition::Compute00::getLidarObsPointAvoid(std::vector<Point2D>
|
|
// double xxx = esrRadars[i].nomal_x + Esr_Offset;
|
|
// double xxx = esrRadars[i].nomal_x + Esr_Offset;
|
|
// double yyy = esrRadars[i].nomal_y;
|
|
// double yyy = esrRadars[i].nomal_y;
|
|
//
|
|
//
|
|
-// if (abs(xxx - gpsTrace[j].x) <= 3.0*Veh_Width / 4.0 && abs(yyy - (gpsTrace[j].y)) <= 1)
|
|
|
|
|
|
+// if (abs(xxx - gpsTrace[j].x) <= 3.0*ServiceCarStatus.msysparam.vehWidth / 4.0 && abs(yyy - (gpsTrace[j].y)) <= 1)
|
|
// {
|
|
// {
|
|
//
|
|
//
|
|
// if (lastEsrID == (esrRadars[i]).esr_ID)
|
|
// if (lastEsrID == (esrRadars[i]).esr_ID)
|
|
@@ -827,13 +827,13 @@ int iv::decition::Compute00::getEsrIndex(std::vector<Point2D> gpsTrace,int road
|
|
ODS("\nESR毫米波检测物体Y距离:%f\n", yyy);*/
|
|
ODS("\nESR毫米波检测物体Y距离:%f\n", yyy);*/
|
|
|
|
|
|
//优化
|
|
//优化
|
|
-// if(sqrt((xxx - gpsTrace[j].x)*(xxx - gpsTrace[j].x) + (yyy - gpsTrace[j].y)*(yyy - gpsTrace[j].y)) < (1.0*Veh_Width / 2.0+DecideGps00().xiuzhengCs)){
|
|
|
|
|
|
+// if(sqrt((xxx - gpsTrace[j].x)*(xxx - gpsTrace[j].x) + (yyy - gpsTrace[j].y)*(yyy - gpsTrace[j].y)) < (1.0*ServiceCarStatus.msysparam.vehWidth / 2.0+DecideGps00().xiuzhengCs)){
|
|
// *esrPathpoint = j;
|
|
// *esrPathpoint = j;
|
|
// return i;
|
|
// return i;
|
|
// }
|
|
// }
|
|
|
|
|
|
|
|
|
|
- if (abs(xxx - gpsTrace[j].x) <= (3.0*Veh_Width / 4.0+fxiuzhengCs) && abs(yyy - (gpsTrace[j].y)) <= 1)
|
|
|
|
|
|
+ if (abs(xxx - gpsTrace[j].x) <= (3.0*ServiceCarStatus.msysparam.vehWidth / 4.0+fxiuzhengCs) && abs(yyy - (gpsTrace[j].y)) <= 1)
|
|
{
|
|
{
|
|
return i;
|
|
return i;
|
|
|
|
|
|
@@ -889,7 +889,7 @@ int iv::decition::Compute00::getRearEsrIndex(std::vector<Point2D> gpsTrace,int
|
|
ODS("\nESR毫米波检测物体Y距离:%f\n", yyy);*/
|
|
ODS("\nESR毫米波检测物体Y距离:%f\n", yyy);*/
|
|
|
|
|
|
|
|
|
|
- if (abs(xxx - gpsTrace[j].x) <= (3.0*Veh_Width / 4.0+DecideGps00().xiuzhengCs) && abs(yyy - (gpsTrace[j].y)) <= 1)
|
|
|
|
|
|
+ if (abs(xxx - gpsTrace[j].x) <= (3.0*ServiceCarStatus.msysparam.vehWidth / 4.0+DecideGps00().xiuzhengCs) && abs(yyy - (gpsTrace[j].y)) <= 1)
|
|
{
|
|
{
|
|
|
|
|
|
if (lastEsrID == i)
|
|
if (lastEsrID == i)
|
|
@@ -939,7 +939,7 @@ int iv::decition::Compute00::getRearEsrIndex(std::vector<Point2D> gpsTrace,int
|
|
// ODS("\nESR毫米波检测物体Y距离:%f\n", yyy);*/
|
|
// ODS("\nESR毫米波检测物体Y距离:%f\n", yyy);*/
|
|
|
|
|
|
|
|
|
|
-// if (abs(xxx - gpsTrace[j].x) <= 3.0*Veh_Width / 4.0 && abs(yyy - (gpsTrace[j].y)) <= 1)
|
|
|
|
|
|
+// if (abs(xxx - gpsTrace[j].x) <= 3.0*ServiceCarStatus.msysparam.vehWidth / 4.0 && abs(yyy - (gpsTrace[j].y)) <= 1)
|
|
// {
|
|
// {
|
|
|
|
|
|
// if (lastEsrID == i)
|
|
// if (lastEsrID == i)
|
|
@@ -983,7 +983,7 @@ int iv::decition::Compute00::getEsrIndexAvoid(std::vector<Point2D> gpsTrace) {
|
|
double xxx = ServiceCarStatus.obs_radar[i].nomal_x + Esr_Offset;
|
|
double xxx = ServiceCarStatus.obs_radar[i].nomal_x + Esr_Offset;
|
|
double yyy = ServiceCarStatus.obs_radar[i].nomal_y;
|
|
double yyy = ServiceCarStatus.obs_radar[i].nomal_y;
|
|
|
|
|
|
- if (abs(xxx - gpsTrace[j].x) <= 3.0*Veh_Width / 4.0 && abs(yyy - (gpsTrace[j].y)) <= 1)
|
|
|
|
|
|
+ if (abs(xxx - gpsTrace[j].x) <= 3.0*ServiceCarStatus.msysparam.vehWidth / 4.0 && abs(yyy - (gpsTrace[j].y)) <= 1)
|
|
{
|
|
{
|
|
|
|
|
|
if (lastEsrIDAvoid == i)
|
|
if (lastEsrIDAvoid == i)
|
|
@@ -2048,10 +2048,10 @@ int iv::decition::Compute00::getEsrIndexByFrenet(std::vector<Point2D> gpsTrace,
|
|
// esrObsPoint = iv::decition::FrenetPlanner::XY2Frenet(xxx,yyy,gpsTrace);
|
|
// esrObsPoint = iv::decition::FrenetPlanner::XY2Frenet(xxx,yyy,gpsTrace);
|
|
esrObsPoint = iv::decition::FrenetPlanner::getFrenetfromXY(xxx,yyy,gpsTrace,gpsMap,pathpoint,nowGps);
|
|
esrObsPoint = iv::decition::FrenetPlanner::getFrenetfromXY(xxx,yyy,gpsTrace,gpsMap,pathpoint,nowGps);
|
|
|
|
|
|
- //如果障碍物与道路的横向距离d<=3.0*Veh_Width / 4.0,则认为道路上有障碍物。
|
|
|
|
|
|
+ //如果障碍物与道路的横向距离d<=3.0*ServiceCarStatus.msysparam.vehWidth / 4.0,则认为道路上有障碍物。
|
|
//s则可理解为障碍物距离。为障碍物与车辆沿着道路方向的距离,而不是空间上的x或y坐标或者直线距离。
|
|
//s则可理解为障碍物距离。为障碍物与车辆沿着道路方向的距离,而不是空间上的x或y坐标或者直线距离。
|
|
//minDistance、minDis_index用来统计最近的障碍物信息。
|
|
//minDistance、minDis_index用来统计最近的障碍物信息。
|
|
- if(abs(esrObsPoint.d)<=(3.0*Veh_Width / 4.0+DecideGps00().xiuzhengCs)){
|
|
|
|
|
|
+ if(abs(esrObsPoint.d)<=(3.0*ServiceCarStatus.msysparam.vehWidth / 4.0+DecideGps00().xiuzhengCs)){
|
|
if(esrObsPoint.s<minDistance){
|
|
if(esrObsPoint.s<minDistance){
|
|
minDistance = esrObsPoint.s;
|
|
minDistance = esrObsPoint.s;
|
|
minDis_index = i;
|
|
minDis_index = i;
|