3333from arena_simulation_setup .shared import Obstacle as ObstacleDefinition
3434from arena_simulation_setup .tree .Wall import WallSegment
3535from isaacsim_msgs .msg import (
36+ Ceiling ,
3637 Floor ,
3738 Material ,
3839 Prim ,
4243 DeletePrims ,
4344 EditPrims ,
4445 ResetWorld ,
46+ SpawnCeilings ,
4547 SpawnFloors ,
4648 SpawnPrims ,
4749 SpawnUrdf ,
4850 SpawnUsd ,
4951 SpawnWalls ,
5052)
53+ from task_generator .shared import Ceiling as CeilingDefinition
5154from task_generator .shared import (
5255 DynamicObstacle ,
5356 Model ,
@@ -194,6 +197,7 @@ def __init__(self, *args: object, **kwargs: object) -> None:
194197 self ._NS_ROBOT = Namespace (env_prefix )('Robots' )
195198 self ._NS_WALL = Namespace (env_prefix )('Walls' )
196199 self ._NS_FLOOR = Namespace (env_prefix )('Floors' )
200+ self ._NS_CEILING = Namespace (env_prefix )('Ceilings' )
197201
198202 self .wall_counter = itertools .count ()
199203 self .floor_counter = itertools .count ()
@@ -204,6 +208,7 @@ def __init__(self, *args: object, **kwargs: object) -> None:
204208 MovePedestrians = self .node .create_client_wrapper (MovePedestrians , "/isaac/MovePedestrians" ),
205209 ResetWorld = self .node .create_client_wrapper (ResetWorld , "/isaac/ResetWorld" ),
206210 UpdatePedestrians = self .node .create_client_wrapper (UpdatePedestrians , "/isaac/UpdatePedestrians" ),
211+ SpawnCeilings = self .node .create_client_wrapper (SpawnCeilings , "/isaac/SpawnCeilings" ),
207212 SpawnFloors = self .node .create_client_wrapper (SpawnFloors , "/isaac/SpawnFloors" ),
208213 SpawnPedestrians = self .node .create_client_wrapper (SpawnPedestrians , "/isaac/SpawnPedestrians" ),
209214 SpawnPrims = self .node .create_client_wrapper (SpawnPrims , "/isaac/SpawnPrims" ),
@@ -535,6 +540,34 @@ async def impl(floor: FloorDefinition) -> Floor | None:
535540 self ._logger .debug ("All floors spawned successfully." )
536541 return res
537542
543+ async def spawn_ceilings (self , ceilings : Sequence [CeilingDefinition ]) -> bool :
544+ self ._logger .debug ("Attempting to spawn ceilings" )
545+
546+ async def impl (ceiling : CeilingDefinition ) -> Ceiling | None :
547+ try :
548+ pos = ceiling .pos .to_msg ()
549+ pos .z = ceiling .z
550+ return Ceiling (
551+ name = self ._NS_CEILING (ceiling .name ),
552+ x_length = ceiling .x_length ,
553+ y_length = ceiling .y_length ,
554+ pos = pos ,
555+ cast_shadows = ceiling .cast_shadows ,
556+ material = material_to_msg (await ceiling .material .resolve ()),
557+ )
558+
559+ except Exception :
560+ self ._logger .error (f"Failed to spawn ceiling: { ceiling .name } \n { traceback .format_exc ()} " )
561+ return None
562+
563+ ceilings_req = SpawnCeilings .Request ()
564+ ceilings_req .ceilings = list (filter (None , await asyncio .gather (* map (impl , ceilings ))))
565+ ceilings_res = await self ._clients .SpawnCeilings .call_timeout (ceilings_req )
566+
567+ res = bool (ceilings_res ) and all (ceilings_res .ret )
568+ self ._logger .debug ("All ceilings spawned successfully." )
569+ return res
570+
538571 async def spawn_box (self , name : str , size : tuple [float , float , float ], pose : Pose ) -> bool :
539572 """Spawn an axis-aligned box using the SpawnWalls service.
540573
0 commit comments