2020# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121# SOFTWARE.
2222
23- from typing import Type
24-
2523import numpy as np
2624from kiss_icp .config import KISSConfig
2725from kiss_icp .kiss_icp import KissICP , get_registration
2826
2927from mapmos .config import DataConfig , OdometryConfig
3028from mapmos .mapping import VoxelHashMap
29+ from mapmos .pybind import mapmos_pybind
3130from mapmos .registration import get_registration
3231
3332
@@ -61,10 +60,7 @@ def __init__(
6160
6261 def register_points (self , points , timestamps , scan_index ):
6362 # Apply motion compensation
64- points = self .compensator .deskew_scan (points , timestamps , self .last_delta )
65-
66- # Preprocess the input cloud
67- points_prep = self .preprocess (points )
63+ points_prep = self .preprocessor .preprocess (points , timestamps , self .last_delta )
6864
6965 # Voxelize
7066 source , points_downsample = self .voxelize (points_prep )
@@ -83,6 +79,8 @@ def register_points(self, points, timestamps, scan_index):
8379 kernel = sigma / 3 ,
8480 )
8581
82+ point_deskewed = self .deskew (points , timestamps , self .last_delta )
83+
8684 # Compute the difference between the prediction and the actual estimate
8785 model_deviation = np .linalg .inv (initial_guess ) @ new_pose
8886
@@ -92,17 +90,29 @@ def register_points(self, points, timestamps, scan_index):
9290 self .last_delta = np .linalg .inv (self .last_pose ) @ new_pose
9391 self .last_pose = new_pose
9492
95- points_reg = self .transform (points , self .last_pose )
96- return np .asarray (points_reg )
93+ return self .transform (point_deskewed , self .last_pose )
9794
9895 def get_map_points (self ):
9996 map_points , map_timestamps = self .local_map .point_cloud_with_timestamps ()
10097 return map_points .reshape (- 1 , 3 ), map_timestamps .reshape (- 1 , 1 )
10198
99+ def current_location (self ):
100+ return self .last_pose [:3 , 3 ]
101+
102102 def transform (self , points , pose ):
103103 points_hom = np .hstack ((points , np .ones ((len (points ), 1 ))))
104104 points = (pose @ points_hom .T ).T [:, :3 ]
105105 return points
106106
107- def current_location (self ):
108- return self .last_pose [:3 , 3 ]
107+ def deskew (self , points , timestamps , relative_motion ):
108+ return (
109+ np .asarray (
110+ mapmos_pybind ._deskew (
111+ frame = mapmos_pybind ._Vector3dVector (points ),
112+ timestamps = timestamps ,
113+ relative_motion = relative_motion ,
114+ )
115+ )
116+ if self .config .data .deskew
117+ else points
118+ )
0 commit comments