-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild_models.py
More file actions
executable file
·32 lines (24 loc) · 928 Bytes
/
build_models.py
File metadata and controls
executable file
·32 lines (24 loc) · 928 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import subprocess
import os
from tampc import cfg
import logging
logger = logging.getLogger(__name__)
def main():
model_dir = os.path.join(cfg.ROOT_DIR, 'models')
model_files = [f for f in os.listdir(model_dir) if os.path.isfile(os.path.join(model_dir, f))]
for f in model_files:
# reject non-xacro
if not f.endswith('.xacro'):
continue
if f.startswith('_'):
continue
name = os.path.splitext(f)[0]
full_path = os.path.join(model_dir, f)
command = "rosrun xacro xacro {} > {}.urdf".format(full_path, os.path.join(cfg.ROOT_DIR, name))
logger.info(command)
subprocess.run(command, shell=True)
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO,
format='[%(levelname)s %(asctime)s %(pathname)s:%(lineno)d] %(message)s',
datefmt='%m-%d %H:%M:%S')
main()