kewlbear / Open3D-iOS

Swift package for using Open3D in iOS apps
MIT License
63 stars 34 forks source link

When some error occurs.. #37

Closed HeoJinLareine closed 2 years ago

HeoJinLareine commented 2 years ago

Thanks to you, I'm happily running open3d on iOS. But in some methods of open3d, returns nil value. In python, I handle this with.. "try - except" phrase. How can I make same error handling in Open3D-iOS, actually in pythonKit?

kewlbear commented 2 years ago

You should check for nil using guard or if for those methods.

HeoJinLareine commented 2 years ago

Yes, But the thing is that when I've tried that, It couldn't be guard let.. or if variable != nil.. Error comes out that PythonObject is try! object, so it couldn't be nil.

HeoJinLareine commented 2 years ago

When I use .. [o3d.pipelines.registration.registration_colored_icp] this methods, and when results has no correspondence...

PythonKit/Python.swift:598: Fatal error: 'try!' expression unexpectedly raised an error: Python exception: [Open3D Error] (virtual Eigen::Matrix4d open3d::pipelines::registration::TransformationEstimationForColoredICP::ComputeTransformation(const geometry::PointCloud &, const geometry::PointCloud &, const open3d::pipelines::registration::CorrespondenceSet &) const) /Users/runner/work/Open3D-iOS/Open3D-iOS/Open3D/cpp/open3d/pipelines/registration/ColoredICP.cpp:124: No correspondences found between source and target pointcloud.  2022-04-20 14:15:32.856663+0900 InnoScan[48440:12541993] PythonKit/Python.swift:598: Fatal error: 'try!' expression unexpectedly raised an error: Python exception: \^[[1;31m[Open3D Error] (virtual Eigen::Matrix4d open3d::pipelines::registration::TransformationEstimationForColoredICP::ComputeTransformation(const geometry::PointCloud &, const geometry::PointCloud &, const open3d::pipelines::registration::CorrespondenceSet &) const) /Users/runner/work/Open3D-iOS/Open3D-iOS/Open3D/cpp/open3d/pipelines/registration/ColoredICP.cpp:124: No correspondences found between source and target pointcloud. \^[[0;m

This error comes up.

HeoJinLareine commented 2 years ago

I've made it worked with let - try, thank's to you!