Commit 27de9ea2 authored by limingbo's avatar limingbo

test

parent 390d06a0
Pipeline #861 canceled with stages
...@@ -81,7 +81,7 @@ vector<string> getCrossTasks( ...@@ -81,7 +81,7 @@ vector<string> getCrossTasks(
trajectories.push_back(currTraj); trajectories.push_back(currTraj);
vector<PointCloudExport::Ptr> pointClouds vector<PointCloudExport::Ptr> pointClouds
= multiThreadGetPointCloud(trajectories); = multiThreadGetPointCloud(trajectories, currTraj->getProj());
float resolution = 5.f; float resolution = 5.f;
pcl::octree::OctreePointCloudSearch<PointExport> octree(resolution); pcl::octree::OctreePointCloudSearch<PointExport> octree(resolution);
...@@ -133,7 +133,8 @@ void initTrajectory( ...@@ -133,7 +133,8 @@ void initTrajectory(
} }
vector<PointCloudExport::Ptr> multiThreadGetPointCloud( vector<PointCloudExport::Ptr> multiThreadGetPointCloud(
vector<boost::shared_ptr<Trajectory>> &trajectories) vector<boost::shared_ptr<Trajectory>> &trajectories,
boost::shared_ptr<LocalCartesian> proj)
{ {
vector<ThreadPtr> thread_vec; vector<ThreadPtr> thread_vec;
vector<PointCloudExport::Ptr> pointClouds; vector<PointCloudExport::Ptr> pointClouds;
...@@ -141,6 +142,7 @@ vector<PointCloudExport::Ptr> multiThreadGetPointCloud( ...@@ -141,6 +142,7 @@ vector<PointCloudExport::Ptr> multiThreadGetPointCloud(
for(uint8_t thread_index = 0; thread_index < trajectories.size(); thread_index++){ for(uint8_t thread_index = 0; thread_index < trajectories.size(); thread_index++){
thread_vec.emplace_back(ThreadPtr(new boost::thread(boost::bind(&getPointCloud, thread_vec.emplace_back(ThreadPtr(new boost::thread(boost::bind(&getPointCloud,
proj,
trajectories[thread_index], trajectories[thread_index],
pointClouds[thread_index])))); pointClouds[thread_index]))));
} }
...@@ -151,7 +153,7 @@ vector<PointCloudExport::Ptr> multiThreadGetPointCloud( ...@@ -151,7 +153,7 @@ vector<PointCloudExport::Ptr> multiThreadGetPointCloud(
return pointClouds; return pointClouds;
} }
void getPointCloud( void getPointCloud(boost::shared_ptr<LocalCartesian> proj,
boost::shared_ptr<Trajectory> &trajectory, boost::shared_ptr<Trajectory> &trajectory,
PointCloudExport::Ptr& pointCloud) PointCloudExport::Ptr& pointCloud)
{ {
...@@ -161,9 +163,15 @@ void getPointCloud( ...@@ -161,9 +163,15 @@ void getPointCloud(
vector<TrajPoint> traj = trajectory->getTrajectory(); vector<TrajPoint> traj = trajectory->getTrajectory();
for(const TrajPoint& trajPoint : traj){ for(const TrajPoint& trajPoint : traj){
PointExport point; PointExport point;
point.x = trajPoint.translation.x(); Vector3d llh = trajectory->reverse(trajPoint);
point.y = trajPoint.translation.y(); Vector3d translation;
point.z = trajPoint.translation.z(); proj->Forward(llh.x(),llh.y(),llh.x(),
translation.x(),
translation.y(),
translation.z());
point.x = translation.x();
point.y = translation.y();
point.z = translation.z();
pointCloud->push_back(point); pointCloud->push_back(point);
} }
} }
...@@ -24,9 +24,11 @@ void initTrajectory(const string &iePath, ...@@ -24,9 +24,11 @@ void initTrajectory(const string &iePath,
boost::shared_ptr<Trajectory> &trajectory); boost::shared_ptr<Trajectory> &trajectory);
vector<PointCloudExport::Ptr> multiThreadGetPointCloud( vector<PointCloudExport::Ptr> multiThreadGetPointCloud(
vector<boost::shared_ptr<Trajectory> > &trajectories); vector<boost::shared_ptr<Trajectory> > &trajectories,
boost::shared_ptr<LocalCartesian> proj);
void getPointCloud( void getPointCloud(
boost::shared_ptr<LocalCartesian> proj,
boost::shared_ptr<Trajectory> &trajectory, boost::shared_ptr<Trajectory> &trajectory,
PointCloudExport::Ptr& pointCloud); PointCloudExport::Ptr& pointCloud);
#endif // MULTI_TRAJ_FUNCTIONS_H #endif // MULTI_TRAJ_FUNCTIONS_H
...@@ -261,6 +261,16 @@ boost::shared_ptr<LocalCartesian> Trajectory::getProj() const ...@@ -261,6 +261,16 @@ boost::shared_ptr<LocalCartesian> Trajectory::getProj() const
return proj_; return proj_;
} }
Vector3d Trajectory::reverse(const TrajPoint &trajPoint)
{
Vector3d llh;
proj_->Reverse(trajPoint.translation.x(),
trajPoint.translation.y(),
trajPoint.translation.z(),
llh.x(),llh.y(),llh.x());
return llh;
}
double Trajectory::getFrequency() double Trajectory::getFrequency()
{ {
return frequency_; return frequency_;
......
...@@ -41,6 +41,8 @@ public: ...@@ -41,6 +41,8 @@ public:
boost::shared_ptr<LocalCartesian> getProj() const; boost::shared_ptr<LocalCartesian> getProj() const;
Vector3d reverse(const TrajPoint& trajPoint);
double getFrequency(); double getFrequency();
private: private:
bool checkSatisfied(const int32_t &supposed_floor_index, const double &timestamp) const; bool checkSatisfied(const int32_t &supposed_floor_index, const double &timestamp) const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment