Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose optical frame in CameraSensor to be used by DepthCameraSensor #362

Merged
merged 1 commit into from
Jul 25, 2023

Conversation

Levi-Armstrong
Copy link
Contributor

Summary

I was using DepthCameraSensor along with the ros_gz_bridge and noticed that the point cloud could not be visualized in rviz because the optical frame was not being assigned to the message being produced by this package.

@github-actions github-actions bot added the 🌱 garden Ignition Garden label Jul 21, 2023
@codecov
Copy link

codecov bot commented Jul 21, 2023

Codecov Report

Merging #362 (c9b8262) into gz-sensors7 (44c67b0) will increase coverage by 0.04%.
The diff coverage is 100.00%.

❗ Current head c9b8262 differs from pull request most recent head 488fcff. Consider uploading reports for the commit 488fcff to get more accurate results

@@               Coverage Diff               @@
##           gz-sensors7     #362      +/-   ##
===============================================
+ Coverage        69.71%   69.76%   +0.04%     
===============================================
  Files               36       36              
  Lines             3959     3965       +6     
===============================================
+ Hits              2760     2766       +6     
  Misses            1199     1199              
Impacted Files Coverage Δ
src/CameraSensor.cc 76.09% <100.00%> (+0.11%) ⬆️
src/DepthCameraSensor.cc 74.80% <100.00%> (+0.39%) ⬆️

@Levi-Armstrong
Copy link
Contributor Author

This looks good now as far as the message containing the correct frame_id if set optical frame.

@@ -146,6 +146,10 @@ namespace gz
/// \todo(iche033) Make this function virtual on Harmonic
public: bool HasInfoConnections() const;

/// \brief Get the camera optical frame
/// \return The camera optical frame
public: std::string OpticalFrameId() const;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public: std::string OpticalFrameId() const;
public: const std::string &OpticalFrameId() const;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I originally did this but the rest of the API returns string by value like FrameId().

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@azeey Let me know if I should still make the change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if the extra copy makes sense especially since this will be called every time a message is published. I'd vote for const ref. Maybe @iche033 can weigh in.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah unfortunately it breaks API consistency but let's go with const & since as it makes sense here, and we'll start doing this more in new APIs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated to return const&

src/DepthCameraSensor.cc Show resolved Hide resolved
Copy link
Contributor

@azeey azeey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@azeey
Copy link
Contributor

azeey commented Jul 24, 2023

Rerunning the Ubuntu CI. I think it had an infra issue.

@iche033 iche033 merged commit 4300c17 into gazebosim:gz-sensors7 Jul 25, 2023
4 checks passed
@Levi-Armstrong Levi-Armstrong deleted the fix/DepthCameraSensor branch July 26, 2023 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌱 garden Ignition Garden
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants