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

--Define constant and bindings for stage ID #2325

Merged
merged 4 commits into from
Feb 26, 2024
Merged

--Define constant and bindings for stage ID #2325

merged 4 commits into from
Feb 26, 2024

Conversation

jturner65
Copy link
Contributor

Motivation and Context

The stage ID is referenced in python and from lab in numerous places, usually as a mark of where added objects' ids begin, or else as a final target for collision detection. Unfortunately, this is often referenced or checked by using magic number references to the stage (i.e. -1).

This PR introduces a global constant to denote the stage ID (esp::RIGID_STAGE_ID), and bindings to that constant to expose it to python (habitat_sim.stage_id), which should be used to refer to the stage ID. A matching Habitat-Lab PR is pending for this support as well, once this PR is merged. Ultimately this is to facilitate the instanced -based semantic sensor support PR here

How Has This Been Tested

All c++ and python tests pass locally

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 22, 2024
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.

This step seems fine. My comments are mostly forward thinking about when this id will change in the future.
For example, replacing "==0" with "==stage_id+1" seems like a strong assumption about the value.
Next step may be to update the "allocateObjectID" system to handle this value. 🤔

@@ -723,7 +723,7 @@ def mouse_press_event(self, event: Application.MouseEvent) -> None:
hit_object, ao_link = -1, -1
hit_info = raycast_results.hits[0]

if hit_info.object_id >= 0:
if hit_info.object_id > habitat_sim.stage_id:
Copy link
Contributor

Choose a reason for hiding this comment

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

Using "greater than" here still assumes that stage_id will always be less than all object ids. While this is the case currently does it defeat the purpose of having a variable?

@jturner65 jturner65 merged commit d513cc4 into main Feb 26, 2024
10 checks passed
@jturner65 jturner65 deleted the StageID_Binding branch February 26, 2024 17:22
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.

None yet

3 participants