Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions realsense2_description/launch/launch_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ def to_urdf(xacro_path, parameters=None):
* xacro_path -- the path to the xacro file
* parameters -- to be used when xacro file is parsed.
"""
urdf_path = tempfile.TemporaryFile(prefix="%s_" % os.path.basename(xacro_path))
with tempfile.NamedTemporaryFile(prefix="%s_" % os.path.basename(xacro_path), delete=False) as xacro_file:
urdf_path = xacro_file.name

# open and process file
doc = xacro.process_file(xacro_path, mappings=parameters)
# open the output file
out = xacro.open_output(urdf_path)
out.write(doc.toprettyxml(indent=' '))
with open(urdf_path, 'w') as urdf_file:
urdf_file.write(doc.toprettyxml(indent=' '))

return urdf_path