-
Notifications
You must be signed in to change notification settings - Fork 110
Draft: Parser warning message when <gazebo> reference does not exist in URDF #1392
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
Open
aagrawal05
wants to merge
9
commits into
gazebosim:sdf14
Choose a base branch
from
aagrawal05:parser_ref_warning_message
base: sdf14
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
640766f
initial draft of warning message functionality
aagrawal05 ff06de3
fixed formatting
aagrawal05 bff4f75
Formatting changes parser_urdf_TEST.cc
aagrawal05 d9f56f5
Formatting changes in parser_urdf.cc
aagrawal05 2d221fe
Update parser_urdf_TEST.cc and fixed mistake in test
aagrawal05 d610aa9
added other SDFExtensions
aagrawal05 47f9c1f
Merge branch 'sdf14' into parser_ref_warning_message
azeey 8046a01
fixed error messages, tests, and style
aagrawal05 7f7b183
style
aagrawal05 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2460,6 +2460,63 @@ TEST(URDFParser, ZeroMassLeafLink) | |
} | ||
} | ||
|
||
///////////////////////////////////////////////// | ||
TEST(URDFParser, ParseGazeboRefDoesntExistWarningMessage) | ||
{ | ||
// Redirect sdfwarn output | ||
std::stringstream buffer; | ||
sdf::testing::RedirectConsoleStream redir( | ||
sdf::Console::Instance()->GetMsgStream(), &buffer); | ||
#ifdef _WIN32 | ||
sdf::Console::Instance()->SetQuiet(false); | ||
sdf::testing::ScopeExit revertSetQuiet( | ||
[] | ||
{ | ||
sdf::Console::Instance()->SetQuiet(true); | ||
}); | ||
#endif | ||
|
||
// test if reference to link exists | ||
{ | ||
// clear the contents of the buffer | ||
buffer.str(""); | ||
|
||
std::string str = R"( | ||
<robot name="test_robot"> | ||
<link name="link1"> | ||
<inertial> | ||
<mass value="1" /> | ||
<inertia ixx="0.01" ixy="0.0" ixz="0.0" iyy="0.01" iyz="0.0" izz="0.01" /> | ||
</inertial> | ||
</link> | ||
<gazebo reference="lіnk1"> | ||
<sensor name="link1_imu" type="imu"> | ||
<always_on>1</always_on> | ||
<update_rate>100</update_rate> | ||
<pose>0.13525 0 -0.07019999999999993 0.0 -0.0 -2.0943952105869315</pose> | ||
<plugin name="sensor_plugin" filename="example_plugin.so" /> | ||
</sensor> | ||
</gazebo> | ||
</robot>)"; | ||
|
||
sdf::URDF2SDF parser; | ||
tinyxml2::XMLDocument sdfResult; | ||
sdf::ParserConfig config; | ||
parser.InitModelString(str, config, &sdfResult); | ||
|
||
EXPECT_PRED2(sdf::testing::contains, buffer.str(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add a comment here why the two |
||
"<gazebo> tag with reference[link1] does not exist" | ||
" in the URDF model. Please ensure that the reference attribute" | ||
" matches the name of a link."); | ||
} | ||
|
||
/* TODO(aagrawal05): Similar tests for - | ||
InsertSDFExtensionCollision, | ||
InsertSDFExtensionRobot, | ||
InsertSDFExtensionVisual, | ||
InsertSDFExtensionJoint */ | ||
} | ||
aagrawal05 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
///////////////////////////////////////////////// | ||
/// Main | ||
int main(int argc, char **argv) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.