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

[WIP] Ensure contact happens within slicer volume before slicing #588

Draft
wants to merge 6 commits into
base: og-develop
Choose a base branch
from

Conversation

goldenJester
Copy link
Contributor

No description provided.

@@ -89,6 +89,7 @@ def main(random_selection=False, headless=False, short_exec=False):
knife.set_position_orientation(
position=apple.get_position() + np.array([-0.15, 0.0, 0.2]),
orientation=T.euler2quat([-np.pi / 2, 0, 0]),
# orientation=T.euler2quat([np.pi / 2, 0, 0]) # The back of the knife cuts the apple as well
Copy link
Contributor

Choose a reason for hiding this comment

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

In tests/test_transition_rules.py create two unit tests, one that has the object falling on the sharp side and cutting, one that has the object falling on the blunt side and not cutting. Essentially you need to create a function called test_{test_name_here} and run it using pytest tests/test_transition_rules.py and it should pass. Ask for in-person help from Eric if you can't figure out how to run pytest. Once the test is ready, remove this change.

omnigibson/transition_rules.py Outdated Show resolved Hide resolved
omnigibson/transition_rules.py Outdated Show resolved Hide resolved
class TouchingVolumeCheckCondition(TouchingAnyCondition):
def __init__(self, filter_1_name, filter_2_name):
'''
Checks if filter_2_bodies have a contact point within the collision volume generated from each obj in filter_1
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's explicitly say that we are using the slicer meta link as the volume here.

Comment on lines 430 to 434
slicer_volume = None
for name, link in self.obj.links.items():
if 'slicer' in name:
slicer_volume = link
break
Copy link
Contributor

Choose a reason for hiding this comment

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

Ask @cremebrule if this is the best way to do this.

Comment on lines +439 to +442
check_in_volume, _ = generate_points_in_volume_checker_function(
obj=obj,
volume_link=slicer_volume
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Ask @cremebrule if repeatedly creating this function incurs a big performance penalty. We could do something clever here where the volume is known and the checker function pointer is held by the SlicerActive state and here we can just query it.

At the very least, add before this line:

# TODO: Consider moving this to the SlicerActive state for performance.

omnigibson/transition_rules.py Outdated Show resolved Hide resolved
@cgokmen cgokmen changed the title [WIP]SlicerVolume Check [WIP] Ensure contact happens within slicer volume before slicing Feb 6, 2024
@cgokmen
Copy link
Contributor

cgokmen commented Apr 1, 2024

Issue here is that contact points dont show up where you expect them to. We need to figure out what to do

@cgokmen
Copy link
Contributor

cgokmen commented Nov 18, 2024

@cgokmen to look into this later (low prio)

@cgokmen cgokmen self-assigned this Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change sliced rule to check if contact point is within the slicer link volume
2 participants