Set camera projection matrix based on lens params for other types of cameras #432
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🦟 Bug fix
Related issues: gazebosim/gz-rendering#968, #363
Related PR: gazebosim/gz-rendering#1002
Summary
For camera types other than
camera
, e.g.depth_camera
, the input camera sdf's lens<intrinsics>
or<projection>
parameters were not used. This PR refactor's the base CameraSensor class' logic for parsing and setting custom projection matrix in to a new function namedUpdateLensIntrinsicsAndProjection()
. The derived camera classes now call this function for setting a custom projection matrix if needed.Added tests to verify the intrinsic params published through the camera info topic for depth camera sensors.
Here is a test camera_projection.sdf world file. Together with gazebosim/gz-rendering#1002, a depth camera should now produce the same image / FOV as a regular camera when intrinsics or projection param are specified in the sdf.
Before: Cameras have different FOV.
After: Depth camera has the same horizontal FOV as a regular camera
Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-by
messages.