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

Visualze Frustum #2707

Open
wants to merge 4 commits into
base: gz-sim9
Choose a base branch
from
Open

Visualze Frustum #2707

wants to merge 4 commits into from

Conversation

BA-Utkarsh
Copy link

@BA-Utkarsh BA-Utkarsh commented Dec 26, 2024

🎉 New feature

Summary

This PR mainly adds the visualization of Frustum.
We could see it was present in gazebo classic and from gazebo garden onwards the plugin/feature is not available.

Test it

$ Build gazebo from source.
$ . install/setup.sh
$ gz sim examples/worlds/visualize_frustum.sdf

Test Ref images,

  1. Play the simulation.
    frustum-1

  2. Select the topic from scroll down.
    frustum-2

  3. Refresh it to get the "logical_camera/frustum" topic.
    frustum-3

  4. Subcriibed to "logical_camera/frustum".
    frustum-4

  5. Final output
    frustum-6

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
  • All tests passed
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Supporting PRs,

@@ -0,0 +1,440 @@
/*
* Copyright (C) 2020 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) 2020 Open Source Robotics Foundation
* Copyright (C) 2024 Open Source Robotics Foundation

Copy link
Author

Choose a reason for hiding this comment

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

@ahcorde thank you for reviewing.
Before proceeding, I have a small query.
Do you want me to,

  1. use sign off and commit suggestion for each review comment?
  2. Or, do all the changes in my local branch and push it?

Additionally, for sign off, do I need to do to all the commits as I missed it in my first version, or commits from now onwards it's ok.
I'm bit confused.

Copy link
Author

Choose a reason for hiding this comment

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

Updated!

/////////////////////////////////////////////////
void VisualizeFrustum::OnRefresh()
{
gzmsg << "Refreshing topic list for Logical Camera Sensor messages." << 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.

remove or maybe debug

Copy link
Author

Choose a reason for hiding this comment

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

Updated!

@@ -0,0 +1,105 @@
/*
* Copyright (C) 2020 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) 2020 Open Source Robotics Foundation
* Copyright (C) 2024 Open Source Robotics Foundation

Copy link
Author

Choose a reason for hiding this comment

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

Updated!

EntityComponentManager &_ecm) override;

/// \brief Callback function to get data from the message
/// \param[in]_msg FrustumSensor message
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
/// \param[in]_msg FrustumSensor message
/// \param[in] _msg FrustumSensor message

Copy link
Author

Choose a reason for hiding this comment

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

Updated!

@@ -0,0 +1,78 @@
/*
* Copyright (C) 2020 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) 2020 Open Source Robotics Foundation
* Copyright (C) 2024 Open Source Robotics Foundation

Copy link
Author

Choose a reason for hiding this comment

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

Updated!

Signed-off-by: Utkarsh <Utkarsh.Yenurkar@Sony.com>
Signed-off-by: Utkarsh <Utkarsh.Yenurkar@Sony.com>
@BA-Utkarsh
Copy link
Author

@ahcorde , thank you for review. I have addressed all the review comments.

@arjo129
Copy link
Contributor

arjo129 commented Jan 9, 2025

Thanks for the contribution. There are still stray spaces in the code. Do you mind fixing them: https://github.com/gazebosim/gz-sim/actions/runs/12514253900/job/35270143157?pr=2707

Also is there a chance that we can visualize the frustum without the need for pressing play?

Signed-off-by: Utkarsh <Utkarsh.Yenurkar@Sony.com>
@BA-Utkarsh BA-Utkarsh requested a review from ahcorde January 10, 2025 07:44
/// \brief Mutex for variable mutated by the checkbox and spinboxes
/// callbacks.
/// The variables are: msg
public: std::mutex serviceMutex;
Copy link
Contributor

Choose a reason for hiding this comment

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

include <mutex>

Copy link
Author

Choose a reason for hiding this comment

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

Updated!

if (!engine)
{
gzerr << "Internal error: failed to load engine [" << engineName
<< "]. VisualizeFrustum plugin won't work." << 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.

include <ostream>

Copy link
Author

Choose a reason for hiding this comment

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

Updated!

{
auto parent = baseEntity;
bool success = false;
for (size_t i = 0u; i < frustumURIVec.size()-1; i++)
Copy link
Contributor

Choose a reason for hiding this comment

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

include <cstddef>

Copy link
Author

Choose a reason for hiding this comment

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

Updated!

std::lock_guard<std::mutex> lock(this->dataPtr->serviceMutex);
if (this->dataPtr->initialized)
{
this->dataPtr->msg = std::move(_msg);
Copy link
Contributor

Choose a reason for hiding this comment

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

include <utility>

Copy link
Author

Choose a reason for hiding this comment

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

Updated!

@@ -0,0 +1,105 @@
/*
* Copyright (C) 2024 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) 2024 Open Source Robotics Foundation
* Copyright (C) 2025 Open Source Robotics Foundation

Copy link
Author

Choose a reason for hiding this comment

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

Updated!

@@ -0,0 +1,438 @@
/*
* Copyright (C) 2024 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) 2024 Open Source Robotics Foundation
* Copyright (C) 2025 Open Source Robotics Foundation

Copy link
Author

Choose a reason for hiding this comment

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

Updated!

@@ -0,0 +1,78 @@
/*
* Copyright (C) 2024 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) 2024 Open Source Robotics Foundation
* Copyright (C) 2025 Open Source Robotics Foundation

Copy link
Author

Choose a reason for hiding this comment

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

Updated!

Signed-off-by: Utkarsh <Utkarsh.Yenurkar@Sony.com>
@BA-Utkarsh BA-Utkarsh requested a review from ahcorde January 11, 2025 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏛️ ionic Gazebo Ionic 🪵 jetty Gazebo Jetty
Projects
Status: In review
Development

Successfully merging this pull request may close these issues.

3 participants