Hi all,
I have successfully accessed the .house file that describes the mesh. What happened when I converted the obj file to usd for Isaac Sim is that (1) the house is rotated 90-degree vertically, and (2) there is no light inside the house (completely dark).
I can rotate the house easily, but my challenge is to put light in the house. I tried to explore the house file and made a script that's supposed to calculate the center of each room/region to put light in.
I'm not sure I am doing this correctly, but I am sure other people have tried to do similar things to get the segmentation of the house. I'm asking for some guidance on how it can be done.
Here is the function I use to compute positions of light in every room and I would appreciate if you can give me some guidance.
While this does return some coordinates, due to the fact that I have to rotate the whole house and transform this position back to Isaac Sim world frame. I think it's helpful to know if you think this is the right way to do things. Input is the path to the XXX.house file.
I appreciate your time and I look forward to get the advice from you.
Best
`
def calculate_light_position(self, region: Dict) -> List[float]:
# Use region center as base
center_x, center_y, center_z = region['center']
# Calculate floor and ceiling levels
floor_z = region['bbox_min'][2]
ceiling_z = region['bbox_max'][2]
room_height = ceiling_z - floor_z
# Determine light height based on room type and height
if region['label'] == 's': # stairs
light_height = floor_z + room_height * 0.4
elif region['label'] in ['c', 't']: # closets, toilets
light_height = floor_z + min(2.2, room_height * 0.8)
elif room_height > 4.0: # High ceiling rooms
light_height = floor_z + room_height * 0.6
else: # Normal rooms
light_height = floor_z + min(2.7, room_height * 0.8)
return [center_x, center_y, light_height]
def extract_light_positions(self, house_data: Dict) -> Dict:
"""Extract all light positions from house data"""
light_positions = {
'house_name': house_data['house_name'],
'total_lights': 0,
'levels': {},
'all_positions': []
}
# Process each region
for region in house_data['regions']:
# Skip junk regions
if region['label'] == 'Z':
continue
level_idx = region['level_index']
# Initialize level if needed
if level_idx not in light_positions['levels']:
light_positions['levels'][level_idx] = {
'level_name': f"Level_{level_idx}",
'lights': []
}
# Find level name
for level in house_data['levels']:
if level['level_index'] == level_idx:
light_positions['levels'][level_idx]['level_name'] = level['label']
break
# Calculate light position
light_pos = self.calculate_light_position(region)
room_type = self.room_type_mapping.get(region['label'], 'other')
light_info = {
'region_index': region['region_index'],
'room_label': region['label'],
'room_type': room_type,
'position': light_pos,
'room_center': region['center'],
'room_height': region['height'],
'floor_z': region['bbox_min'][2],
'ceiling_z': region['bbox_max'][2]
}
light_positions['levels'][level_idx]['lights'].append(light_info)
light_positions['all_positions'].append(light_info)
light_positions['total_lights'] += 1
return light_positions
`
Hi all,
I have successfully accessed the .house file that describes the mesh. What happened when I converted the obj file to usd for Isaac Sim is that (1) the house is rotated 90-degree vertically, and (2) there is no light inside the house (completely dark).
I can rotate the house easily, but my challenge is to put light in the house. I tried to explore the house file and made a script that's supposed to calculate the center of each room/region to put light in.
I'm not sure I am doing this correctly, but I am sure other people have tried to do similar things to get the segmentation of the house. I'm asking for some guidance on how it can be done.
Here is the function I use to compute positions of light in every room and I would appreciate if you can give me some guidance.
While this does return some coordinates, due to the fact that I have to rotate the whole house and transform this position back to Isaac Sim world frame. I think it's helpful to know if you think this is the right way to do things. Input is the path to the XXX.house file.
I appreciate your time and I look forward to get the advice from you.
Best
`
def calculate_light_position(self, region: Dict) -> List[float]:
`