def seed(self, seed=None): if seed is not None: pin.seed(seed) np_random, seed = seeding.np_random(seed) self._np_random = np_random self._seed = seed return [seed]
def __init__(self, urdf_ds='ycbv', texture_ds='shapenet', domain_randomization=True, textures_on_objects=False, n_objects_interval=(2, 5), objects_xyz_interval=((0.0, -0.5, -0.15), (1.0, 0.5, 0.15)), proba_falling=0.5, resolution=(640, 480), focal_interval=((515, 515), (515, 515)), camera_distance_interval=(0.5, 1.5), border_check=True, gpu_renderer=True, n_textures_cache=50, seed=0): # Objects self.urdf_ds = make_urdf_dataset(urdf_ds) self.n_objects_interval = n_objects_interval self.objects_xyz_interval = objects_xyz_interval self.n_objects_cache = len(self.urdf_ds) assert self.n_objects_cache >= max(n_objects_interval) self.away_transform = (0, 0, 1000), (0, 0, 0, 1) self.proba_falling = proba_falling # Domain randomization self.texture_ds = make_texture_dataset(texture_ds) self.n_textures_cache = min(n_textures_cache, len(self.texture_ds)) self.domain_randomization = domain_randomization self.textures_on_objects = textures_on_objects # Camera self.resolution = resolution self.focal_interval = np.array(focal_interval) self.camera_distance_interval = camera_distance_interval self.border_check = border_check self.gpu_renderer = gpu_renderer # Seeding self.np_random = np.random.RandomState(seed) pin.seed(seed) self.seed = seed
import random import time # --- BASIS DEFINITIONS ------------------------------- # --- BASIS DEFINITIONS ------------------------------- # --- BASIS DEFINITIONS ------------------------------- from enum import Enum import example_robot_data as robex import hppfcl import numpy as np import pinocchio as pin from numpy.linalg import det, eig, inv, norm, pinv, svd from scipy.optimize import fmin_bfgs pin.seed(int(time.time())) # change me :) np.set_printoptions(precision=4, linewidth=200, suppress=True) # --- Load robot model robot = robex.loadTalos() NQ = robot.model.nq NV = robot.model.nv # --- ENVIRONMENT DEFINITION ---------------------------------------- # --- ENVIRONMENT DEFINITION ---------------------------------------- # --- ENVIRONMENT DEFINITION ---------------------------------------- def debris(i, j, altitude, axis, angle): """ Minimal helper function: return the SE3 configuration of a stepstone, with some