-
Notifications
You must be signed in to change notification settings - Fork 300
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
Standalone gz sim
executable
#2809
base: gz-sim9
Are you sure you want to change the base?
Conversation
Signed-off-by: Saurabh Kamat <[email protected]>
Signed-off-by: Saurabh Kamat <[email protected]>
Signed-off-by: Saurabh Kamat <[email protected]>
Signed-off-by: Saurabh Kamat <[email protected]>
Signed-off-by: Saurabh Kamat <[email protected]>
Signed-off-by: Saurabh Kamat <[email protected]>
2eda54f
to
87f72ba
Compare
Signed-off-by: Saurabh Kamat <[email protected]>
Signed-off-by: Saurabh Kamat <[email protected]>
…d tests Signed-off-by: Saurabh Kamat <[email protected]>
Signed-off-by: Saurabh Kamat <[email protected]>
Signed-off-by: Saurabh Kamat <[email protected]>
gz sim
executablegz sim
executable
Before looking into the code: Given the client / server architecture I would expect to find something like: |
Thanks a lot @sauk2 ! I put together an hack (or let's call it a "proof of concept", to be more fancy) to understand if this new standalone executable could be used to be able to get a working Once a consensus is reached on this PR, I can try to cleanup the code in https://github.com/traversaro/ign-gazebo/tree/sim-standalone-exe-win to have it in PR shape. |
For clarity, there I used |
That is a good point. Ideally we should go with one code path for all unless we find a good reason or a problem in a particular arch. Maybe wrong but I have always assumed that the ruby code currently spawns two different processes via |
Signed-off-by: Saurabh Kamat <[email protected]>
Signed-off-by: Saurabh Kamat <[email protected]>
@j-rivero and @traversaro Thanks a lot for all your feedback! Sorry for the delay in making changes and responding. I've moved this PR back to draft since I believe further discussion is needed before it's ready for merge. Based on your comments, it made sense to handle the server and GUI as separate processes rather than separate threads. To that end, I've split them into two distinct CLI executables - Handling the Another issue is that logs are not streamed to the terminal in the current implementation. The Additionally, the server and GUI flags are currently defined within their respective executables. I’m exploring ways to extract these flags so they can be included in the main help message - one idea is to invoke each executable with I’d appreciate any suggestions or feedback on these points. Thanks again! |
Thanks a lot for the great work!
We used a similar solution in Gazebo Classic on Windows, and it worked fine.
Interesting. I do not have experience with subprocess.h, but with reproc and tiny-process-lib the subprocess output is automatically printed in the terminal that launched the main process. Perhaps there is some way to achieve this, without the need to manually process the stdout and stderr from the child processes?
Good point. Could it make sense to move the logic of those flags to a simple header-only library, and call it from both the main executable and server/client ones? |
Sounds like a bug/defect in subprocess that would need to be fixed. I think that we can go with the workaround by now if it is producing the expect result and ticket the bug in gz-utils in order not to go too far with this PR.
+1. |
Signed-off-by: Saurabh Kamat <[email protected]>
Signed-off-by: Saurabh Kamat <[email protected]>
@traversaro and @j-rivero, Sorry for the delay in getting back to you, and thanks for the feedback! I initially tried using I've made a few changes that seem to work well. Instead of maintaining separate executables for Now, the server process runs directly from the main executable and the GUI is launched as a separate process using I still need to figure out how to make this work on Windows, so it would be great to get some advice on this! I’d be happy to get your feedback and do let me know if this approach works for you! |
🎉 New feature
Related to gazebosim/gz-tools#7
Summary
This PR introduces a standalone executable for
gz sim
by following a similar approach togz model
. The new executable is integrated intocmdsim.rb.in
, replacing the existing functionality. It is also a step in the direction of #2737, which will eventually allow us to decouple the server from GUI components.The majority of the behavior remains consistent, including:
-s
-g
Changes to the launch behaviour
-s
runs the server in the main thread.-g
runs the GUI in the main thread.-s
or-g
launches both the Server and GUI in separate threads. Since a singleSIGINT
terminates only one of the threads while the other continues running, a force kill mechanism ensures that both threads terminate properly.Test it
Check for
UNIT_gz_TEST
andINTEGRATION_log_system
.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.