Skip to content

Commit

Permalink
Kissualizer: a new KISS-ICP visualizer! (#379)
Browse files Browse the repository at this point in the history
* Visualizer initialized

* Simple buttons added

* Almost done

* Center viewpoint option

* Better static member management

* Better palette and global view

* Global View is not switchable standing

* Arrows on trajectory

* Slight beautification of arrows

* Global points dimensions

* Trajectory not invisible but actually not there in local mode

* Some TODO todo

* Refactor code, palette changed, trajectory swithc in global fixed

* Some separator

* Points size sliders

* Better viewpoint centering

* Screenshot demo added

* Some button key added

* Fixed DEBUG name window

* Parameters visualization and fps added

* Center viewpoint improved

* Trajectory un-registration for better bounding box

* Color palette changed again

* Some cleaning

* Button name with keys and missing keys added

* Embrace Benedikt's colors and fix typo

* Fix Palette and quantity size

* Fix license

* Color approved by Gupta

* Now everything is member of Kissualizer

* Trajectory as points, not anymore a curve

* Screenshot name with timestamp

* Style fix

* Button names constants less ugly

* Now we have a dict to visualize parameters and co

* FPS computation not anymore in visualizer class

* isort ti odio

* Odometry info is now open by default

* Quit button on the right, why not

* Pose picking started

* Pose selection and visualization on the trajectory

---------

Co-authored-by: tizianoGuadagnino <[email protected]>
  • Loading branch information
l00p3 and tizianoGuadagnino committed Aug 6, 2024
1 parent 12905ec commit f27ced4
Show file tree
Hide file tree
Showing 4 changed files with 268 additions and 197 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ results/
wheelhouse/
_skbuild/
.gitlab-ci-local/
.polyscope.ini
imgui.ini

# Created by https://www.toptal.com/developers/gitignore/api/python,c++
# Edit at https://www.toptal.com/developers/gitignore?templates=python,c++
Expand Down
30 changes: 21 additions & 9 deletions python/kiss_icp/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
from kiss_icp.metrics import absolute_trajectory_error, sequence_error
from kiss_icp.tools.pipeline_results import PipelineResults
from kiss_icp.tools.progress_bar import get_progress_bar
from kiss_icp.tools.visualizer import RegistrationVisualizer, StubVisualizer
from kiss_icp.tools.visualizer import Kissualizer, StubVisualizer


class OdometryPipeline:
Expand Down Expand Up @@ -76,9 +76,13 @@ def __init__(
)

# Visualizer
self.visualizer = RegistrationVisualizer() if visualize else StubVisualizer()
self.visualizer = Kissualizer() if visualize else StubVisualizer()
self._vis_infos = {
"max_range": self.config.data.max_range,
"min_range": self.config.data.min_range,
}
if hasattr(self._dataset, "use_global_visualizer"):
self.visualizer.global_view = self._dataset.use_global_visualizer
self.visualizer._global_view = self._dataset.use_global_visualizer

# Public interface ------
def run(self):
Expand All @@ -99,8 +103,15 @@ def _run_pipeline(self):
source, keypoints = self.odometry.register_frame(raw_frame, timestamps)
self.poses[idx - self._first] = self.odometry.last_pose
self.times[idx - self._first] = time.perf_counter_ns() - start_time

# Udate visualizer
self._vis_infos["FPS"] = int(np.floor(self._get_fps()))
self.visualizer.update(
source, keypoints, self.odometry.local_map, self.odometry.last_pose
source,
keypoints,
self.odometry.local_map,
self.odometry.last_pose,
self._vis_infos,
)

def _next(self, idx):
Expand Down Expand Up @@ -169,6 +180,11 @@ def _write_gt_poses(self):
timestamps=self._get_frames_timestamps(),
)

def _get_fps(self):
times_nozero = self.times[self.times != 0]
total_time_s = np.sum(times_nozero) * 1e-9
return float(times_nozero.shape[0] / total_time_s) if total_time_s > 0 else 0

def _run_evaluation(self):
# Run estimation metrics evaluation, only when GT data was provided
if self.has_gt:
Expand All @@ -180,11 +196,7 @@ def _run_evaluation(self):
self.results.append(desc="Absolute Rotational Error (ARE)", units="rad", value=ate_rot)

# Run timing metrics evaluation, always
def _get_fps():
total_time_s = np.sum(self.times) * 1e-9
return float(self._n_scans / total_time_s) if total_time_s > 0 else 0

fps = _get_fps()
fps = self._get_fps()
avg_fps = int(np.floor(fps))
avg_ms = int(np.ceil(1e3 / fps)) if fps > 0 else 0
if avg_fps > 0:
Expand Down
Loading

0 comments on commit f27ced4

Please sign in to comment.