vectr-ucla / direct_lidar_inertial_odometry

[IEEE ICRA'23] A new lightweight LiDAR-inertial odometry algorithm with a novel coarse-to-fine approach in constructing continuous-time trajectories for precise motion correction.
MIT License
616 stars 123 forks source link

base PCD map location? #70

Open lonlonago opened 2 months ago

lonlonago commented 2 months ago

If we have a PCD map, can we use this code to make a location based on the PCD map?

If possible, how do we need to modify this code

kennyjchen commented 1 month ago

You can essentially edit the code so that it loads in a PCD, sets it as the first (and only) keyframe, and disables tracking of subsequent keyframes.

lonlonago commented 1 month ago

Thank you very much for your reply! Yes, I did, but the odometer kept jumping and reported an error after running for a short period of time. The error message:

Terminate called after throwing an instance of 'ros::serialization::StreamOverrunException'

here is my code change:

`

void dlio::OdomNode::buildSubmap(State vehicle_state) { // submap to whole map test pcl::PointCloud::Ptr tmp_map_cloud (boost::make_shared<pcl::PointCloud>());

pcl::io::loadPCDFile("/home/lan/ouster_zijin.pcd", *tmp_map_cloud); this->gicp_temp.setInputTarget(tmp_map_cloud);

this->submap_kdtree = this->gicp_temp.targetkdtree; this->submap_cloud = tmp_map_cloud; this->submap_normals = this->gicp_temp.getTargetCovariances(); // getTargetCovariances this->submap_kf_idx_prev = this->submap_kf_idx_curr; }

`

only build submap use once here

`

// Set initial frame as first keyframe if (this->keyframes.size() == 0) { this->initializeInputTarget(); this->main_loop_running = false; this->submap_future = std::async( std::launch::async, &dlio::OdomNode::buildKeyframesAndSubmap, this, this->state ); this->buildSubmap(this->state); // only build submap use once here

this->submap_future.wait(); // wait until completion
return;

} `

Thank you very much for taking the time to review this code and problem