Skip to content

Commit

Permalink
add mapping tools for standard viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
koide3 committed Oct 8, 2024
1 parent 857a86d commit 86f11dd
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/glim/viewer/standard_viewer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ class StandardViewer : public ExtensionModule {
std::vector<std::pair<boost::weak_ptr<gtsam::NonlinearFactor>, FactorLineGetter>> odometry_factor_lines;
std::unordered_map<std::uint64_t, Eigen::Isometry3f> odometry_poses;

bool show_mapping_tools;
float min_overlap;

double point_size;
bool point_size_metric;
bool point_shape_circle;
Expand Down
23 changes: 23 additions & 0 deletions src/glim/viewer/standard_viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ StandardViewer::StandardViewer() : logger(create_module_logger("viewer")) {
z_range = config.param("standard_viewer", "default_z_range", Eigen::Vector2d(-2.0, 4.0)).cast<float>();
auto_z_range << 0.0f, 0.0f;

show_mapping_tools = false;
min_overlap = 0.2f;

points_alpha = config.param("standard_viewer", "points_alpha", 1.0);
factors_alpha = config.param("standard_viewer", "factors_alpha", 1.0);

Expand Down Expand Up @@ -730,6 +733,11 @@ void StandardViewer::drawable_selection() {
show_submaps = show_factors = show_mapping;
}

ImGui::SameLine();
if (ImGui::Button("Tools")) {
show_mapping_tools = true;
}

ImGui::Checkbox("submaps", &show_submaps);
ImGui::SameLine();
ImGui::Checkbox("factors", &show_factors);
Expand All @@ -750,6 +758,21 @@ void StandardViewer::drawable_selection() {
ImGui::Text("bias:%.3f %.3f %.3f %.3f %.3f %.3f", last_imu_bias[0], last_imu_bias[1], last_imu_bias[2], last_imu_bias[3], last_imu_bias[4], last_imu_bias[5]);
ImGui::End();
}

if (show_mapping_tools) {
ImGui::Begin("mapping tools", &show_mapping_tools, ImGuiWindowFlags_AlwaysAutoResize);
ImGui::DragFloat("Min overlap", &min_overlap, 0.01f, 0.01f, 1.0f);
if (ImGui::Button("Find overlapping submaps")) {
logger->info("finding overlapping submaps...");
GlobalMappingCallbacks::request_to_find_overlapping_submaps(min_overlap);
}

if (ImGui::Button("Optimize")) {
logger->info("optimizing...");
GlobalMappingCallbacks::request_to_optimize();
}
ImGui::End();
}
}
} // namespace glim

Expand Down

0 comments on commit 86f11dd

Please sign in to comment.