Skip to content

Conversation

GauravKumar9920
Copy link
Contributor

🦟 Bug fix and New feature

Fixes #2806

Summary

Previously, when launching multiple GZ Sim servers, for instance, using the commands gz sim -s shapes.sdf and gz sim -s default.sdf,

If we had used the command gz sim -g ‘fileName’,
It would not have considered the fileName parameter and would have launched any of the servers at random.

This pr introduces a new feature that allows you to -

  • Launch a file by passing the file name as an argument. For instance, you can utilize the command gz sim -g ‘fileName’ to launch the GUI, provided that the server(s) are operational.
  • Warn the user if there are multiple servers running in case where we don't pass the fileName as an argument. eg - gz sim -g. In case there's just one server running it will simply launch the gui of the same.

Copy link
Contributor

@arjo129 arjo129 left a comment

Choose a reason for hiding this comment

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

This diff is absolutely massive for such a small change. I've left some architectural feedback here: #2806 (comment)

Also when committing please sign off with git commit -s.

I think we can break these down into small PRs.

@github-project-automation github-project-automation bot moved this from Inbox to In review in Core development Mar 19, 2025
@iche033
Copy link
Contributor

iche033 commented Mar 19, 2025

I think the big diff is also partly due to indentation changes, e.g. https://github.com/gazebosim/gz-sim/pull/2828/files?w=1 shows diff without whitespace changes. Can you undo indentation changes?

Signed-off-by: GauravKumar9920 <gaurav.og.9920@gmail.com>
@github-project-automation github-project-automation bot moved this from Done to Inbox in Core development Mar 20, 2025
@codecov
Copy link

codecov bot commented Mar 20, 2025

Codecov Report

Attention: Patch coverage is 83.33333% with 2 lines in your changes missing coverage. Please review.

Project coverage is 68.97%. Comparing base (1509b0f) to head (b848079).
Report is 9 commits behind head on gz-sim9.

Files with missing lines Patch % Lines
src/SimulationRunner.cc 80.00% 1 Missing ⚠️
src/gui/QuickStartHandler.cc 85.71% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           gz-sim9    #2828      +/-   ##
===========================================
+ Coverage    68.95%   68.97%   +0.02%     
===========================================
  Files          345      345              
  Lines        33332    33360      +28     
===========================================
+ Hits         22983    23009      +26     
- Misses       10349    10351       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: GauravKumar9920 <gaurav.og.9920@gmail.com>
@GauravKumar9920 GauravKumar9920 requested a review from arjo129 March 20, 2025 11:52
Copy link
Contributor

@arjo129 arjo129 left a comment

Choose a reason for hiding this comment

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

This is looking a lot better. Most of my comments are more to do with syntax and style. I have one tiny knit regarding returning an incompletely constructed object. For now we should just continue with construction as is. In Jetty we can consider throwing an error.

@github-project-automation github-project-automation bot moved this from Inbox to In review in Core development Mar 21, 2025
GauravKumar9920 and others added 3 commits March 21, 2025 16:31
Co-authored-by: Arjo Chakravarty <arjo129@gmail.com>
Signed-off-by: Gaurav Kumar <84905312+GauravKumar9920@users.noreply.github.com>
Co-authored-by: Arjo Chakravarty <arjo129@gmail.com>
Signed-off-by: Gaurav Kumar <84905312+GauravKumar9920@users.noreply.github.com>
Signed-off-by: GauravKumar9920 <gaurav.og.9920@gmail.com>
Signed-off-by: GauravKumar9920 <gaurav.og.9920@gmail.com>
@GauravKumar9920 GauravKumar9920 requested a review from arjo129 March 25, 2025 17:12
Copy link
Contributor

@arjo129 arjo129 left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for iterating.

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, just minor suggestions

Signed-off-by: Gaurav Kumar <84905312+GauravKumar9920@users.noreply.github.com>
Signed-off-by: Gaurav Kumar <84905312+GauravKumar9920@users.noreply.github.com>
@GauravKumar9920 GauravKumar9920 requested a review from iche033 April 3, 2025 12:29
Signed-off-by: Gaurav Kumar <84905312+GauravKumar9920@users.noreply.github.com>
GauravKumar9920 and others added 2 commits April 7, 2025 11:14
Signed-off-by: GauravKumar9920 <gaurav.og.9920@gmail.com>
@GauravKumar9920
Copy link
Contributor Author

Hello, apologies for the slow response on this thread was a bit occupied for the last few weeks.
I went ahead and tested the current code, and it seems to be working as expected. However, I’m still encountering some issues with the GitHub Actions errors. Can you help me out with that?

@iche033 iche033 changed the title Issue2806 Detect running server on startup Apr 10, 2025
@iche033
Copy link
Contributor

iche033 commented Apr 10, 2025

Hello, apologies for the slow response on this thread was a bit occupied for the last few weeks. I went ahead and tested the current code, and it seems to be working as expected. However, I’m still encountering some issues with the GitHub Actions errors. Can you help me out with that?

The UNIT_Gui_TEST is failing because I think the changes affected how fast the QuickStart window comes up. Can you try applying this diff and see if that fixes the test on our CI?

diff --git a/src/gui/Gui_TEST.cc b/src/gui/Gui_TEST.cc
index ce5b42576..6f4c1d92a 100644
--- a/src/gui/Gui_TEST.cc
+++ b/src/gui/Gui_TEST.cc
@@ -252,6 +252,9 @@ TEST_F(GuiTest, GZ_UTILS_TEST_ENABLED_ONLY_ON_LINUX(QuickStart))
     // Close the quick start window
     gzdbg << "Closing the quickstart window" << std::endl;
     ASSERT_EQ(1, gui::App()->allWindows().count());
+
+    while (!gui::App()->allWindows()[0]->isExposed())
+      std::this_thread::sleep_for(std::chrono::milliseconds(100));
     gui::App()->allWindows()[0]->close();
 
     gzdbg << "Waiting for main window" << std::endl;

Signed-off-by: GauravKumar9920 <gaurav.og.9920@gmail.com>
@GauravKumar9920
Copy link
Contributor Author

Hello @iche033, Makes sense and I have made the changes, and it appears to build successfully except for one of them.

@iche033
Copy link
Contributor

iche033 commented Apr 11, 2025

ok I've seen the homebrew failures before. Those just started recently and I don't believe this PR caused those failures.

@iche033 iche033 requested a review from arjo129 April 11, 2025 17:28
Signed-off-by: Gaurav Kumar <84905312+GauravKumar9920@users.noreply.github.com>
Copy link
Contributor

@arjo129 arjo129 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 this contribution!

@iche033 iche033 merged commit 871da42 into gazebosim:gz-sim9 Apr 14, 2025
9 of 10 checks passed
@github-project-automation github-project-automation bot moved this from In review to Done in Core development Apr 14, 2025
@GauravKumar9920 GauravKumar9920 deleted the issue2806 branch April 16, 2025 06:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🏛️ ionic Gazebo Ionic

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Consider warning users if there is already a Gazebo server running in the background

3 participants