-
Notifications
You must be signed in to change notification settings - Fork 98
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
Schema accessor #1393
base: sdf14
Are you sure you want to change the base?
Schema accessor #1393
Conversation
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 working on this! I have a few comments that should be easy to address.
Regarding testing, I don't think we should create new tests for this, but one way we can make sure it's working is by using SchemaFile()
instead of hard coded file names in ToElement
functions. Perhaps you can update your script to make that change as well?
.DS_Store
Outdated
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.
Remove this file
src/Actor.cc
Outdated
{ | ||
static const std::string* kSchemaFile = new std::string("actor.sdf"); | ||
return *kSchemaFile; | ||
} |
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.
Can you add a newline after the }
? (see https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline)
src/Actor.cc
Outdated
const std::string& Actor::SchemaFile() | ||
{ | ||
static const std::string* kSchemaFile = new std::string("actor.sdf"); | ||
return *kSchemaFile; | ||
} |
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.
According to our style guide, this is sort of a last resort way to create variables with static storage. After reading through https://abseil.io/tips/140#string-view-mistake, I think the recommended way is:
const std::string& Actor::SchemaFile() | |
{ | |
static const std::string* kSchemaFile = new std::string("actor.sdf"); | |
return *kSchemaFile; | |
} | |
inline std::string_view Actor::SchemaFile() | |
{ | |
static const char kSchemaFile[] = "actor.sdf"; | |
return kSchemaFile; | |
} |
878edee
to
2a1d038
Compare
@aagrawal05 Looks like there are some style issues and a DCO error. Mind fixing them? |
Hey @azeey sure let me take a look. The style issues look fairly straightforward and I'll shortly submit changes to fix this. Please let me know if anything further is to be done in terms of functionality. |
6817d40
to
2215b16
Compare
Signed-off-by: Aditya Agrawal <[email protected]>
Signed-off-by: Aditya Agrawal <[email protected]>
Signed-off-by: Steve Peters <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Alejandro Hernández Cordero <[email protected]> Co-authored-by: Ian Chen <[email protected]>
The `gz sdf` tests are fixed by * fixing dll path issue with Ruby on windows * Setting home path --------- Signed-off-by: Addisu Z. Taddese <[email protected]>
* Fix trivial warning on 24.04 for JointAxis_TEST.cc --------- Signed-off-by: Jose Luis Rivero <[email protected]> Co-authored-by: Steve Peters <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
* Enable 24.04 CI, remove distutils dependency (gazebosim#1408) distutils is no longer required since this branch requires a new enough version of cmake. Signed-off-by: Steve Peters <[email protected]> Signed-off-by: Jorge Perez <[email protected]> Co-authored-by: Steve Peters <[email protected]>
Currently errors are generated when adding an attribute containing an empty string to a <plugin> block or as a custom attribute. This adds failing tests to confirm the bug and fixes the errors in by setting `_required == 0` when calling Element::AddAttribute. This also changes Element::ToString to print empty custom attributes. Fixes gazebosim#725. Signed-off-by: Steve Peters <[email protected]>
…bosim#1423) Signed-off-by: Shameek Ganguly <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
gazebosim#1424) Signed-off-by: Alejandro Hernández Cordero <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
Update test to confirm that gazebosim#54 is fixed. Signed-off-by: Steve Peters <[email protected]>
* Backport: Add cone shape to SDFormat spec (gazebosim#1418) Signed-off-by: Benjamin Perseghetti <[email protected]> Co-authored-by: Steve Peters <[email protected]>
Signed-off-by: Jose Luis Rivero <[email protected]> Signed-off-by: Steve Peters <[email protected]> Co-authored-by: Steve Peters <[email protected]>
Signed-off-by: Aditya Agrawal <[email protected]>
2215b16
to
e8e45a8
Compare
Hey @azeey in attempting to resolve the DCO error through a rebase, it appears that I have accidentally re-committed all the 23 commits from my first changes before the merge to my latest changes... I believe it may be a bit complicated for me to proceed accurately to revert this from this point. I feel it might be easier to just close PR and create a new PR on a new branch with a single commit (this also has the added benefit of being merged with the latest changes in sdf14). With regards to the style I believe the errors should be resolved but I need to test with the linter using the workflow. Please let me know how to proceed. |
@aagrawal05 yes, I think I new PR would be cleaner. It would be ideal if you can target |
🎉 New feature
Closes #1376
Summary
Test it
Tests can be done manually as mentioned by the OP in #1376 in his code example.
I could also add tests in the DOM element unit tests, but that might be overkill because the values are hard-coded.
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.