Skip to content

Commit

Permalink
Merge pull request #494 from Kashu7100/fix_480
Browse files Browse the repository at this point in the history
[BUG FIX] _id to uid
  • Loading branch information
zhouxian authored Jan 8, 2025
2 parents b4a73a5 + e7c7812 commit 35d3448
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
32 changes: 16 additions & 16 deletions genesis/engine/entities/rigid_entity/rigid_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -1415,16 +1415,16 @@ def _ompl_state_to_tensor(self, state):
# ---------------------------------- control & io ------------------------------------
# ------------------------------------------------------------------------------------

def get_joint(self, name=None, id=None):
def get_joint(self, name=None, uid=None):
"""
Get a RigidJoint object by name or id.
Get a RigidJoint object by name or uid.
Parameters
----------
name : str, optional
The name of the joint. Defaults to None.
id : str, optional
The id of the joint. This can be a substring of the joint's id. Defaults to None.
uid : str, optional
The uid of the joint. This can be a substring of the joint's uid. Defaults to None.
Returns
-------
Expand All @@ -1438,25 +1438,25 @@ def get_joint(self, name=None, id=None):
return joint
gs.raise_exception(f"Joint not found for name: {name}.")

elif id is not None:
elif uid is not None:
for joint in self._joints:
if id in str(joint.id):
if uid in str(joint.uid):
return joint
gs.raise_exception(f"Joint not found for id: {id}.")
gs.raise_exception(f"Joint not found for uid: {uid}.")

else:
gs.raise_exception("Neither `name` nor `id` is provided.")
gs.raise_exception("Neither `name` nor `uid` is provided.")

def get_link(self, name=None, id=None):
def get_link(self, name=None, uid=None):
"""
Get a RigidLink object by name or id.
Get a RigidLink object by name or uid.
Parameters
----------
name : str, optional
The name of the link. Defaults to None.
id : str, optional
The id of the link. This can be a substring of the link's id. Defaults to None.
uid : str, optional
The uid of the link. This can be a substring of the link's uid. Defaults to None.
Returns
-------
Expand All @@ -1470,14 +1470,14 @@ def get_link(self, name=None, id=None):
return link
gs.raise_exception(f"Link not found for name: {name}.")

elif id is not None:
elif uid is not None:
for link in self._links:
if id in str(link.id):
if uid in str(link.uid):
return link
gs.raise_exception(f"Link not found for id: {id}.")
gs.raise_exception(f"Link not found for uid: {uid}.")

else:
gs.raise_exception("Neither `name` nor `id` is provided.")
gs.raise_exception("Neither `name` nor `uid` is provided.")

@gs.assert_built
def get_pos(self, envs_idx=None):
Expand Down
2 changes: 1 addition & 1 deletion genesis/vis/raytracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def add_mesh_light(self, mesh, color, intensity, pos, quat, revert_dir=False, do
double_sided=double_sided,
beam_angle=beam_angle,
),
name=str(mesh._id),
name=str(mesh.uid),
revert_dir=revert_dir,
)
)
Expand Down

0 comments on commit 35d3448

Please sign in to comment.