What should I do if I use other robots and other environmental scenarios?
JiayunjieJYJ opened this issue · comments
As shown in the question, I want to import my own environment file and robot model. What should I do roughly? And I hope to visualize them, thank you!
you need:
- an obj file (.obj)
- a mtl file (.mtl)
- a texture image (.jpg)
note the mesh should be z-up.
then:
import argparse
import os
import shutil
from gibson2 import g_dataset_path
from floorplan.generate_traversable_map import gen_trav_map
from floorplan.generate_floor_maps import gen_map
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--obj', type=str, help='path to obj model file of scene (with z-axis up)', required=True)
parser.add_argument('--mtl', type=str, help='path to mtl file of scene', required=True)
parser.add_argument('--tex', type=str, help='path to texture file of scene', required=True)
parser.add_argument('--name', type=str, help='name of scene', required=True)
parser.add_argument('--floor', type=float, help='floor height', default=0.05)
args = parser.parse_args()
base_dir = os.path.join(g_dataset_path, args.name)
if os.path.exists(base_dir):
print('Scene has been already existing:', base_dir)
exit(-1)
os.makedirs(base_dir)
cmd = f'ln -s {args.obj} {os.path.join(base_dir, "mesh_z_up.obj")}'
assert 0 == os.system(cmd), f'Fail when executing "{cmd}"'
cmd = f'ln -s {args.mtl} {os.path.join(base_dir, args.mtl.rsplit("/", 1)[1])}'
assert 0 == os.system(cmd), f'Fail when executing "{cmd}"'
cmd = f'ln -s {args.tex} {os.path.join(base_dir, args.tex.rsplit("/", 1)[1])}'
assert 0 == os.system(cmd), f'Fail when executing "{cmd}"'
with open(os.path.join(base_dir, 'floors.txt'), 'w') as f:
f.write('{}\n'.format(args.floor))
gen_map(os.path.join(base_dir, "mesh_z_up.obj"), base_dir) # Generate floor maps
gen_trav_map(base_dir, "mesh_z_up.obj")
Thanks for your reply! But I still have a question, how to import the urdf model of my own robot? And implement its control? Thanks!
I am not familiar with that. you can see iGibson documentation as well as their source code.