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

Print an error message when trying to load SDF files that don't contain a <world> #1998

Merged
merged 4 commits into from
Jun 12, 2023

Conversation

Henrique-BO
Copy link
Contributor

@Henrique-BO Henrique-BO commented May 28, 2023

🦟 Bug fix

Fixes #1941

Summary

Added an error message when attempting to load an SDF file that doesn't contain a world.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

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.

@osrf-triage osrf-triage added this to Inbox in Core development May 28, 2023
@github-actions github-actions bot added the 🏰 citadel Ignition Citadel label May 28, 2023
Signed-off-by: Henrique-BO <henrique.barrosoliveira@usp.br>
Signed-off-by: Henrique-BO <henrique.barrosoliveira@usp.br>
Comment on lines 1102 to 1103
serverConfig.SetSdfFile(std::string(PROJECT_SOURCE_PATH) +
"/test/worlds/models/sphere/model.sdf");
Copy link
Contributor

Choose a reason for hiding this comment

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

use common::joinPaths

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 9059a2b.

Comment on lines 1123 to 1126
}


// Run multiple times. We want to make sure that static globals don't cause
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
}
// Run multiple times. We want to make sure that static globals don't cause
}
// Run multiple times. We want to make sure that static globals don't cause

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 9059a2b.

Core development automation moved this from Inbox to In review May 29, 2023
Signed-off-by: Henrique-BO <henrique.barrosoliveira@usp.br>
@codecov
Copy link

codecov bot commented May 30, 2023

Codecov Report

Merging #1998 (15f98e0) into ign-gazebo3 (3dd77a2) will increase coverage by 0.04%.
The diff coverage is 100.00%.

❗ Current head 15f98e0 differs from pull request most recent head bee3130. Consider uploading reports for the commit bee3130 to get more accurate results

@@               Coverage Diff               @@
##           ign-gazebo3    #1998      +/-   ##
===============================================
+ Coverage        70.71%   70.75%   +0.04%     
===============================================
  Files              262      262              
  Lines            16759    16763       +4     
===============================================
+ Hits             11851    11861      +10     
+ Misses            4908     4902       -6     
Impacted Files Coverage Δ
src/Server.cc 84.70% <100.00%> (+0.36%) ⬆️

... and 1 file with indirect coverage changes

@azeey azeey changed the title Throw an error when trying to load sdf files that don't contain a <world> Print an error message when trying to load SDF files that don't contain a <world> Jun 1, 2023
src/Server.cc Outdated
@@ -182,6 +182,12 @@ Server::Server(const ServerConfig &_config)
return;
}

if (this->dataPtr->sdfRoot.WorldCount() == 0)
{
ignerr << "SDF file doesn't contain a world.\n";
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be helpful to add that if the user wants to spawn a model, they could use the ResourceSpawner GUI plugin or the world/<world name/create service.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in bee3130.

Signed-off-by: Henrique-BO <henrique.barrosoliveira@usp.br>
@azeey
Copy link
Contributor

azeey commented Jun 7, 2023

@osrf-jenkins run tests please

@azeey azeey requested a review from ahcorde June 7, 2023 22:14
@azeey
Copy link
Contributor

azeey commented Jun 12, 2023

CI is broken on macOS, so I'll go ahead and merge this.

@azeey azeey dismissed ahcorde’s stale review June 12, 2023 20:11

Feedback has been addressed

@azeey azeey merged commit 1038a35 into gazebosim:ign-gazebo3 Jun 12, 2023
6 of 7 checks passed
Core development automation moved this from In review to Done Jun 12, 2023
@azeey
Copy link
Contributor

azeey commented Jun 12, 2023

Note, this should not be forward ported to gz-sim7 because loading model files directly is supported in that branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏰 citadel Ignition Citadel
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[BUG] gazebo citadel fails to load sdf files that aren't a part of a <world> but doesn't throw an error.
3 participants