fix: refine indoor mailbox collision
This commit is contained in:
@@ -54,6 +54,38 @@ def replace_house_visual_meshes_with_boxes(house_model):
|
|||||||
visual_pose = ET.SubElement(visual, 'pose')
|
visual_pose = ET.SubElement(visual, 'pose')
|
||||||
visual_pose.text = pose
|
visual_pose.text = pose
|
||||||
|
|
||||||
|
# The house references Gazebo's external mailbox asset, which is not shipped
|
||||||
|
# with the module image. Replace both its visual and collision with the same
|
||||||
|
# local box so it remains visible and navigable in the flat indoor world.
|
||||||
|
mailbox = next(
|
||||||
|
(model for model in house_model.findall('.//model') if model.attrib.get('name') == 'Mailbox'),
|
||||||
|
None,
|
||||||
|
)
|
||||||
|
if mailbox is None:
|
||||||
|
return
|
||||||
|
|
||||||
|
mailbox_link = mailbox.find('link')
|
||||||
|
if mailbox_link is None:
|
||||||
|
return
|
||||||
|
|
||||||
|
for element in list(mailbox_link):
|
||||||
|
if element.tag in {'visual', 'collision'}:
|
||||||
|
mailbox_link.remove(element)
|
||||||
|
|
||||||
|
# The laser is roughly 17 cm above the ground. Keep the mailbox body above
|
||||||
|
# that plane and retain the single thin support from mailbox.dae.
|
||||||
|
mailbox_parts = (
|
||||||
|
('body', '0.133 0.355 0.29', '0.002 0.017 0.922 0 0 0'),
|
||||||
|
('leg', '0.043 0.044 0.803', '0.000 0.012 0.401 0 0 0'),
|
||||||
|
)
|
||||||
|
for element_type in ('collision', 'visual'):
|
||||||
|
for name, size, pose in mailbox_parts:
|
||||||
|
element = ET.SubElement(mailbox_link, element_type, name=f'mailbox_{element_type}_{name}')
|
||||||
|
ET.SubElement(element, 'pose').text = pose
|
||||||
|
geometry = ET.SubElement(element, 'geometry')
|
||||||
|
box = ET.SubElement(geometry, 'box')
|
||||||
|
ET.SubElement(box, 'size').text = size
|
||||||
|
|
||||||
|
|
||||||
def create_flat_house_world(gazebo_dir):
|
def create_flat_house_world(gazebo_dir):
|
||||||
"""Create a texture-free house copy with box-rendered furniture."""
|
"""Create a texture-free house copy with box-rendered furniture."""
|
||||||
|
|||||||
Reference in New Issue
Block a user