Skip to content

Commit a422e7d

Browse files
authored
Print mapping output errors in sai-cli (#24)
* Print mapping output errors in sai-cli * Better error msg
1 parent 3873f45 commit a422e7d

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

python/cli/process/process.py

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def define_subparser(subparsers):
3232
return define_args(sub)
3333

3434
def interpolate_missing_properties(df_source, df_query, k_nearest=3):
35+
import pandas as pd
3536
from scipy.spatial import KDTree
3637
xyz = list('xyz')
3738

@@ -271,17 +272,7 @@ def post_process_point_clouds(globalPointCloud, sparse_point_cloud_df):
271272

272273
return merged_df
273274

274-
def onVioOutput(vioOutput):
275-
nonlocal visualizer, isTracking
276-
wasTracking = isTracking
277-
isTracking = vioOutput.status == spectacularAI.TrackingStatus.TRACKING
278-
if wasTracking and not isTracking:
279-
print('warning: Lost tracking!')
280-
281-
if visualizer is not None:
282-
visualizer.onVioOutput(vioOutput.getCameraPose(0), status=vioOutput.status)
283-
284-
def onMappingOutput(output):
275+
def processMappingOutput(output):
285276
nonlocal savedKeyFrames
286277
nonlocal pointClouds
287278
nonlocal sparsePointColors
@@ -485,6 +476,23 @@ def write_colmap_csv(data, fn):
485476

486477
finalMapWritten = True
487478

479+
def onVioOutput(vioOutput):
480+
nonlocal visualizer, isTracking
481+
wasTracking = isTracking
482+
isTracking = vioOutput.status == spectacularAI.TrackingStatus.TRACKING
483+
if wasTracking and not isTracking:
484+
print('warning: Lost tracking!')
485+
486+
if visualizer is not None:
487+
visualizer.onVioOutput(vioOutput.getCameraPose(0), status=vioOutput.status)
488+
489+
def onMappingOutput(output):
490+
try:
491+
processMappingOutput(output)
492+
except Exception as e:
493+
print(f"ERROR: {e}", flush=True)
494+
raise e
495+
488496
def copy_input_to_tmp_safe(input_dir, tmp_input):
489497
# also works if tmp dir is inside the input directory
490498
os.makedirs(tmp_input, exist_ok=True)

0 commit comments

Comments
 (0)