|
@@ -89,8 +89,8 @@ void ComputeWayPoints::ListenNewTraceMap(const char *strdata, const unsigned int
|
|
|
(void)dt;
|
|
|
(void)strmemname;
|
|
|
|
|
|
- const double fspeedlimt = 30.0/3.6;
|
|
|
- const double fdacc = -0.5;
|
|
|
+ const double fspeedlimt = 30.0/3.6; //Speeed Limit
|
|
|
+ const double fdacc = -0.5; //Acc Limit
|
|
|
|
|
|
iv::map::tracemap xtracemap;
|
|
|
if(!xtracemap.ParseFromArray(strdata,nSize))
|
|
@@ -136,9 +136,12 @@ int ComputeWayPoints::FindWayPoints(iv::map::tracemap &xtracemap)
|
|
|
double fheaddiff;
|
|
|
int nnearindex = -1;
|
|
|
double fdismin = std::numeric_limits<double>::max();
|
|
|
+ const double facclimithigh = 1.5; //Acc Max
|
|
|
+ const double facclimitlow = -9.0; //Acc Min
|
|
|
|
|
|
double fnowx,fnowy;
|
|
|
GaussProjCal(xgpsimu.lon(),xgpsimu.lat(),&fnowx,&fnowy);
|
|
|
+ double fnowspeed = sqrt(pow(xgpsimu.ve(),2) + pow(xgpsimu.vn(),2));
|
|
|
|
|
|
int i;
|
|
|
int ntracesize = mtracemap.point_size();
|
|
@@ -209,12 +212,59 @@ int ComputeWayPoints::FindWayPoints(iv::map::tracemap &xtracemap)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ //Get Point Adn fix speed.
|
|
|
int j = 0;
|
|
|
+ double flastx = fnowx;
|
|
|
+ double flasty = fnowy;
|
|
|
+ double flastspeed = fnowspeed;
|
|
|
for(i=nnearindex;i<ntracesize;i++)
|
|
|
{
|
|
|
iv::map::mappoint * pnew = xtracemap.add_point();
|
|
|
pnew->CopyFrom(mtracemap.point(i));
|
|
|
j++;
|
|
|
+ if(j== 1)
|
|
|
+ {
|
|
|
+// pnew->set_speed(fnowspeed);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ double fdis = sqrt(pow(pnew->gps_x() - flastx,2)+pow(pnew->gps_y() - flasty,2) );
|
|
|
+ if(fdis > 0)
|
|
|
+ {
|
|
|
+ if((pnew->speed() > 1.0)&&(j==2))
|
|
|
+ {
|
|
|
+ //Allow 5% speed diff
|
|
|
+// if(fabs(pnew->speed() - fnowspeed)<(fnowspeed*0.05))
|
|
|
+// {
|
|
|
+// pnew->set_speed(fnowspeed);
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// double vmax = sqrt(flastspeed*flastspeed + 2*facclimithigh*fdis);
|
|
|
+// double fvalue = flastspeed+flastspeed + 2*facclimitlow*fdis;
|
|
|
+// double vmin = 0;
|
|
|
+// if(fvalue>0)vmin = sqrt(fvalue);
|
|
|
+// std::cout<<" vmax: "<<vmax<<" vmin: "<<vmin<<std::endl;
|
|
|
+// if(pnew->speed()>vmax)pnew->set_speed(vmax);
|
|
|
+// if(pnew->speed()<vmin)pnew->set_speed(vmin);
|
|
|
+// }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+// double vmax = sqrt(flastspeed*flastspeed + 2*facclimithigh*fdis);
|
|
|
+// double fvalue = flastspeed+flastspeed + 2*facclimitlow*fdis;
|
|
|
+// double vmin = 0;
|
|
|
+// if(fvalue>0)vmin = sqrt(fvalue);
|
|
|
+// if(pnew->speed()>vmax)pnew->set_speed(vmax);
|
|
|
+// if(pnew->speed()<vmin)pnew->set_speed(vmin);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ flastspeed = pnew->speed();
|
|
|
+ flastx = pnew->gps_x();
|
|
|
+ flasty = pnew->gps_y();
|
|
|
+ }
|
|
|
if(j>1000)break;
|
|
|
}
|
|
|
|