-
Notifications
You must be signed in to change notification settings - Fork 269
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
Implement /server_control::stop #1240
Conversation
…ivate. Signed-off-by: Martin Pecka <[email protected]>
Signed-off-by: Martin Pecka <[email protected]>
One question that came to my mind was what to do with the |
Codecov Report
@@ Coverage Diff @@
## ign-gazebo3 #1240 +/- ##
===============================================
- Coverage 77.26% 77.25% -0.01%
===============================================
Files 227 227
Lines 13511 13535 +24
===============================================
+ Hits 10439 10457 +18
- Misses 3072 3078 +6
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, LGTM, just some minor comments.
Signed-off-by: Martin Pecka <[email protected]>
Signed-off-by: Martin Pecka <[email protected]>
I did a few tests locally, and it seems to me it'd be better to not call What do you think about adding this async execution? With synchronous execution, I got some segfaults when calling the service (which practically also get to the requested point of stopping the server, but I'd say it's not the the expected way :) ). With the async implementation, I haven't seen any yet. |
Here's a GUI plugin using the service: gazebosim/gz-gui#335 . |
I'd have to look a bit more closely. It looks like
But I think you're onto something. If you've seen that it works I think it's worth it pursuing that approach. |
Signed-off-by: Martin Pecka <[email protected]>
I've changed the callback to run in a thread. If you look into SimulationRunner::Stop(), it emits an event, which I think can be blocking and could be the source of problems I'm talking about... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just a couple of minor comments left
if (_req.clone() || _req.new_port() != 0 || !_req.save_world_name().empty()) | ||
{ | ||
ignerr << "ServerControl::clone is not implemented" << std::endl; | ||
_res.set_data(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already set up-top, so I think we don't need to repeat it in every block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The individual parts are not else if
s, but if
s, so theoretically, the user could ask for more functions in one call. The logic I used was to report the worst result of all, i.e. report false
as soon as any of the requested functionalities fails. It is set to false at the beginning, but I added these to "remind" or make sure that a failing function is reported. However, it might be wiser to turn the if
s to else if
s, as nobody probably wants to simultaneously stop the server and clone/create a world.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah gotcha, I think future-proofing is ok
Signed-off-by: Martin Pecka <[email protected]>
This pull request has been mentioned on Gazebo Community. There might be relevant details there: https://community.gazebosim.org/t/new-ignition-releases-2022-03-01-citadel-edifice-fortress/1313/1 |
This pull request has been mentioned on Gazebo Community. There might be relevant details there: https://community.gazebosim.org/t/new-ignition-releases-2022-04-13-fortress-edifice/1367/1 |
🎉 New feature
Closes #1237
Summary
Implemented the
stop
part of/server_control
service.Test it
ign gazebo -v4
ign service -s /server_control --reqtype ignition.msgs.ServerControl --reptype ignition.msgs.Boolean --timeout 1000 --req 'stop: 1'
Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge