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

Added trigger to BoundingBoxCamera #322

Merged
merged 6 commits into from
Feb 25, 2023

Conversation

vvasco
Copy link
Contributor

@vvasco vvasco commented Feb 16, 2023

Signed-off-by: Valentina Vasco [email protected]

🎉 New feature

Closes #321

Summary

This adds the possibility to trigger a BoundingBoxCamera.

Test it

Checkout the branch https://github.com/vvasco/gz-sensors/tree/triggered_bounding_box_camera and run the INTEGRATION_triggered_boundingbox_camera

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

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.

@vvasco vvasco requested a review from iche033 as a code owner February 16, 2023 18:10
@github-actions github-actions bot added the 🌱 garden Ignition Garden label Feb 16, 2023
@mjcarroll mjcarroll self-requested a review February 16, 2023 18:11
@@ -22,6 +22,7 @@
#include <string>

#include <gz/msgs/image.pb.h>
#include <gz/msgs/boolean.pb.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

alphabetize

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed in d7bc027

Comment on lines 89 to 95
public: bool isTriggeredCamera = false;

/// \brief True if camera has been triggered by a topic
public: bool isTriggered = false;

/// \brief Topic for camera trigger
public: std::string triggerTopic = "";
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: bool isTriggeredCamera = false;
/// \brief True if camera has been triggered by a topic
public: bool isTriggered = false;
/// \brief Topic for camera trigger
public: std::string triggerTopic = "";
public: bool isTriggeredCamera{false};
/// \brief True if camera has been triggered by a topic
public: bool isTriggered{false};
/// \brief Topic for camera trigger
public: std::string triggerTopic{""};

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed in d7bc027


if (this->dataPtr->triggerTopic.empty())
{
gzerr << "Invalid trigger topic name" << std::endl;
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
gzerr << "Invalid trigger topic name" << std::endl;
gzerr << "Invalid trigger topic name [" << this->dataPtr->triggerTopic << "]" << std::endl;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed in d7bc027

Comment on lines 250 to 251
gzdbg << "Camera trigger messages for [" << this->Name() << "] subscribed"
<< " on [" << this->dataPtr->triggerTopic << "]" << std::endl;
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
gzdbg << "Camera trigger messages for [" << this->Name() << "] subscribed"
<< " on [" << this->dataPtr->triggerTopic << "]" << std::endl;
gzdbg << "Camera trigger messages for [" << this->Name() << "] subscribed"
<< " on [" << this->dataPtr->triggerTopic << "]" << std::endl;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed in d7bc027

@@ -0,0 +1,228 @@
/*
* Copyright (C) 2022 Open Source Robotics Foundation
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
* Copyright (C) 2022 Open Source Robotics Foundation
* Copyright (C) 2023 Open Source Robotics Foundation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed in d7bc027

Signed-off-by: Valentina Vasco <[email protected]>
Copy link
Contributor

@iche033 iche033 left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution!

There are some minor lint issues picked up here: https://github.com/gazebosim/gz-sensors/actions/runs/4204430572/jobs/7404649199

Can you address these issues.

I also made a comment about ABI compatibility.

@@ -175,6 +176,10 @@ namespace gz
/// \param[in] _scene Pointer to the new scene.
private: void OnSceneChange(gz::rendering::ScenePtr /*_scene*/);

/// \brief Callback for triggered subscription
/// \param[in] _msg Boolean message
private: virtual void OnTrigger(const gz::msgs::Boolean &/*_msg*/);
Copy link
Contributor

Choose a reason for hiding this comment

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

looks like this changed the v-table layout maybe ABI-incompatible. We'll need to make this function non-virtual in gz-sensors7. This can be made virtual later when we forward port to main where we can break ABI.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in b7ecaa5

Signed-off-by: Valentina Vasco <[email protected]>
Copy link
Contributor

@iche033 iche033 left a comment

Choose a reason for hiding this comment

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

looks good to me. Tested with the bounding box camera example world in gz-sim and works as expected

Signed-off-by: Ian Chen <[email protected]>
@codecov
Copy link

codecov bot commented Feb 24, 2023

Codecov Report

Merging #322 (5af125c) into gz-sensors7 (9f7fb14) will increase coverage by 0.16%.
The diff coverage is 76.00%.

❗ Current head 5af125c differs from pull request most recent head 544534c. Consider uploading reports for the commit 544534c to get more accurate results

@@               Coverage Diff               @@
##           gz-sensors7     #322      +/-   ##
===============================================
+ Coverage        69.80%   69.97%   +0.16%     
===============================================
  Files               36       36              
  Lines             3898     3920      +22     
===============================================
+ Hits              2721     2743      +22     
  Misses            1177     1177              
Impacted Files Coverage Δ
src/BoundingBoxCameraSensor.cc 60.90% <72.72%> (+2.79%) ⬆️
src/CameraSensor.cc 80.42% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@Crola1702
Copy link
Contributor

Hey @iche033 @vvasco.

triggered_boundingbox_camera.cc test is failing. I'm not sure why 😕.

Check #328

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.

Expose trigger for boundingbox_camera sensor
4 participants