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

Improved bullet EntityManagementFeatures GetEntities #365

Closed

Conversation

ahcorde
Copy link
Contributor

@ahcorde ahcorde commented Jun 23, 2022

Signed-off-by: ahcorde [email protected]

🎉 New feature

Summary

Improved bullet EntityManagementFeatures GetEntities

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • 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.

@ahcorde ahcorde requested a review from mjcarroll June 23, 2022 12:01
@ahcorde ahcorde self-assigned this Jun 23, 2022
Signed-off-by: Alejandro Hernández <[email protected]>
@codecov
Copy link

codecov bot commented Jun 23, 2022

Codecov Report

Merging #365 (bba83d5) into main (b2d3797) will increase coverage by 0.66%.
The diff coverage is 76.66%.

@@            Coverage Diff             @@
##             main     #365      +/-   ##
==========================================
+ Coverage   76.77%   77.44%   +0.66%     
==========================================
  Files         128      128              
  Lines        5628     5724      +96     
==========================================
+ Hits         4321     4433     +112     
+ Misses       1307     1291      -16     
Impacted Files Coverage Δ
bullet/src/Base.hh 48.52% <ø> (ø)
bullet/src/EntityManagementFeatures.cc 51.88% <76.66%> (+39.29%) ⬆️
dartsim/src/EntityManagementFeatures.cc 85.76% <0.00%> (+1.98%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b2d3797...bba83d5. Read the comment docs.

bullet/src/EntityManagementFeatures.cc Outdated Show resolved Hide resolved
return modelName;
}

static const std::string modelName = this->models.at(_modelID)->name;
Copy link
Contributor

Choose a reason for hiding this comment

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

I know it was this way before, but why the use of static here?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this must be a copy/paste error from line 335. It kind of makes sense on line 335 but seems definitely wrong to use here since it means every single valid model will always report having the same name, and that name will be whichever was the first one to be asked for it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This method return a string reference, when modelName is out of scope then the reference doesn't exists anymore. That's the only way I found to make it work. Suggestions ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should work: #385

Basically, if it's in the map, return the reference, otherwise return a static std::string that will have a stable reference. We should be able to follow this pattern in the other places where we do this.

Returning a string reference is not a great API for this reason, but I suppose it's a bit late for that.

bullet/src/EntityManagementFeatures.cc Outdated Show resolved Hide resolved
bullet/src/Base.hh Show resolved Hide resolved
ahcorde added 2 commits June 30, 2022 13:53
…into ahcorde/6/improveEntityManagerFeatures_getentities
Signed-off-by: ahcorde <[email protected]>
Base automatically changed from ahcorde/6/refactor_common_test to main July 7, 2022 07:36
@ahcorde ahcorde requested review from mxgrey and mjcarroll July 8, 2022 19:41
@ahcorde ahcorde added the Bullet Bullet engine label Jul 15, 2022
mjcarroll added a commit that referenced this pull request Jul 15, 2022
Signed-off-by: Michael Carroll <[email protected]>
myMotionState, collisionShape, body});
}


Copy link
Contributor

Choose a reason for hiding this comment

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

nit: extra whitespace

return modelName;
}

static const std::string modelName = this->models.at(_modelID)->name;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should work: #385

Basically, if it's in the map, return the reference, otherwise return a static std::string that will have a stable reference. We should be able to follow this pattern in the other places where we do this.

Returning a string reference is not a great API for this reason, but I suppose it's a bit late for that.

@ahcorde
Copy link
Contributor Author

ahcorde commented Jul 15, 2022

this PR is targeting bullet not bullet-featherstone, I will close it for now

@ahcorde ahcorde closed this Jul 15, 2022
@mjcarroll mjcarroll mentioned this pull request Jul 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bullet Bullet engine
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants