Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kissualizer Update: Inspection Mode and more Keybindings #390

Open
wants to merge 64 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
164eb9f
Merge pull request #2 from PRBonn/main
l00p3 Jul 26, 2024
5d75de3
Visualizer initialized
l00p3 Jul 26, 2024
d071d41
Simple buttons added
l00p3 Jul 26, 2024
caa7f1a
Almost done
l00p3 Jul 26, 2024
ff61af6
Center viewpoint option
l00p3 Jul 26, 2024
502ea17
Better static member management
l00p3 Jul 26, 2024
133e21a
Better palette and global view
l00p3 Jul 26, 2024
0d03ca7
Global View is not switchable standing
l00p3 Jul 26, 2024
a5c63ad
Arrows on trajectory
l00p3 Jul 26, 2024
addcbec
Slight beautification of arrows
l00p3 Jul 26, 2024
18725e2
Global points dimensions
l00p3 Jul 26, 2024
802ae40
Trajectory not invisible but actually not there in local mode
l00p3 Jul 26, 2024
089bd1b
Some TODO todo
l00p3 Jul 26, 2024
bd92e91
Refactor code, palette changed, trajectory swithc in global fixed
l00p3 Jul 29, 2024
8fb9c71
Some separator
l00p3 Jul 29, 2024
d0f9d0b
Points size sliders
l00p3 Jul 29, 2024
f2c270e
Better viewpoint centering
l00p3 Jul 29, 2024
fff0f79
Screenshot demo added
l00p3 Jul 29, 2024
27b4c17
Some button key added
l00p3 Jul 29, 2024
0dae3d0
Fixed DEBUG name window
l00p3 Jul 29, 2024
42c3a16
Parameters visualization and fps added
l00p3 Jul 30, 2024
a189757
Center viewpoint improved
l00p3 Jul 30, 2024
9ed426b
Trajectory un-registration for better bounding box
l00p3 Jul 30, 2024
60236f4
Color palette changed again
l00p3 Jul 30, 2024
62d756d
Some cleaning
l00p3 Jul 30, 2024
fbdef70
Button name with keys and missing keys added
l00p3 Jul 31, 2024
bed3c91
Embrace Benedikt's colors and fix typo
l00p3 Jul 31, 2024
d289e53
Fix Palette and quantity size
tizianoGuadagnino Aug 1, 2024
4ae44c0
Fix license
tizianoGuadagnino Aug 1, 2024
64b1cc0
Color approved by Gupta
tizianoGuadagnino Aug 1, 2024
877f43f
Now everything is member of Kissualizer
l00p3 Aug 2, 2024
34b7e71
Trajectory as points, not anymore a curve
l00p3 Aug 2, 2024
14825d0
Screenshot name with timestamp
l00p3 Aug 2, 2024
07d42e6
Style fix
l00p3 Aug 2, 2024
c676763
Button names constants less ugly
l00p3 Aug 2, 2024
3db2af5
Now we have a dict to visualize parameters and co
l00p3 Aug 2, 2024
5e3688f
FPS computation not anymore in visualizer class
l00p3 Aug 2, 2024
58bf027
isort ti odio
l00p3 Aug 2, 2024
bdeb70e
Odometry info is now open by default
l00p3 Aug 2, 2024
492d296
Quit button on the right, why not
l00p3 Aug 2, 2024
257551d
Pose picking started
l00p3 Aug 2, 2024
285d744
Pose selection and visualization on the trajectory
l00p3 Aug 2, 2024
71c2c0d
Voxel Grid added but still improvable
l00p3 Aug 6, 2024
b0c5847
TODO
l00p3 Aug 6, 2024
07929cb
Other TODOs
l00p3 Aug 6, 2024
f98daba
Analysis tab added
l00p3 Aug 7, 2024
9e46097
Target map -> Local map
l00p3 Aug 7, 2024
acfbc5a
Ortho mode added but incomplete
l00p3 Aug 7, 2024
094100b
Orthographic fixed and probably better voxel computations
l00p3 Aug 8, 2024
3dc8215
Keybindings added for toggles
l00p3 Aug 8, 2024
a55e218
Small update on pose selection
l00p3 Aug 8, 2024
89a59b4
Removed screenshots
l00p3 Aug 8, 2024
b6c7bc7
Gitignore update to avoid screenshots
l00p3 Aug 8, 2024
8514868
Typo fix
l00p3 Aug 8, 2024
0c8c77e
Do not reset camera view if not previously in ortho
l00p3 Aug 8, 2024
71122f6
Merge branch 'main' into luca-new-visualizer
l00p3 Aug 8, 2024
3dfcde1
Style check update
l00p3 Aug 8, 2024
3282b8b
Merge branch 'main' into luca-new-visualizer
l00p3 Aug 9, 2024
84d48df
Ortho removed
l00p3 Aug 9, 2024
fb58840
Started branch to visualize associations
l00p3 Aug 9, 2024
535cac8
Correspondences visualized
l00p3 Aug 9, 2024
1a19e86
Removed unused attributes
l00p3 Aug 9, 2024
60cfb1f
Some cleaning on voxels code
l00p3 Aug 9, 2024
6343354
Style fix
l00p3 Aug 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ _skbuild/
.gitlab-ci-local/
.polyscope.ini
imgui.ini
kisshot_*

