2525from kiss_icp .kiss_icp import KissICP
2626
2727from mos4d .config import DataConfig , OdometryConfig
28+ from mos4d .pybind import mos4d_pybind
2829
2930
3031def parse_config (config_data : DataConfig , config_odometry : OdometryConfig ):
@@ -50,10 +51,7 @@ def __init__(
5051
5152 def register_points (self , points , timestamps , scan_index ):
5253 # Apply motion compensation
53- points = self .compensator .deskew_scan (points , timestamps , self .last_delta )
54-
55- # Preprocess the input cloud
56- points_prep = self .preprocess (points )
54+ points_prep = self .preprocessor .preprocess (points , timestamps , self .last_delta )
5755
5856 # Voxelize
5957 source , points_downsample = self .voxelize (points_prep )
@@ -72,6 +70,8 @@ def register_points(self, points, timestamps, scan_index):
7270 kernel = sigma / 3 ,
7371 )
7472
73+ point_deskewed = self .deskew (points , timestamps , self .last_delta )
74+
7575 # Compute the difference between the prediction and the actual estimate
7676 model_deviation = np .linalg .inv (initial_guess ) @ new_pose
7777
@@ -81,14 +81,26 @@ def register_points(self, points, timestamps, scan_index):
8181 self .last_delta = np .linalg .inv (self .last_pose ) @ new_pose
8282 self .last_pose = new_pose
8383
84- points_reg = self .transform (points , self .last_pose )
85- return np .asarray (points_reg )
84+ return self .transform (point_deskewed , self .last_pose )
8685
8786 def transform (self , points , pose ):
8887 points_hom = np .hstack ((points , np .ones ((len (points ), 1 ))))
8988 points = (pose @ points_hom .T ).T [:, :3 ]
9089 return points
9190
91+ def deskew (self , points , timestamps , relative_motion ):
92+ return (
93+ np .asarray (
94+ mos4d_pybind ._deskew (
95+ frame = mos4d_pybind ._Vector3dVector (points ),
96+ timestamps = timestamps ,
97+ relative_motion = relative_motion ,
98+ )
99+ )
100+ if self .config .data .deskew
101+ else points
102+ )
103+
92104 def current_pose (self ):
93105 return self .last_pose
94106
0 commit comments