Skip to content

Commit

Permalink
realtime mode is now adaptive to sensor freq
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoBrizi committed Sep 11, 2024
1 parent 0784d80 commit 60511d1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 1 addition & 2 deletions mad_icp/apps/mad_icp.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ def main(data_path: Annotated[
visualizer = Visualizer()

reader_type = InputDataInterface.kitti
print(data_path)
print(list(data_path.glob("*.db3")))

if len(list(data_path.glob("*.bag"))) != 0:
console.print("[yellow] The dataset is in ros bag format")
reader_type = InputDataInterface.ros1
Expand Down
3 changes: 2 additions & 1 deletion mad_icp/src/odometry/pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Pipeline::Pipeline(double sensor_hz,
seq_keyframe_ = 0;
is_initialized_ = false;
is_map_updated_ = false;
loop_time = (1. / sensor_hz_) * 1000;

max_parallel_levels_ = static_cast<int>(std::log2(num_threads));
omp_set_num_threads(num_threads);
Expand Down Expand Up @@ -163,7 +164,7 @@ void Pipeline::compute(const double& curr_stamp, ContainerType curr_cloud_mem) {
struct timeval icp_start, icp_end, icp_delta;

for (size_t icp_iteration = 0; icp_iteration < MAX_ICP_ITS; ++icp_iteration) {
const float remaining_time = 90.0 - (preprocessing_time + total_icp_time + icp_time);
const float remaining_time = loop_time - 5.0 - (preprocessing_time + total_icp_time + icp_time);
if (realtime_ && remaining_time < 0)
break;

Expand Down
1 change: 1 addition & 0 deletions mad_icp/src/odometry/pipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,5 @@ class Pipeline {
size_t seq_keyframe_;
bool is_initialized_;
bool is_map_updated_;
float loop_time;
};

0 comments on commit 60511d1

Please sign in to comment.