Problem loading camera and setting prim path
Isaac Sim Version
4.5.0
IsaacLab Version
2.1.0
Operating System
Ubuntu 22.04
Topic Description
Detailed Description
I have tried to spawn the prim path for cameracfg, but I constantly encounter a prim path error.
NV_REGEX_NS}/Leatherback/Rigid_Bodies/Chassis/Camera_Right' is not global. It must start with '
Error Messages
source/isaaclab_tasks/isaaclab_tasks/direct/leatherback/leatherback_env.py", line 104, in _setup_scene
self.camera = Camera(cfg=self.cfg.camera_cfg)
File "saacLab/source/isaaclab/isaaclab/sensors/camera/camera.py", line 133, in __init__
self.cfg.spawn.func(
File "IsaacLab/source/isaaclab/isaaclab/sim/utils.py", line 229, in wrapper
raise ValueError(f"Prim path '{prim_path}' is not global. It must start with '/'.")
ValueError: Prim path '{ENV_REGEX_NS}/Leatherback/Rigid_Bodies/Chassis/Camera_Right' is not global. It must start with '/'.
Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.
Additional Information
What I’ve Tried
I have tried different camera configurations in cameracfg, I am using leatherback example for Isaaclab:
@configclass
class LeatherbackEnvCfg(DirectRLEnvCfg):
decimation = 4
episode_length_s = 20.0
action_space = 2
observation_space = 8
state_space = 0
sim: SimulationCfg = SimulationCfg(dt=1 / 60, render_interval=decimation)
robot_cfg: ArticulationCfg = LEATHERBACK_CFG.replace(prim_path="/World/envs/env_.*/Robot")
waypoint_cfg = WAYPOINT_CFG
throttle_dof_name = [
"Wheel__Knuckle__Front_Left",
"Wheel__Knuckle__Front_Right",
"Wheel__Upright__Rear_Right",
"Wheel__Upright__Rear_Left"
]
steering_dof_name = [
"Knuckle__Upright__Front_Right",
"Knuckle__Upright__Front_Left",
]
camera_cfg: CameraCfg = CameraCfg(
prim_path="{ENV_REGEX_NS}/Leatherback/Rigid_Bodies/Chassis/Camera_Right",
update_period=0.1,
width=640,
height=480,
data_types=["rgb", "distance_to_image_plane"],
spawn=sim_utils.PinholeCameraCfg(
focal_length=24.0,
focus_distance=400.0,
horizontal_aperture=20.955,
clipping_range=(0.1, 1e5),
),
)
and then set up the scene:
class LeatherbackEnv(DirectRLEnv):
cfg: LeatherbackEnvCfg
def __init__(self, cfg: LeatherbackEnvCfg, render_mode: str | None = None, **kwargs):
super().__init__(cfg, render_mode, **kwargs)
self._throttle_dof_idx, _ = self.leatherback.find_joints(self.cfg.throttle_dof_name)
self._steering_dof_idx, _ = self.leatherback.find_joints(self.cfg.steering_dof_name)
self._throttle_state = torch.zeros((self.num_envs,4), device=self.device, dtype=torch.float32)
self._steering_state = torch.zeros((self.num_envs,2), device=self.device, dtype=torch.float32)
self._goal_reached = torch.zeros((self.num_envs), device=self.device, dtype=torch.int32)
self.task_completed = torch.zeros((self.num_envs), device=self.device, dtype=torch.bool)
self._num_goals = 10
self._target_positions = torch.zeros((self.num_envs, self._num_goals, 2), device=self.device, dtype=torch.float32)
self._markers_pos = torch.zeros((self.num_envs, self._num_goals, 3), device=self.device, dtype=torch.float32)
self.env_spacing = self.cfg.env_spacing
self.course_length_coefficient = 2.5
self.course_width_coefficient = 2.0
self.position_tolerance = 0.15
self.goal_reached_bonus = 10.0
self.position_progress_weight = 1.0
self.heading_coefficient = 0.25
self.heading_progress_weight = 0.05
self._target_index = torch.zeros((self.num_envs), device=self.device, dtype=torch.int32)
def _setup_scene(self):
# Create a large ground plane without grid
spawn_ground_plane(
prim_path="/World/ground",
cfg=GroundPlaneCfg(
size=(500.0, 500.0), # Much larger ground plane (500m x 500m)
color=(0.2, 0.2, 0.2), # Dark gray color
physics_material=sim_utils.RigidBodyMaterialCfg(
friction_combine_mode="multiply",
restitution_combine_mode="multiply",
static_friction=1.0,
dynamic_friction=1.0,
restitution=0.0,
),
),
)
self.cfg.camera_cfg.prim_path = self.cfg.camera_cfg.prim_path.format(ENV_REGEX_NS=self.scene.env_regex_ns)
print(self.cfg.camera_cfg.prim_path)
# Add camera
# Instantiate the camera
self.camera = Camera(cfg=self.cfg.camera_cfg)
# Add camera to the scene
self.scene.sensors["camera"] = self.camera
# Setup rest of the scene
self.leatherback = Articulation(self.cfg.robot_cfg)
self.waypoints = VisualizationMarkers(self.cfg.waypoint_cfg)
self.object_state = []
self.scene.clone_environments(copy_from_source=False)
self.scene.filter_collisions(global_prim_paths=[])
self.scene.articulations["leatherback"] = self.leatherback
# Add lighting
light_cfg = sim_utils.DomeLightCfg(intensity=2000.0, color=(0.75, 0.75, 0.75))
light_cfg.func("/World/Light", light_cfg)