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

ArticulatedObjects: Enable support for secondary json config files. #1458

Merged
merged 7 commits into from
Aug 30, 2021

Conversation

jturner65
Copy link
Contributor

Motivation and Context

This PR introduces support of Json config files for URDF-based ArticulatedObject models in the URDFParser, which will hold default user-defined attributes (Such as bounding boxes for placements) that apply to all instances of articulated objects built from these models. This PR also removed extraneous markers from error messages that did not match the format of our current message logging in the URDFParser.

To be compatible with this functionality, the json config file holding the user_defined attributes must meet these criteria :

  • Must be in the same directory as the AO's .urdf file
  • Must have the same core filename (minus extensions) as the AO's .urdf file
  • Must have the following extension : .ao_config.json
  • Internally, the file must have a root Json object, and within that object there must be a tag "user_defined" which references a Json object holding the user-defined values.

How Has This Been Tested

Locally c++ and python tests.

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have completed my CLA (see CONTRIBUTING)
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@jturner65 jturner65 requested a review from aclegg3 August 30, 2021 16:33
@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Aug 30, 2021
// instance.
existingArticulatedObjects_.at(aObjID)->setUserAttributes(
existingArticulatedObjects_.at(aObjID)->mergeUserAttributes(
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: calling at(aObjId) is not free. The reference should really be cached between these calls, don't you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Every little bit helps, yeah

@@ -185,13 +240,13 @@ bool Parser::parseURDF(std::shared_ptr<Model>& urdfModel,
urdfModel->m_links[link->m_name] = link;
}
} else {
ESP_ERROR() << "E - failed to parse link. Aborting parse/load for"
ESP_ERROR() << "Failed to parse link. Aborting parse/load for"
<< filename;
return false;
}
}
if (urdfModel->m_links.size() == 0) {
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
if (urdfModel->m_links.size() == 0) {
if (urdfModel->m_links.empty()) {

Copy link
Contributor

@aclegg3 aclegg3 left a comment

Choose a reason for hiding this comment

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

Looks great, thanks for cleaning up. 👍

@jturner65 jturner65 merged commit f24445d into facebookresearch:master Aug 30, 2021
@jturner65 jturner65 deleted the AO_JsonUsrAttr branch August 30, 2021 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Do not delete this pull request or issue due to inactivity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants