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

Replace dynamic control APIs with Isaac.Core View APIs #336

Merged
merged 79 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
9f9c64d
Start articulationview work
cgokmen Oct 24, 2023
ea421f8
Merge branch 'og-develop' into articulationview
cgokmen Dec 6, 2023
4af5a0f
Update entityprim to use articulationview instead of dc
cgokmen Dec 6, 2023
323a4c1
Finish changes to entity prim
cgokmen Dec 6, 2023
c1dab0a
Finish removing dc stuff from rigid prim
cgokmen Dec 6, 2023
b5796ef
Some fixes to entity prim
cgokmen Dec 6, 2023
6bff1d7
Some fixes and questions on Tiago
cgokmen Dec 6, 2023
cb7e298
Update scene_base.py
cgokmen Dec 6, 2023
bb8b649
Start implementing JointPrim stuff with extended articulation view
cgokmen Dec 7, 2023
1757231
Remove simulator DC handle
cgokmen Dec 7, 2023
1d92335
Implement the remaining articulation view features
cgokmen Dec 9, 2023
e23f42c
Finish implementing articulationview stuff
cgokmen Dec 11, 2023
76f1165
Use a joint graph to filter AG candidates
cgokmen Dec 12, 2023
fb1aa64
Remove DC reference
cgokmen Dec 12, 2023
bc6f761
Merge branch 'og-develop' into articulationview
cgokmen Dec 12, 2023
0a25495
Match set_local_pose signature to other position/orientation by renam…
cgokmen Dec 12, 2023
85c364b
Address comments
cgokmen Dec 12, 2023
0e93f07
Reorder view creation
cgokmen Dec 12, 2023
8265936
Remove references to mass API
cgokmen Dec 12, 2023
757b144
Some fixes
cgokmen Dec 13, 2023
2c81195
Remove trivial assert function
cgokmen Dec 13, 2023
7348f8d
Fix targets
cgokmen Dec 13, 2023
dac0927
Remove articulation tree, which does not work because fixed links are…
cgokmen Dec 13, 2023
00ce7c5
Fix bug in joint finding
cgokmen Dec 13, 2023
4b6ecc1
Temporarily disable tree-based AG type selection
cgokmen Dec 13, 2023
3462fcc
Fix has_limits
cgokmen Dec 13, 2023
6e31953
Better compute of eef link idx
cgokmen Dec 13, 2023
66a46a8
Remove references to physics view
cgokmen Dec 13, 2023
b922a5f
Some fixes
cgokmen Dec 13, 2023
fe44403
Fix some naiveties
cgokmen Dec 13, 2023
bd54838
Some fixes
cgokmen Dec 13, 2023
d774505
Make nonarticulated entityprims defer to xformprim for position setti…
cgokmen Dec 13, 2023
dd49f35
Reorder some things
cgokmen Dec 13, 2023
8b8eef5
Implement proper is_articulated checks for entity and joint
cgokmen Dec 13, 2023
e5dd359
Back to root path
cgokmen Dec 13, 2023
9e43641
Don't read info about fixed joints
cgokmen Dec 13, 2023
6b0a3f1
Disable a bunch of APIs for kinematic-only bodies.
cgokmen Dec 14, 2023
b610f6d
Create the views during initialization time so that we can use all in…
cgokmen Dec 14, 2023
4d85830
Allow the use of XFormPrim methods until the rigid body is initialized.
cgokmen Dec 14, 2023
fb752fb
Revert "Allow the use of XFormPrim methods until the rigid body is in…
cgokmen Dec 14, 2023
2a078d8
Revert "Create the views during initialization time so that we can us…
cgokmen Dec 14, 2023
ff36fdb
Make n_joints not depend on _links
cgokmen Dec 14, 2023
d785ccd
Move the kinematic_only decision mechanism
cgokmen Dec 14, 2023
e5748b4
Remove unavailable API call
cgokmen Dec 14, 2023
91f6da5
Fix typos
cgokmen Dec 14, 2023
d403e6d
Don't touch gravity on kinematic-only objects
cgokmen Dec 14, 2023
5c2fe60
Don't set mass/density for kinematic-only objects
cgokmen Dec 14, 2023
ffd84bc
Do not initialize rigid prim view for kinematic-only objects.
cgokmen Dec 14, 2023
19b7689
Some fixes
cgokmen Dec 15, 2023
371496f
Some fixes
cgokmen Dec 15, 2023
45010bc
Use custom rigid prim class
cgokmen Dec 15, 2023
e9eda29
Bunch of fixes
cgokmen Dec 16, 2023
8934baa
More verbose error
cgokmen Dec 16, 2023
25beea7
Unbreak cloth
cgokmen Dec 16, 2023
5bd5674
Don't forget to clear the xform API
cgokmen Dec 19, 2023
ae0f5ec
Delegate to RigidPrim instead of XFormPrim if a root link exists
cgokmen Dec 19, 2023
dafe3f7
Update entity_prim.py
cgokmen Dec 19, 2023
9dea922
Make RigidPrim reset BoundingBoxAPI too
cgokmen Dec 19, 2023
5eacdce
Make particles fixed base
cgokmen Dec 19, 2023
de1ee67
Don't set kinematic only manually for particles, this is now auto-com…
cgokmen Dec 19, 2023
86373ee
Some fixes to manipulation robot
cgokmen Dec 19, 2023
f1ace51
better update handles logic
cgokmen Dec 19, 2023
53c62a6
Quick fix
cgokmen Dec 19, 2023
68a6db8
Make the contact API use the sensor paths from the view
cgokmen Dec 19, 2023
1d8a2ec
Some fixes
cgokmen Dec 19, 2023
bca5b73
Some fixes
cgokmen Dec 19, 2023
a298dc3
Check if sim is playing
cgokmen Dec 19, 2023
8158f55
Apply the valid view requirement only for initialized objects
cgokmen Dec 19, 2023
87ebe88
Revert "Remove articulation tree, which does not work because fixed l…
cgokmen Dec 20, 2023
c98979a
Reimplement articulation graph
cgokmen Dec 20, 2023
73fdb83
Fix articulation tree
cgokmen Dec 20, 2023
10804c1
Small fix
cgokmen Dec 20, 2023
588ffab
Fix joint type
cgokmen Dec 20, 2023
263fa51
Fix RigidContactAPI
cgokmen Dec 20, 2023
508db28
Undo changes to RigidContactAPI
cgokmen Dec 20, 2023
f945361
Fix AG mechanism
cgokmen Dec 20, 2023
2174058
Small bugfix
cgokmen Dec 20, 2023
7958f5c
Address comments
cgokmen Dec 21, 2023
8d58b6c
Merge branch 'og-develop' into articulationview
cgokmen Dec 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion omnigibson/object_states/particle_modifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ def overlap_callback(hit):
z_offset = 0.0 if self._projection_mesh_params["type"] == "Sphere" else self._projection_mesh_params["extents"][2] / 2

