mmatl / urdfpy

Python parser for URDFs
http://urdfpy.readthedocs.io/
MIT License
246 stars 98 forks source link

[Perf Improvement] Added option for mesh lazy loading #25

Closed fishbotics closed 7 months ago

fishbotics commented 2 years ago

On my computer, it takes about 600ms to load a urdf using URDFpy. This can be cumbersome when I want to load a robot object and do some quick fk within a function. The main bottleneck is the mesh loading.

This PR adds a flag to the URDF.load function which allows for lazy mesh loading. If set to true, the meshes will only be loaded when they are required (e.g. when calling visual_trimesh_fk). If they are never required, they will never be loaded.

With lazy loading on, it takes ~6ms to load the same URDF (vs the 600 described above).