# Created by https://www.toptal.com/developers/gitignore/api/python,c++
# Edit at https://www.toptal.com/developers/gitignore?templates=python,c++
Expand Down
4 changes: 2 additions & 2 deletions cpp/kiss_icp/core/Registration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ Sophus::SE3d Registration::AlignPointsToMap(const std::vector<Eigen::Vector3d> &
Sophus::SE3d T_icp = Sophus::SE3d();
for (int j = 0; j < max_num_iterations_; ++j) {
// Equation (10)
const auto correspondences = DataAssociation(source, voxel_map, max_distance);
last_correspondences_ = DataAssociation(source, voxel_map, max_distance);
// Equation (11)
const auto &[JTJ, JTr] = BuildLinearSystem(correspondences, kernel_scale);
const auto &[JTJ, JTr] = BuildLinearSystem(last_correspondences_, kernel_scale);
const Eigen::Vector6d dx = JTJ.ldlt().solve(-JTr);
const Sophus::SE3d estimation = Sophus::SE3d::exp(dx);
// Equation (12)
Expand Down
3 changes: 3 additions & 0 deletions cpp/kiss_icp/core/Registration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

#include "VoxelHashMap.hpp"

using Correspondences = std::vector<std::pair<Eigen::Vector3d, Eigen::Vector3d>>;

namespace kiss_icp {

struct Registration {
Expand All @@ -42,5 +44,6 @@ struct Registration {
int max_num_iterations_;
double convergence_criterion_;
int max_num_threads_;
Correspondences last_correspondences_;
};
} // namespace kiss_icp
8 changes: 8 additions & 0 deletions cpp/kiss_icp/core/VoxelHashMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ std::vector<Eigen::Vector3d> VoxelHashMap::Pointcloud() const {
return points;
}

// Get the indices of the occupided voxels as points, mainly used for visualization
std::vector<Voxel> VoxelHashMap::GetVoxels() const {
std::vector<Voxel> voxels(map_.size());
std::transform(map_.cbegin(), map_.cend(), voxels.begin(),
[](const auto &map_element) { return map_element.first; });
return voxels;
}

void VoxelHashMap::Update(const std::vector<Eigen::Vector3d> &points,
const Eigen::Vector3d &origin) {
AddPoints(points);
Expand Down
1 change: 1 addition & 0 deletions cpp/kiss_icp/core/VoxelHashMap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ struct VoxelHashMap {
void AddPoints(const std::vector<Eigen::Vector3d> &points);
void RemovePointsFarFromLocation(const Eigen::Vector3d &origin);
std::vector<Eigen::Vector3d> Pointcloud() const;
std::vector<Voxel> GetVoxels() const;
std::tuple<Eigen::Vector3d, double> GetClosestNeighbor(const Eigen::Vector3d &query) const;

double voxel_size_;
Expand Down
4 changes: 4 additions & 0 deletions python/kiss_icp/mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,7 @@ def remove_far_away_points(self, origin):
def point_cloud(self) -> np.ndarray:
"""Return the internal representaion as a np.array (pointcloud)."""
return np.asarray(self._internal_map._point_cloud())

def get_voxels(self) -> np.ndarray:
"""Return the occupied voxels, in indices (i,j,k) as a np.array."""
return np.asarray(self._internal_map._get_voxels())
5 changes: 3 additions & 2 deletions python/kiss_icp/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ def __init__(
self._vis_infos = {
"max_range": self.config.data.max_range,
"min_range": self.config.data.min_range,
"voxel_size": self.config.mapping.voxel_size,
}
self.visualizer.set_voxel_size(self.config.mapping.voxel_size)
if hasattr(self._dataset, "use_global_visualizer"):
self.visualizer._global_view = self._dataset.use_global_visualizer

Expand Down Expand Up @@ -109,8 +111,7 @@ def _run_pipeline(self):
self.visualizer.update(
source,
keypoints,
self.odometry.local_map,
self.odometry.last_pose,
self.odometry,
self._vis_infos,
)

Expand Down
6 changes: 4 additions & 2 deletions python/kiss_icp/pybind/kiss_icp_pybind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ PYBIND11_MODULE(kiss_icp_pybind, m) {
"points"_a, "pose"_a)
.def("_add_points", &VoxelHashMap::AddPoints, "points"_a)
.def("_remove_far_away_points", &VoxelHashMap::RemovePointsFarFromLocation, "origin"_a)
.def("_point_cloud", &VoxelHashMap::Pointcloud);
.def("_point_cloud", &VoxelHashMap::Pointcloud)
.def("_get_voxels", &VoxelHashMap::GetVoxels);

// Point Cloud registration
py::class_<Registration> internal_registration(m, "_Registration", "Don't use this");
Expand All @@ -91,7 +92,8 @@ PYBIND11_MODULE(kiss_icp_pybind, m) {
.matrix();
},
"points"_a, "voxel_map"_a, "initial_guess"_a, "max_correspondance_distance"_a,
"kernel"_a);
"kernel"_a)
.def("_get_correspondences", [](Registration &self) { return self.last_correspondences_; });

// AdaptiveThreshold bindings
py::class_<AdaptiveThreshold> adaptive_threshold(m, "_AdaptiveThreshold", "Don't use this");
Expand Down
3 changes: 3 additions & 0 deletions python/kiss_icp/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,6 @@ def align_points_to_map(
max_correspondance_distance=max_correspondance_distance,
kernel=kernel,
)

def get_correspondences(self) -> np.ndarray:
return self._registration._get_correspondences()
Loading
Loading