ivif_localplan.cpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #include "ivif_localplan.h"
  2. #include "adc_tools/transfer.h"
  3. ivif_localplan::ivif_localplan()
  4. {
  5. }
  6. ivif_localplan::~ivif_localplan()
  7. {
  8. }
  9. std::vector<iv::Point2D> ivif_localplan::GetLocalPlan(iv::GPS_INS now_gps_ins,int nPathPointIndex ,double fSpeed,std::vector<iv::GPSData> gpsMapLine,
  10. iv::LidarGridPtr lidarGridPtr)
  11. {
  12. (void)nPathPointIndex;
  13. (void)gpsMapLine;
  14. (void)lidarGridPtr;
  15. std::vector<iv::Point2D> xvectorlocal;
  16. xvectorlocal.clear();
  17. double fPreviewDistance = 100.0;
  18. if(nPathPointIndex<0)
  19. {
  20. return xvectorlocal;
  21. }
  22. int nsize = static_cast<int>( gpsMapLine.size());
  23. int i;
  24. iv::Point2D ptnow = iv::decition::Coordinate_Transfer(gpsMapLine[static_cast<unsigned int>(nPathPointIndex)]->gps_x,gpsMapLine[static_cast<unsigned int>(nPathPointIndex)]->gps_y, now_gps_ins);
  25. xvectorlocal.push_back(ptnow);
  26. double s = 0;
  27. for(i=(nPathPointIndex+1);i<nsize;i++)
  28. {
  29. iv::Point2D pt = iv::decition::Coordinate_Transfer(gpsMapLine[static_cast<unsigned int>(i)]->gps_x,gpsMapLine[static_cast<unsigned int>(i)]->gps_y, now_gps_ins);
  30. s = s + sqrt(pow(pt.y - xvectorlocal[xvectorlocal.size() -1].y,2)+pow(pt.x - xvectorlocal[xvectorlocal.size()-1].x,2));
  31. if(s<fPreviewDistance)
  32. xvectorlocal.push_back(pt);
  33. else
  34. break;
  35. }
  36. return xvectorlocal;
  37. }