代码拉取完成,页面将自动刷新
#!/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()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。