File size: 681 Bytes
8fc2b4e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"""PyBullet utilities for loading assets."""
import os
import six
import time
import pybullet as p


# BEGIN GOOGLE-EXTERNAL
def load_urdf(pybullet_client, file_path, *args, **kwargs):
    """Loads the given URDF filepath."""
    # Handles most general file open case.
    for _ in range(6):
        try:
            return pybullet_client.loadURDF(file_path, *args, **kwargs)
        except pybullet_client.error as e:
            print("PYBULLET load urdf error!")
            print(e)
            time.sleep(0.1)
    print("missing urdf error. use dummy block.")
    urdf = 'stacking/block.urdf'
    return pybullet_client.loadURDF(urdf, *args, **kwargs)

# END GOOGLE-EXTERNAL