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

--[BE/Bugfix] Early Bullet/Physics enabled check; C++ test fixes for no-bullet; Python enable_physics default change if no_bullet #2189

Merged
merged 9 commits into from
Aug 22, 2023

Conversation

jturner65
Copy link
Contributor

@jturner65 jturner65 commented Aug 18, 2023

Motivation and Context

This PR contains a bugfix and a few updates/improvements relating to whether Bullet dynamics library is present or not.

  • An ESP_CHECK was added early in Simulator::reconfigure() that would fail if the user has set their Simulator Configuration to have physics enabled but did not compile Habitat-Sim with Bullet enabled. If this is the state of things, we want it discovered as early as possible so that the user can address it before a long training regimen is initiated.
  • SimTest was updated to only set enablePhysics to true if built with Bullet, and also to test -all- tests using both SimConfig and MM-based simulator creation; furthermore, the tests that expressly rely on Bullet physics - createMagnumRenderingOff and testArticulatedObjectSkinned - are only enabled if Bullet is present and enabled.
  • PhysicsTest and ReplicaSceneTest also got similar treatment, where tests that were dependent on Bullet only were executed if built with Bullet.
  • The default python sim_cfg value for enable_physics was changed from True to "habitat_sim.bindings.built_with_bullet", which will still be true for folks who have bullet but will not automatically fail for folks who do not unless they explicitly change it.
  • Some python tests and examples were updated to only require Bullet/enable physics if they actually used dynamics, so that the test would still execute if Bullet was not present. Those examples that did require dynamics are now skipped properly if Bullet is not present.

How Has This Been Tested

Locally C++ and python tests pass. Some of the python tests required modifications or skipping if bullet was not present).

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 Aug 18, 2023
@jturner65 jturner65 changed the title --[BE/Bugfix] Early proper Bullet/Physics enabled check and simTest fixes --[BE/Bugfix] Early Bullet/Physics enabled check; C++ test fixes for no-bullet; Python enable_physics default change if no_bullet Aug 18, 2023
@jturner65 jturner65 force-pushed the BE_PhysicsCheckAndTestFixes branch 2 times, most recently from 2051c3a to 93edb9e Compare August 18, 2023 17:04
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 few minor nits ans suggestion.
Overall, looks good. I like your idea to fill the enable_physics default from the built_with_bullet arg. 👍

Comment on lines 111 to 112
"cfg.enable_physics to False, or verify your Bullet installation "
"and recompile Habitat-Sim using the '--bullet' flag.");
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggesting on the message advice. This change probably needs to be re-formatted with pre-commit.

Suggested change
"cfg.enable_physics to False, or verify your Bullet installation "
"and recompile Habitat-Sim using the '--bullet' flag.");
"cfg.enable_physics to False, or verify your Bullet installation (e.g. "
recompile Habitat-Sim using the '--bullet' flag or choose a 'withbullet' conda build).");

@@ -63,10 +83,14 @@ def powerset(iterable):
("examples/tutorials/async_rendering.py",),
],
)
def test_example_modules(args):
def test_example_modules_no_bullet(args):
Copy link
Contributor

Choose a reason for hiding this comment

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

Naming nit. Some of these (e.g. managed_rigid_object_tutorial) are optional physics rather than no-physics.

Suggested change
def test_example_modules_no_bullet(args):
def test_example_modules_optional_bullet(args):

run_main_subproc(args)


@pytest.mark.skipif(
not habitat_sim.bindings.built_with_bullet,
reason="Bullet physics required for ReplicaCAD Artciulated Objects.",
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
reason="Bullet physics required for ReplicaCAD Artciulated Objects.",
reason="Bullet physics required for ReplicaCAD Articulated Objects.",

…ullet

If bullet is not found or was not used to compile HabitatSim, enablePhysics should never be true. We want to fail early on this to make the user aware before training begins.
--Make enable physics true only if built with Bullet
--Make all tests use both the SimConfig and MetadataMediator methods for creating a Simulator.

TODO : disable tests that explicitly rely on Bullet if Bullet not found.
…th bullet.

Note : there may now be situations where enable_physics is explicitly, although perhaps needlessly ,set to True that will now fail if no Bullet is present.
We just want to skip Bullet-dependent tests if Bullet is absent.
@jturner65 jturner65 merged commit f65556a into main Aug 22, 2023
1 check passed
@jturner65 jturner65 deleted the BE_PhysicsCheckAndTestFixes branch August 22, 2023 01:36
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.

3 participants