objects = []
# Base position values
base_x = 3.5
y_pos = 4.5
z_pos = 0.95
# Create 9 objects with an offset of 0.3 meters on the x-axis
for i in range(9):
obj = AssetBaseCfg(
prim_path=f"/World/Object_{i+1}", # Replace "/World" with your desired namespace
spawn=sim_utils.CuboidCfg(size=[0.3, 0.3, 0.3], visual_material=sim_utils.PreviewSurfaceCfg(diffuse_color=(0.0, 0.9, 0.0))),
init_state=AssetBaseCfg.InitialStateCfg(pos=[base_x + i*0.3, y_pos, z_pos])
)
objects.append(obj)
However, this provides the following error:
Traceback (most recent call last):
File "C:\Users\Owner\Documents\GitHub\IsaacLab\source\standalone\demos\ada\ada.py", line 349, in <module>
main()
File "C:\Users\Owner\Documents\GitHub\IsaacLab\source\standalone\demos\ada\ada.py", line 326, in main
env = CameraAgentEnv()
File "C:\Users\Owner\Documents\GitHub\IsaacLab\source\standalone\demos\ada\ada.py", line 234, in __init__
self.scene = self.create_scene()
File "C:\Users\Owner\Documents\GitHub\IsaacLab\source\standalone\demos\ada\ada.py", line 256, in create_scene
scene = InteractiveScene(scene_cfg)
File "c:\users\owner\documents\github\isaaclab\source\extensions\omni.isaac.lab\omni\isaac\lab\scene\interactive_scene.py", line 145, in __init__
self._add_entities_from_cfg()
File "c:\users\owner\documents\github\isaaclab\source\extensions\omni.isaac.lab\omni\isaac\lab\scene\interactive_scene.py", line 444, in _add_entities_from_cfg
asset_cfg.prim_path = asset_cfg.prim_path.format(ENV_REGEX_NS=self.env_regex_ns)
AttributeError: 'list' object has no attribute 'prim_path'
Question
I would like to add several object assets like so:
using a for loop, like so:
However, this provides the following error:
How can I do this properly?