microsoft / azure_spatial_anchors_ros

ROS wrapper for the Azure Spatial Anchors Linux SDK, allowing robots (and other devices with vision-based sensors) to co-localize with other robots, AR-enabled phones, and Hololens devices.
https://azure.microsoft.com/en-us/services/spatial-anchors/
MIT License
87 stars 20 forks source link

Validate the focal lengths reported by camera_info #13

Closed EricVoll closed 3 years ago

EricVoll commented 3 years ago

This PR warns the user if the camera_info topic reports focal lenghts of zero in the camera_info topic, which results in an Error 400 down the road when trying to create anchors, since the ASA backend can (of course) not handle unkown camera intrinsics.

If you feel like this is not necessary since this is a responsibility of the user, please go ahead and delete this PR.

jeffdelmerico commented 3 years ago

If you're going to check the camera parameters, I think it makes sense to check the height, width, and principal points as well. I think checking that all are >0 should catch NaNs too.

EricVoll commented 3 years ago

You are right about the height and width of the image. But I did not check the principal point because theoretically it can be zero. That might not happen often in practice though.

jeffdelmerico commented 3 years ago

Fair point. You might (in very rare circumstances) have principal point coordinates of 0, but I don't think it's possible (at least with a pinhole camera model) for them to be negative, so you might want to do a >= check there.