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 max decimal place option to recorder. #2319

Merged
merged 6 commits into from
Feb 14, 2024
Merged

Conversation

0mdc
Copy link
Contributor

@0mdc 0mdc commented Feb 9, 2024

Motivation and Context

This changes the gfx-replay Recorder to make the maximum float decimal places configurable.

This is an easy way to increase performance of JSON-based systems, as well as making the output text more compact.

Example usage:

sim.gfx_replay_manager.set_max_decimal_places(3)
[...]
sim.gfx_replay_manager.save_keyframe()
keyframe = sim.gfx_replay_manager.write_saved_keyframes_to_string()

Example data (update frames):

Default 3 Decimal Places
4223 bytes 3656 bytes
jsonbefore jsonafter

How Has This Been Tested

Added a unit test, and tested locally on the HITL tool.

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 Feb 9, 2024

// read the playback strings
{
CORRADE_VERIFY(keyframe3Decimals.find("0.555") != std::string::npos);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just FYI, there's TestSuite::Compare::StringContains and also TestSuite::Compare::StringNotContains for better failure diagnostics.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Much cleaner! Thank you!

Copy link
Contributor

@eundersander eundersander left a comment

Choose a reason for hiding this comment

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

Thanks for adding this, including the unit test. I have one request below, otherwise LGTM!

src/esp/gfx/replay/Recorder.h Outdated Show resolved Hide resolved
@0mdc 0mdc merged commit 2c051a6 into main Feb 14, 2024
10 checks passed
@0mdc 0mdc deleted the recorder-max-decimal-places branch February 14, 2024 23:57
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