--Define constant and bindings for stage ID#2325
Merged
Conversation
Improperly terminated string caused a binding to be subsumed into a descriptor string.
aclegg3
approved these changes
Feb 23, 2024
Contributor
aclegg3
left a comment
There was a problem hiding this comment.
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. 🤔
| hit_info = raycast_results.hits[0] | ||
|
|
||
| if hit_info.object_id >= 0: | ||
| if hit_info.object_id > habitat_sim.stage_id: |
Contributor
There was a problem hiding this comment.
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?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 hereHow Has This Been Tested
All c++ and python tests pass locally
Types of changes
Checklist