Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 embodichain/lab/gym/envs/embodied_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ def preview_sensor_data(
cv2.imshow(window_name, cv2.cvtColor(view, cv2.COLOR_RGB2BGR))
cv2.waitKey(0)
cv2.destroyWindow(window_name)

elif method == "plt":
from matplotlib import pyplot as plt

Expand Down
9 changes: 9 additions & 0 deletions embodichain/lab/sim/sensors/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,15 @@ def group_id(self) -> int:
)
return -1

@property
def is_attached(self) -> bool:
"""Check if the camera is attached to a parent entity.

Returns:
bool: True if the camera is attached to a parent entity, False otherwise.
"""
return self.cfg.extrinsics.parent is not None

def update(self, **kwargs) -> None:
"""Update the sensor data.

Expand Down
8 changes: 8 additions & 0 deletions embodichain/lab/sim/sim_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,14 @@ def get_light(self, uid: str) -> Light | None:
return None
return self._lights[uid]

def get_light_uid_list(self) -> List[str]:
"""Get current light uid list

Returns:
List[str]: list of light uid.
"""
return list(self._lights.keys())

def add_rigid_object(
self,
cfg: RigidObjectCfg,
Expand Down
7 changes: 5 additions & 2 deletions embodichain/lab/sim/utility/gizmo_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ def gizmo_transform_callback(node, translation, rotation, flag):


def run_gizmo_robot_control_loop(
robot: "Robot", control_part: str = "arm", end_link_name: str | None = None
robot: object | str, control_part: str = "arm", end_link_name: str | None = None
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

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

The type hint for the 'robot' parameter uses 'object | str' in the function signature, but the docstring specifies 'Robot | str'. For consistency and better type safety, consider using the specific type 'Robot | str' in the function signature. The Robot class is already imported at line 83 inside the function, and could be imported at the module level or used with TYPE_CHECKING (which is already imported at line 24) and forward references like the existing pattern at lines 27-28.

Suggested change
robot: object | str, control_part: str = "arm", end_link_name: str | None = None
robot: "Robot" | str, control_part: str = "arm", end_link_name: str | None = None

Copilot uses AI. Check for mistakes.
):
"""Run a control loop for testing gizmo controls on a robot.

This function implements a control loop that allows users to manipulate a robot
using gizmo controls with keyboard input for additional commands.

Args:
robot (Robot): The robot to control with the gizmo.
robot (Robot | str): The robot to control with the gizmo.
control_part (str, optional): The part of the robot to control. Defaults to "arm".
end_link_name (str | None, optional): The name of the end link for FK calculations. Defaults to None.

Expand Down Expand Up @@ -87,6 +87,9 @@ def run_gizmo_robot_control_loop(

sim = SimulationManager.get_instance()

if isinstance(robot, str):
robot = sim.get_robot(uid=robot)
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

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

Missing null check after 'sim.get_robot(uid=robot)'. The 'get_robot' method returns 'Robot | None' and logs a warning if the robot is not found, but the code proceeds without checking if the returned value is None. This could lead to an AttributeError when trying to access robot methods on the next lines. Add a null check and return early if the robot is not found.

Suggested change
robot = sim.get_robot(uid=robot)
robot_uid = robot
robot = sim.get_robot(uid=robot_uid)
if robot is None:
log_error(f"Robot with uid '{robot_uid}' not found; aborting gizmo control loop.")
return

Copilot uses AI. Check for mistakes.

# Enter auto-update mode.
sim.set_manual_update(False)

Expand Down
Loading
Loading