Skip to content

Commit

Permalink
Rebase symbolic primitives on regular ones
Browse files Browse the repository at this point in the history
  • Loading branch information
cgokmen committed Sep 26, 2023
1 parent 3f66f9a commit 4acca40
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 476 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
See provided behavior_robot_mp_behavior_task.yaml config file for an example. See examples/action_primitives for
runnable examples.
"""
import copy
import inspect
import logging
import random
Expand All @@ -17,8 +16,6 @@
import gym
import numpy as np
from scipy.spatial.transform import Rotation, Slerp
from omnigibson.utils.constants import JointType
from pxr import PhysxSchema

import omnigibson as og
from omnigibson import object_states
Expand All @@ -43,15 +40,12 @@
get_grasp_position_for_open
)
from omnigibson.controllers.controller_base import ControlType
from omnigibson.prims import CollisionGeomPrim
from omnigibson.utils.control_utils import FKSolver

from omni.usd.commands import CopyPrimCommand, CreatePrimCommand
from omni.isaac.core.utils.prims import get_prim_at_path
from pxr import Gf

import os
from omnigibson.macros import gm
from omnigibson.objects.usd_object import USDObject

DEFAULT_BODY_OFFSET_FROM_FLOOR = 0.05
Expand Down Expand Up @@ -221,7 +215,7 @@ class StarterSemanticActionPrimitiveSet(IntEnum):
TOGGLE_OFF = 8

class StarterSemanticActionPrimitives(BaseActionPrimitiveSet):
def __init__(self, task, scene, robot, teleport=False, add_context=True):
def __init__(self, task, scene, robot, teleport=False, add_context=False):
logger.warning(
"The StarterSemanticActionPrimitive is a work-in-progress and is only provided as an example. "
"It currently only works with BehaviorRobot with its JointControllers set to absolute mode. "
Expand Down Expand Up @@ -1604,7 +1598,6 @@ def _sample_pose_near_object(self, obj, pose_on_obj=None, **kwargs):
- 4-array: (x,y,z,w) Quaternion orientation in the world frame
"""
with UndoableContext(self.robot, self.robot_copy, "simplified") as context:
obj_rooms = obj.in_rooms if obj.in_rooms else [self.scene._seg_map.get_room_instance_by_point(pose_on_obj[0][:2])]
for _ in range(MAX_ATTEMPTS_FOR_SAMPLING_POSE_NEAR_OBJECT):
if pose_on_obj is None:
pos_on_obj = self._sample_position_on_aabb_face(obj)
Expand All @@ -1617,6 +1610,7 @@ def _sample_pose_near_object(self, obj, pose_on_obj=None, **kwargs):
[pose_on_obj[0][0] + distance * np.cos(yaw), pose_on_obj[0][1] + distance * np.sin(yaw), yaw + np.pi - avg_arm_workspace_range]
)
# Check room
obj_rooms = obj.in_rooms if obj.in_rooms else [self.scene._seg_map.get_room_instance_by_point(pose_on_obj[0][:2])]
if self.scene._seg_map.get_room_instance_by_point(pose_2d[:2]) not in obj_rooms:
indented_print("Candidate position is in the wrong room.")
continue
Expand Down
Loading

0 comments on commit 4acca40

Please sign in to comment.