コード例 #1
0
    def __init__(self, options={}):
        self.options = options
        if environ.get('TOUCH_DATA') is not None:
            self.options['data_path'] = os.environ['TOUCH_DATA']
        else:
            self.options['data_path'] = '/touch_data'
        self.options['test_split_ratio'] = 0.2
        self.steps = 0

        #TODO check if options is a string, so we know which environment to load
        if 'render' in self.options and self.options['render'] == True:
            pb.connect(pb.GUI)
        else:
            pb.connect(pb.DIRECT)
        pb.setGravity(0, 0, -0.001)
        pb.setRealTimeSimulation(0)
        self.move = 0.01  # 0.01
        self.prev_distance = 10000000
        self.max_steps = 1000
        self.files = None
        self.train_files = None
        self.test_files = None
        self.file_pointer = 0
        self.done_training = False
        self.wandLength = 0.5
        self.wandSide = 0.005
        self.timestep_limit = 400
        self.cameraImageHeight = int((2 * 0.851 * self.wandSide) * 11800)
        self.action_space = spaces.Discrete(6)
        self.observation_space = spaces.Box(
            0, 1, [self.cameraImageHeight, self.cameraImageHeight])
        self.load_files()
コード例 #2
0
    def __init__(self,options={}):
        self.options = options
        if environ.get('TOUCH_DATA') is not None:
            self.options['data_path'] = os.environ['TOUCH_DATA'] 
        self.steps = 0

        #TODO check if options is a string, so we know which environment to load
        if 'render' in self.options and self.options['render'] == True:
            pb.connect(pb.GUI)
        else:
            pb.connect(pb.DIRECT)
        pb.setGravity(0,0,-0.001)
        pb.setRealTimeSimulation(0)
        self.move = 0.01 # 0.01
        self.prev_distance = 10000000
        self.max_steps = 1000
        self.wandLength = 0.5
        self.wandSide = 0.005
        self.cameraImageHeight = int((2 * 0.851 * self.wandSide)*11800)
        self.class_count = len([x[0] for x in os.walk(self.options['data_path'])]) #path must be a full path,TODO convert to full path
        self.action_space = spaces.Discrete(6 + self.class_count)
        self.timestep_limit = 400
        #self.observation_space = spaces.Box(0, 1, [6,  self.cameraImageHeight, self.cameraImageHeight])
        self.observation_space = spaces.Box(-100, 100, self.cameraImageHeight**2+6)
        self.touch_history = []
コード例 #3
0
    def __init__(self,options={}):
        self.options = options
        self.steps = 0

        #TODO check if options is a string, so we know which environment to load
        if 'render' in self.options and self.options['render'] == True:
            pb.connect(pb.GUI)
        else:
            pb.connect(pb.DIRECT)
        pb.setGravity(0,0,-0.001)
        pb.setRealTimeSimulation(0)
        self.move = 0.025 # 0.01
        self.prev_distance = 10000000
        self.wandLength = 0.5
        self.wandSide = 0.005
        self.max_steps = 1000
        self.cameraImageHeight = int((2 * 0.851 * self.wandSide)*11800)
        self.action_space = spaces.Discrete(6)
        self.observation_space = spaces.Box(0, 1, [self.cameraImageHeight, self.cameraImageHeight])
コード例 #4
0
    def __init__(self, options={}):
        self.options = options
        #print("options",options)
        self.steps = 0

        currentdir = os.path.dirname(
            os.path.abspath(inspect.getfile(inspect.currentframe())))
        parentdir = os.path.dirname(os.path.dirname(currentdir))
        os.sys.path.insert(0, parentdir)
        if 'render' in self.options and self.options['render'] == True:
            pb.connect(pb.GUI)
        else:
            pb.connect(pb.DIRECT)
        if 'video' in self.options and self.options['video'] != True:
            video_name = self.options[
                'video']  #how to default to video.mp4 is empty
            pb.startStateLogging(pb.STATE_LOGGING_VIDEO_MP4, video_name)
        if 'debug' in self.options and self.options['debug'] == True:
            pb.configureDebugVisualizer(pb.COV_ENABLE_GUI, 1)
            pb.configureDebugVisualizer(pb.COV_ENABLE_TINY_RENDERER, 1)
        else:
            pb.configureDebugVisualizer(pb.COV_ENABLE_GUI, 0)
            pb.configureDebugVisualizer(pb.COV_ENABLE_TINY_RENDERER, 0)
        pb.setGravity(0, 0, -10)
        pb.setRealTimeSimulation(0)
        self.move = 0.05  # 0.01
        self.load_object()
        self.load_agent()
        self.pi = 3.1415926535
        self.pinkId = 0
        self.middleId = 1
        self.indexId = 2
        self.thumbId = 3
        self.ring_id = 4
        self.indexEndID = 21  # Need get position and orientation from index finger parts
        self.offset = 0.02  # Offset from basic position
        self.downCameraOn = False
        self.prev_distance = 10000000
        self.action_space = spaces.Discrete(8)
        self.touch_width = 200
        self.touch_height = 200
        self.observation_space = spaces.Box(
            0, 1, [self.touch_width, self.touch_height])