Skip to content

--Define constant and bindings for stage ID#2325

Merged
jturner65 merged 4 commits intomainfrom
StageID_Binding
Feb 26, 2024
Merged

--Define constant and bindings for stage ID#2325
jturner65 merged 4 commits intomainfrom
StageID_Binding

Conversation

@jturner65
Copy link
Copy Markdown
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
@jturner65 jturner65 requested a review from aclegg3 February 22, 2024 19:39
Copy link
Copy Markdown
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. 🤔

Comment thread examples/viewer.py
hit_info = raycast_results.hits[0]

if hit_info.object_id >= 0:
if hit_info.object_id > habitat_sim.stage_id:
Copy link
Copy Markdown
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
@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.

3 participants