-
Notifications
You must be signed in to change notification settings - Fork 44
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
Add config relative path environment variable #386
Conversation
Signed-off-by: Mabel Zhang <[email protected]>
Signed-off-by: Mabel Zhang <[email protected]>
Signed-off-by: Mabel Zhang <[email protected]>
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 for the PR! A few preliminary notes:
-
cmdgui.rb
affects the command line tool, but not whenign-gui
is used as a library, which is an important use case for simulation. So I think the lookup should probably be done around here:
Do we want both variables? Are those the final names we want?
I think only one variable is enough; "resource" sounds good to me.
We shouldn't add any new variables with "ign", because we'd need to tick-tock them later. That applies even for Citadel and Fortress. So let's go with GZ_GUI_RESOURCE_PATH
here.
Is there a way to test at the ign gui level that automatically close the GUI?
Maybe that won't be necessary once the implementation is moved to Application
?
Codecov Report
@@ Coverage Diff @@
## ign-gui3 #386 +/- ##
=========================================
Coverage 31.12% 31.12%
=========================================
Files 29 29
Lines 1343 1343
=========================================
Hits 418 418
Misses 925 925 Continue to review full report at Codecov.
|
Ah okay. I contemplated putting it in |
Signed-off-by: Mabel Zhang <[email protected]>
Signed-off-by: Mabel Zhang <[email protected]>
Signed-off-by: Mabel Zhang <[email protected]>
All above resolved - moved to |
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! Works for me!
I think it's worth it adding a note about the env var to the config tutorial:
Signed-off-by: Mabel Zhang <[email protected]>
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 for iterating, LGTM!
🎉 New feature
Closes #337
Summary
Before trying to load the
--config
path, check environment variableGZ_GUI_RESOURCE_PATH
.This allows relative config paths with respect to those environment variables to be specified after
--config
.Implementation similar to
ign-gazebo
https://github.com/ignitionrobotics/ign-gazebo/blob/b825c27841f38c1df06cd053f70f9836786b590d/src/cmd/cmdgazebo.rb.in#L393-L409 but in C++ instead of Ruby.Questions:- Do we want both variables? Are those the final names we want? The ign-gazebo env var name isIGN_GAZEBO_RESOURCE_PATH
. So it might be more consistent if we call itIGN_GUI_RESOURCE_PATH
.From the description of the original issue, maybe we only want
IGN_GUI_CONFIG_PATH
and not the*RESOURCE*
variable?- Is there a way to test at theign gui
level that automatically close the GUI?Currently, the added unit test brings up the GUI via
popen
, but doesn't close it. That's not going to work as an automated test, as it requires manual closing of the window. The way ign-gazebo does it is by running headless (-s
), which ign-gui doesn't have a flag for. Other ign-gui tests that automatically close the window initializeApplication
orMainWindow
in the code. Here, we are testing the Ruby code at theign
command a level above, so we don't have those objects.Should we just not test the valid cases? Only the valid cases bring up the GUI. The invalid cases just print a message and exit.
Test it
Environment variable should show up in help message:
Unit test:
Manual test:
Test with config files in
examples/config/
.For all following commands, replace environment variable with path on your machine.
Valid environment variable and file, should show color themed GUI:
Invalid file:
Multiple paths, some valid, some invalid. Should find file and load up correct GUI:
Test at ign-gazebo level:
Should show color themed GUI (add Gz Scene 3D plugin to see the world axis):
Do after merging
New env var should be added to the
ign gazebo
help message after this is merged.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.