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

Add warnings for unsupported shape pairs of DARTCollisionDetector #722

Merged
merged 4 commits into from
May 13, 2016

Conversation

jslee02
Copy link
Member

@jslee02 jslee02 commented May 12, 2016

This change is Reviewable

@mxgrey
Copy link
Member

mxgrey commented May 12, 2016

Reviewed 3 of 4 files at r1.
Review status: 3 of 4 files reviewed at latest revision, 1 unresolved discussion.


dart/collision/dart/DARTCollide.cpp, line 53 [r1] (raw file):

        << getShapeName(shape1) << "'-'"\
        << getShapeName(shape2) << "'. "\
        << "Returning false.\n";

Maybe tweak this to:

  dterr << '[DARTCollisionDetector] Attempting to check for an "\
        << "unsupported shape pair: [" << typeid(*shape1).name()\
        << "] - [" << typeid(*shape2).name() << ]. Returning false.\n";

This way it would accurately report the issue even if a non-standard shape gets used.


Comments from Reviewable

@jslee02
Copy link
Member Author

jslee02 commented May 12, 2016

dart/collision/dart/DARTCollide.cpp, line 53 [r1] (raw file):

Previously, mxgrey (Michael X. Grey) wrote…

Maybe tweak this to:

  dterr << '[DARTCollisionDetector] Attempting to check for an "\
        << "unsupported shape pair: [" << typeid(*shape1).name()\
        << "] - [" << typeid(*shape2).name() << ]. Returning false.\n";

This way it would accurately report the issue even if a non-standard shape gets used.


👍 Good idea! I have a little concern that typeid(~).name() sometimes return a little bit mangled name, but I would prefer it since it's more flexible and the mangled​ name s are still reasonably readable.


Comments from Reviewable

@mxgrey
Copy link
Member

mxgrey commented May 12, 2016

Review status: 3 of 4 files reviewed at latest revision, 1 unresolved discussion.


dart/collision/dart/DARTCollide.cpp, line 53 [r1] (raw file):

Previously, jslee02 (Jeongseok Lee) wrote…

👍 Good idea! I have a little concern that typeid().name() sometimes return a little bit mangled name, but I would prefer it since it's more flexible and the mangled​ name s are still reasonably readable.


Yeah, it would be nice if a de-mangled "pretty print" version were available for typeid().name(), but we can always de-mangle the printout while debugging.


Comments from Reviewable

@mkoval
Copy link
Collaborator

mkoval commented May 12, 2016

Review status: 2 of 5 files reviewed at latest revision, 1 unresolved discussion.


dart/collision/dart/DARTCollide.cpp, line 53 [r1] (raw file):

Previously, mxgrey (Michael X. Grey) wrote…

Yeah, it would be nice if a de-mangled "pretty print" version were available for typeid(~).name(), but we can always de-mangle the printout while debugging.


I would prefer to add virtual getType and a static getStaticTypefunctions, like we currently have onJoint`. That way we get the best of both worlds: (1) no RTTI, which is brittle when using dynamic linking, (2) a readable name, and (3) user-extensibility. Thoughts?


Comments from Reviewable

@jslee02
Copy link
Member Author

jslee02 commented May 12, 2016

dart/collision/dart/DARTCollide.cpp, line 53 [r1] (raw file):

Previously, mkoval (Michael Koval) wrote…

I would prefer to add virtual getType and a static getStaticTypefunctions, like we currently have onJoint`. That way we get the best of both worlds: (1) no RTTI, which is brittle when using dynamic linking, (2) a readable name, and (3) user-extensibility. Thoughts?


My only concern is the performance of type checking. The cost would be virtual function call + string comparing. As I known, string comparing is just pointer comparison so virtual function call is the only overhead, right?

I don't have an objection to​ using type functions.


Comments from Reviewable

@jslee02
Copy link
Member Author

jslee02 commented May 13, 2016

Review status: 2 of 5 files reviewed at latest revision, 1 unresolved discussion.


dart/collision/dart/DARTCollide.cpp, line 53 [r1] (raw file):

Previously, jslee02 (Jeongseok Lee) wrote…

My only concern is the performance of type checking. The cost would be virtual function call + string comparing. As I known, string comparing is just pointer comparison so virtual function call is the only overhead, right?

I don't have an objection to​ using type functions.


I remember that there was one reason we stayed with enumerate​. The shape type wouldn't be easy to be extended with full support of related functionalities such as rendering and collision detection. Also, in general, switch statement with enumerate would be cheaper than if-else if-else statement. However, now I'm inclined to having virtual getType() because of consistency and that this is not the performance critical.

This can be handled in a separate PR. I'm merging this PR if there is no objection.


Comments from Reviewable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants