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

Fairmotion Save/Load Metadata via JSON #1557

Merged
merged 22 commits into from
Nov 8, 2021
Merged

Conversation

JuanTheEngineer
Copy link
Contributor

@JuanTheEngineer JuanTheEngineer commented Nov 2, 2021

Motivation and Context

This PR give FairmotionInterface users the ability to save and load their MoCap Character data to and from JSON metadata files. It also allows for rapid testing by simplifying data setting.

Features

  • A default file and metadata directory will always be created if missing on init().
  • Metadata includes, model build data, motion data, and character rotation and translation offsets.
  • Use command-line arguments to Load whole metadata files or individual attributes completed with default data into the character on init().
  • Save and Load metadata files with P and L, respectively.
  • Quickly Save to generated timestamped file for easy metadata capturing and avoiding user input prompts ("user_YY-MM-DD_hh-mm-ss").
  • Quickly Save to last file fetched for easy file editing with SHIFT+P. This is useful for saving change made by the character mouse positioning.
  • Quickly check what the last file fetched was with CTRL+P.
  • Complex object parsing for including magnum types in metadata files.
  • User input sanitization for file paths.
  • TIP: To rapidly test data attributes, open the default JSON file in the metadata directory and manually modify and save data. Then press R to Reconfigure the scene and character, and press F to Load character data from the default JSON file.

Example Metadata:

{
        "urdf_path": "../habitat-sim/data/test_assets/urdf/amass_male.urdf",
        "amass_path": "../fairmotion/amass_test_data/CMU/CMU/06/06_12_poses.npz",
        "bm_path": "../fairmotion/amass_test_data/smplh/male/model.npz",
        "rotation": Quaternion.rotation(Deg(-90), Vector3.x_axis())
        * Quaternion.rotation(Deg(90), Vector3.z_axis()),
        "translation": Vector3([2.5, 0.0, 0.7])
}

Example Metadata in JSON file:

{"urdf_path": "../habitat-sim/data/test_assets/urdf/amass_male.urdf", "amass_path": "../fairmotion/amass_test_data/CMU/CMU/07/07_01_poses.npz", "bm_path": "../fairmotion/amass_test_data/smplh/male/model.npz", "rotation": [[-0.4999999701976776, 0.4999999701976776, 0.4999999701976776], 0.4999999701976776], "translation": [2.5, 0.07000000029802322, 0.699999988079071]}

How Has This Been Tested

Link to list of test cases passed

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.

@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Nov 2, 2021
@JuanTheEngineer JuanTheEngineer marked this pull request as ready for review November 4, 2021 11:19
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.

A couple things to clean up and then should be ready. Functionality is fine.

examples/fairmotion_interface.py Outdated Show resolved Hide resolved
examples/motion_viewer.py Show resolved Hide resolved
examples/viewer.py Outdated Show resolved Hide resolved
examples/motion_viewer.py Outdated Show resolved Hide resolved
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 good.

@JuanTheEngineer JuanTheEngineer merged commit b573e96 into main Nov 8, 2021
@JuanTheEngineer JuanTheEngineer deleted the fairmotion-save-load branch November 8, 2021 19:51
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