1 Star 0 Fork 0

姜永鹏/visual-pushing-grasping

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
create.py 1.86 KB
一键复制 编辑 原始数据 按行查看 历史
Andy Zeng 提交于 2018-04-16 00:46 . permissions update
#!/usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
import scipy as sc
import time
import cv2
import os
import random
from robot import Robot
import utils
# User options (change me)
# --------------- Setup options ---------------
obj_mesh_dir = os.path.abspath('objects/blocks')
num_obj = 10
random_seed = 1234
workspace_limits = np.asarray([[-0.724, -0.276], [-0.224, 0.224], [-0.0001, 0.4]]) # Cols: min max, Rows: x y z (define workspace limits in robot coordinates)
# ---------------------------------------------
# Set random seed
np.random.seed(random_seed)
# Initialize robot simulation
robot = Robot(True, obj_mesh_dir, num_obj, workspace_limits,
None, None, None, None,
True, False, None)
test_case_file_name = raw_input("Enter the name of the file: ") # test-10-obj-00.txt
# Fetch object poses
obj_positions, obj_orientations = robot.get_obj_positions_and_orientations()
# Save object information to file
file = open(test_case_file_name, 'w')
for object_idx in range(robot.num_obj):
# curr_mesh_file = os.path.join(robot.obj_mesh_dir, robot.mesh_list[robot.obj_mesh_ind[object_idx]]) # Use absolute paths
curr_mesh_file = os.path.join(robot.mesh_list[robot.obj_mesh_ind[object_idx]])
file.write('%s %.18e %.18e %.18e %.18e %.18e %.18e %.18e %.18e %.18e\n' % (curr_mesh_file,
robot.obj_mesh_color[object_idx][0], robot.obj_mesh_color[object_idx][1], robot.obj_mesh_color[object_idx][2],
obj_positions[object_idx][0], obj_positions[object_idx][1], obj_positions[object_idx][2],
obj_orientations[object_idx][0], obj_orientations[object_idx][1], obj_orientations[object_idx][2]))
file.close()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jiang_yongpeng/visual-pushing-grasping.git
git@gitee.com:jiang_yongpeng/visual-pushing-grasping.git
jiang_yongpeng
visual-pushing-grasping
visual-pushing-grasping
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385