self.projection_mesh.set_local_pose(
translation=np.array([0, 0, -z_offset]),
position=np.array([0, 0, -z_offset]),
orientation=T.euler2quat([0, 0, 0]),
)

Expand Down
2 changes: 1 addition & 1 deletion omnigibson/object_states/toggle.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def _initialize(self):
self.visual_marker.visible = True

# Make sure the marker isn't translated at all
self.visual_marker.set_local_pose(translation=np.zeros(3), orientation=np.array([0, 0, 0, 1.0]))
self.visual_marker.set_local_pose(position=np.zeros(3), orientation=np.array([0, 0, 0, 1.0]))

# Store the projection mesh's IDs
projection_mesh_ids = PhysicsSchemaTools.encodeSdfPath(self.visual_marker.prim_path)
Expand Down
2 changes: 1 addition & 1 deletion omnigibson/objects/controllable_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def reload_controllers(self, controller_config=None):
else self._create_continuous_action_space()

def reset(self):
# Make sure simulation is playing, otherwise, we cannot reset because DC requires active running
# Make sure simulation is playing, otherwise, we cannot reset because physx requires active running
# simulation in order to set joints
assert og.sim.is_playing(), "Simulator must be playing in order to reset controllable object's joints!"

Expand Down
5 changes: 5 additions & 0 deletions omnigibson/objects/dataset_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def __init__(
visible=True,
fixed_base=False,
visual_only=False,
kinematic_only=None,
self_collisions=False,
prim_type=PrimType.RIGID,
load_config=None,
Expand Down Expand Up @@ -83,6 +84,9 @@ def __init__(
visible (bool): whether to render this object or not in the stage
fixed_base (bool): whether to fix the base of this object or not
visual_only (bool): Whether this object should be visual only (and not collide with any other objects)
kinematic_only (None or bool): Whether this object should be kinematic only (and not get affected by any
collisions). If None, then this value will be set to True if @fixed_base is True and some other criteria
cgokmen marked this conversation as resolved.
Show resolved Hide resolved
are satisfied (see object_base.py post_load function), else False.
self_collisions (bool): Whether to enable self collisions for this object
prim_type (PrimType): Which type of prim the object is, Valid options are: {PrimType.RIGID, PrimType.CLOTH}
load_config (None or dict): If specified, should contain keyword-mapped values that are relevant for
Expand Down Expand Up @@ -136,6 +140,7 @@ def __init__(
visible=visible,
fixed_base=fixed_base,
visual_only=visual_only,
kinematic_only=kinematic_only,
self_collisions=self_collisions,
prim_type=prim_type,
include_default_states=include_default_states,
Expand Down
50 changes: 33 additions & 17 deletions omnigibson/objects/object_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def __init__(
visible=True,
fixed_base=False,
visual_only=False,
kinematic_only=None,
self_collisions=False,
prim_type=PrimType.RIGID,
load_config=None,
Expand All @@ -68,6 +69,9 @@ def __init__(
visible (bool): whether to render this object or not in the stage
fixed_base (bool): whether to fix the base of this object or not
visual_only (bool): Whether this object should be visual only (and not collide with any other objects)
kinematic_only (None or bool): Whether this object should be kinematic only (and not get affected by any
collisions). If None, then this value will be set to True if @fixed_base is True and some other criteria
cgokmen marked this conversation as resolved.
Show resolved Hide resolved
are satisfied (see object_base.py post_load function), else False.
self_collisions (bool): Whether to enable self collisions for this object
prim_type (PrimType): Which type of prim the object is, Valid options are: {PrimType.RIGID, PrimType.CLOTH}
load_config (None or dict): If specified, should contain keyword-mapped values that are relevant for
Expand Down Expand Up @@ -104,6 +108,7 @@ def __init__(
load_config["scale"] = np.array(scale) if isinstance(scale, Iterable) else scale
load_config["visible"] = visible
load_config["visual_only"] = visual_only
load_config["kinematic_only"] = kinematic_only
load_config["self_collisions"] = self_collisions
load_config["prim_type"] = prim_type

Expand Down Expand Up @@ -136,9 +141,37 @@ def remove(self):
log.info(f"Removed {self.name} from {self.prim_path}")

def _post_load(self):
# Add fixed joint or make object kinematic only if we're fixing the base
kinematic_only = False
if self.fixed_base:
# For optimization purposes, if we only have a single rigid body that has either
# (no custom scaling OR no fixed joints), we assume this is not an articulated object so we
# merely set this to be a static collider, i.e.: kinematic-only
# The custom scaling / fixed joints requirement is needed because omniverse complains about scaling that
# occurs with respect to fixed joints, as omni will "snap" bodies together otherwise
scale = np.ones(3) if self._load_config["scale"] is None else np.array(self._load_config["scale"])
if self.n_joints == 0 and (np.all(np.isclose(scale, 1.0, atol=1e-3)) or self.n_fixed_joints == 0) and (self._load_config["kinematic_only"] != False):
kinematic_only = True

# Validate that we didn't make a kinematic-only decision that does not match
assert self._load_config["kinematic_only"] is None or kinematic_only == self._load_config["kinematic_only"], \
f"Kinematic only decision does not match! Got: {kinematic_only}, expected: {self._load_config['kinematic_only']}"

# Actually apply the kinematic-only decision
self._load_config["kinematic_only"] = kinematic_only

# Run super first
super()._post_load()

# If the object is fixed_base but kinematic only is false, create the joint
cgokmen marked this conversation as resolved.
Show resolved Hide resolved
if self.fixed_base and not self.kinematic_only:
# Create fixed joint, and set Body0 to be this object's root prim
create_joint(
prim_path=f"{self._prim_path}/rootJoint",
joint_type="FixedJoint",
body1=f"{self._prim_path}/{self._root_link_name}",
)

# Set visibility
if "visible" in self._load_config and self._load_config["visible"] is not None:
self.visible = self._load_config["visible"]
Expand All @@ -148,23 +181,6 @@ def _post_load(self):
self._prim.RemoveAPI(UsdPhysics.ArticulationRootAPI)
self._prim.RemoveAPI(PhysxSchema.PhysxArticulationAPI)

# Add fixed joint if we're fixing the base
if self.fixed_base:
# For optimization purposes, if we only have a single rigid body that has either
# (no custom scaling OR no fixed joints), we assume this is not an articulated object so we
# merely set this to be a static collider, i.e.: kinematic-only
# The custom scaling / fixed joints requirement is needed because omniverse complains about scaling that
# occurs with respect to fixed joints, as omni will "snap" bodies together otherwise
if self.n_joints == 0 and (np.all(np.isclose(self.scale, 1.0, atol=1e-3)) or self.n_fixed_joints == 0):
self.kinematic_only = True
else:
# Create fixed joint, and set Body0 to be this object's root prim
create_joint(
prim_path=f"{self._prim_path}/rootJoint",
joint_type="FixedJoint",
body1=f"{self._prim_path}/{self._root_link_name}",
)

# Potentially add articulation root APIs and also set self collisions
root_prim = None if self.articulation_root_path is None else get_prim_at_path(self.articulation_root_path)
if root_prim is not None:
Expand Down
5 changes: 5 additions & 0 deletions omnigibson/objects/primitive_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def __init__(
visible=True,
fixed_base=False,
visual_only=False,
kinematic_only=None,
self_collisions=False,
prim_type=PrimType.RIGID,
load_config=None,
Expand Down Expand Up @@ -66,6 +67,9 @@ def __init__(
visible (bool): whether to render this object or not in the stage
fixed_base (bool): whether to fix the base of this object or not
visual_only (bool): Whether this object should be visual only (and not collide with any other objects)
kinematic_only (None or bool): Whether this object should be kinematic only (and not get affected by any
collisions). If None, then this value will be set to True if @fixed_base is True and some other criteria
cgokmen marked this conversation as resolved.
Show resolved Hide resolved
are satisfied (see object_base.py post_load function), else False.
self_collisions (bool): Whether to enable self collisions for this object
prim_type (PrimType): Which type of prim the object is, Valid options are: {PrimType.RIGID, PrimType.CLOTH}
load_config (None or dict): If specified, should contain keyword-mapped values that are relevant for
Expand Down Expand Up @@ -110,6 +114,7 @@ def __init__(
visible=visible,
fixed_base=fixed_base,
visual_only=visual_only,
kinematic_only=kinematic_only,
self_collisions=self_collisions,
prim_type=prim_type,
include_default_states=include_default_states,
Expand Down
5 changes: 5 additions & 0 deletions omnigibson/objects/stateful_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def __init__(
visible=True,
fixed_base=False,
visual_only=False,
kinematic_only=None,
self_collisions=False,
prim_type=PrimType.RIGID,
load_config=None,
Expand All @@ -89,6 +90,9 @@ def __init__(
visible (bool): whether to render this object or not in the stage
fixed_base (bool): whether to fix the base of this object or not
visual_only (bool): Whether this object should be visual only (and not collide with any other objects)
kinematic_only (None or bool): Whether this object should be kinematic only (and not get affected by any
collisions). If None, then this value will be set to True if @fixed_base is True and some other criteria
cgokmen marked this conversation as resolved.
Show resolved Hide resolved
are satisfied (see object_base.py post_load function), else False.
self_collisions (bool): Whether to enable self collisions for this object
prim_type (PrimType): Which type of prim the object is, Valid options are: {PrimType.RIGID, PrimType.CLOTH}
load_config (None or dict): If specified, should contain keyword-mapped values that are relevant for
Expand Down Expand Up @@ -129,6 +133,7 @@ def __init__(
visible=visible,
fixed_base=fixed_base,
visual_only=visual_only,
kinematic_only=kinematic_only,
self_collisions=self_collisions,
prim_type=prim_type,
load_config=load_config,
Expand Down
5 changes: 5 additions & 0 deletions omnigibson/objects/usd_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def __init__(
visible=True,
fixed_base=False,
visual_only=False,
kinematic_only=None,
self_collisions=False,
prim_type=PrimType.RIGID,
load_config=None,
Expand All @@ -52,6 +53,9 @@ def __init__(
visible (bool): whether to render this object or not in the stage
fixed_base (bool): whether to fix the base of this object or not
visual_only (bool): Whether this object should be visual only (and not collide with any other objects)
kinematic_only (None or bool): Whether this object should be kinematic only (and not get affected by any
collisions). If None, then this value will be set to True if @fixed_base is True and some other criteria
cgokmen marked this conversation as resolved.
Show resolved Hide resolved
are satisfied (see object_base.py post_load function), else False.
self_collisions (bool): Whether to enable self collisions for this object
prim_type (PrimType): Which type of prim the object is, Valid options are: {PrimType.RIGID, PrimType.CLOTH}
load_config (None or dict): If specified, should contain keyword-mapped values that are relevant for
Expand All @@ -77,6 +81,7 @@ def __init__(
visible=visible,
fixed_base=fixed_base,
visual_only=visual_only,
kinematic_only=kinematic_only,
self_collisions=self_collisions,
prim_type=prim_type,
include_default_states=include_default_states,
Expand Down
Loading
Loading