def __init__(self, rand_init=True):
     '''
     Initialize the robot.
     :param rand_init: If True, randomly initialize the robot starting position.
     '''
     self.robot = Reacher(rand_init)
     BaseBulletEnv.__init__(self, self.robot)
 def __init__(self, robot, render=False):
     print("WalkerBase::__init__")
     BaseBulletEnv.__init__(self, robot, render)
     self.camera_x = 0
     self.walk_target_x = 1e3  # kilometer away
     self.walk_target_y = 0
     self.stateId = -1
 def __init__(self, render=False):
     self.camera_x = 0
     self.target_position_xy = (3, 0)
     self.saved_state_id = None
     self.robot = Biped(target_position_xy=self.target_position_xy)
     BaseBulletEnv.__init__(self, self.robot, render)
     self.action_space = self.robot.action_space
     self.observation_space = self.robot.observation_space
示例#4
0
 def __init__(self):
     self.robot = ReacherColours()
     BaseBulletEnv.__init__(self, self.robot)
     self._cam_dist = 5
     self._cam_yaw = 0
     self._cam_pitch = -45
     self._render_width = 240
     self._render_height = 240
示例#5
0
    def __init__(self, robot, render=False):
        # self._p = bullet_client.BulletClient()
        print("WalkerBase::__init__")
        BaseBulletEnv.__init__(self, robot, render)
        # if self.isRender:
        #     self._p = bullet_client.BulletClient(connection_mode=pybullet.GUI)
        # else:

        self.camera_x = 0
        self.walk_target_x = 1e3  # kilometer away
        self.walk_target_y = 0
        self.stateId = -1
    def __init__(self):
        self.robot = Gripper2D(add_feature='force_window', window_size=5)
        BaseBulletEnv.__init__(self, self.robot)
        self.stateId = -1

        self._cam_dist = 0.5
        self._cam_yaw = 0
        self._cam_pitch = -90
        self._render_width = RENDER_WIDTH
        self._render_height = RENDER_HEIGHT

        self.action_space = self.robot.action_space
        self.observation_space = self.robot.observation_space
    def __init__(self):
        self.robot = Gripper2D()
        BaseBulletEnv.__init__(self, self.robot)
        self.stateId = -1
        ## self.render(mode='human')
        self._cam_dist = 0.4
        self._cam_yaw = 0
        self._cam_pitch = -90
        self._render_width = RENDER_WIDTH
        self._render_height = RENDER_HEIGHT

        self.action_space = self.robot.action_space
        self.observation_space = self.robot.observation_space
示例#8
0
    def initialize(self):
        BaseBulletEnv.__init__(self, self.robot)
        self.stateId = -1
        ## self.render(mode='human')

        self._cam_dist = 0.4
        self._cam_yaw = 0
        self._cam_pitch = -90
        self._render_width = RENDER_WIDTH
        self._render_height = RENDER_HEIGHT
        self.robot.body_xyz = [0, -0.03, 0]

        self.action_space = self.robot.action_space
示例#9
0
    def __init__(self):
        self.robot = ReacherSequential()
        BaseBulletEnv.__init__(self, self.robot)
        self._cam_dist = 3.55  # tuned to just crop border
        self._cam_yaw = 0
        self._cam_pitch = -90
        # self._cam_dist = 5
        # self._cam_yaw = 0
        # self._cam_pitch = -45
        self._render_width = 240
        self._render_height = 240

        self.task_specific_values = self.robot.goal_positions
        self.task_specific_obs_indices = np.r_[0:2]
示例#10
0
 def __init__(self, robot=Humanoid(), render=False, vision=False, max_steps=6000):
     self.robot = robot
     BaseBulletEnv.__init__(self, self.robot, render)
     self.saved_state_id = None
     self.vision = vision
     # self.action_space = Dict()
     if vision:
         self.observation_space = spaces.Dict({
             'robot_state': self.robot.observation_space,
             'camera': spaces.Box(low=0, high=255, shape=(30, 30, 1)),
         })
     else:
         self.observation_space = self.robot.observation_space
     self.action_space = self.robot.action_space
     self.max_steps = max_steps
     self.current_step = 0
 def reset(self):
     if self.stateId >= 0:
         self._p.restoreState(self.stateId)
     r = BaseBulletEnv._reset(self)
     if self.stateId < 0:
         self.stateId = self._p.saveState()
     return r
 def reset(self):
     if self.stateId >= 0:
         # print("InvertedPendulumBulletEnv reset p.restoreState(",self.stateId,")")
         self._p.restoreState(self.stateId)
     r = BaseBulletEnv._reset(self)
     if self.stateId < 0:
         self.stateId = self._p.saveState()
     # print("InvertedPendulumBulletEnv reset self.stateId=",self.stateId)
     return r
    def reset(self):
        print('RESETTING')
        if self.saved_state_id is not None:
            # print("restoreState self.stateId:",self.stateId)
            self._p.restoreState(self.saved_state_id)

        else:
            BaseBulletEnv._reset(self)
            self._p.configureDebugVisualizer(pybullet.COV_ENABLE_RENDERING, 0)

            self.parts, self.jdict, self.ordered_joints, self.robot_body = self.robot.addToScene(self._p,
                                                                                                 self.scene.ground_plane_mjcf)
            self.ground_ids = set([(self.parts[f].bodies[self.parts[f].bodyIndex], self.parts[f].bodyPartIndex) for f in
                                   self.foot_ground_object_names])
            self._p.configureDebugVisualizer(pybullet.COV_ENABLE_RENDERING, 1)
            self.saved_state_id = self._p.saveState()
        state = self.robot.calc_state(self.target_position_xy)
        self.last_position = self.robot.body_xyz
        return state
示例#14
0
    def reset(self):
        if self.saved_state_id is not None:
            # restore state of pybullet with saved state from first reset
            self._p.restoreState(self.saved_state_id)
        else:
            BaseBulletEnv._reset(self)
            self._p.configureDebugVisualizer(pybullet.COV_ENABLE_RENDERING, 0)

            self.parts, self.jdict, self.ordered_joints, self.robot_body = self.robot.addToScene(self._p,
                                                                                                 self.scene.ground_plane_mjcf)
            self.ground_ids = set([(self.parts[f].bodies[self.parts[f].bodyIndex], self.parts[f].bodyPartIndex) for f in
                                   self.foot_ground_object_names])
            self._p.configureDebugVisualizer(pybullet.COV_ENABLE_RENDERING, 1)
            fname = os.path.join(os.path.dirname(__file__), "assets", "target_marker.urdf")
            print(fname)
            self.target_marker_id = self._p.loadURDF(fname)
            self.saved_state_id = self._p.saveState()

        self.set_target()
        self.last_distance_to_target = np.linalg.norm(
            np.array(self.robot.get_pos_xyz()[0:2]) - np.array(self.target_pos))
        self.current_step = 0
        return self.get_obs()
    def reset(self):
        ## if self.stateId >= 0:
        ##     print("CuboidPegBulletEnv reset p.restoreState(",self.stateId,")")
        ##     self._p.restoreState(self.stateId)
        r = BaseBulletEnv._reset(self)

        # for manipulation arena
        if self.robot.doneLoading == 0:
            self.parts, self.jdict, self.ordered_joints, self.robot_body = self.robot.addToScene(self.robot._p, self.robot.arena)
        
        ## if self.stateId < 0:
        ##     self.stateId = self._p.saveState()
        ## print("CuboidPegBulletEnv reset self.stateId=",self.stateId)
        return r
    def reset(self):
        if self.stateId >= 0:
            # print("restoreState self.stateId:",self.stateId)
            self._p.restoreState(self.stateId)

        r = BaseBulletEnv._reset(self)
        self._p.configureDebugVisualizer(pybullet.COV_ENABLE_RENDERING,0)
        self.parts, self.jdict, self.ordered_joints, self.robot_body = self.robot.addToScene(self._p,
                                                                                             self.stadium_scene.ground_plane_mjcf)
        self.ground_ids = set([(self.parts[f].bodies[self.parts[f].bodyIndex], self.parts[f].bodyPartIndex) for f in
                               self.foot_ground_object_names])
        self._p.configureDebugVisualizer(pybullet.COV_ENABLE_RENDERING, 1)
        if self.stateId < 0:
            self.stateId=self._p.saveState()
        # print("saving state self.stateId:",self.stateId)

        return r
示例#17
0
 def __init__(self):
     self.robot = ReacherTerminate()
     BaseBulletEnv.__init__(self, self.robot)
示例#18
0
 def __init__(self):
     self.robot = CuboidPeg2D()
     BaseBulletEnv.__init__(self, self.robot)
     self.stateId = -1
示例#19
0
 def reset(self):
     r = BaseBulletEnv._reset(self)
     return r
示例#20
0
 def __init__(self):
     self.robot = GraspBox()
     BaseBulletEnv.__init__(self, self.robot)
     self.camera = Camera(self)
示例#21
0
 def __init__(self, shelf=False):
     self.robot = PandaReacher(shelf=shelf)
     BaseBulletEnv.__init__(self, self.robot)
 def __init__(self):
     self.robot = Thrower()
     BaseBulletEnv.__init__(self, self.robot)
示例#23
0
 def __init__(self):
     self.robot = InvertedPendulum()
     BaseBulletEnv.__init__(self, self.robot)
     self.stateId = -1
     self._timestep = 0
示例#24
0
 def reset(self):
     r = BaseBulletEnv._reset(self)
     return self.observation()
    def __init__(self):
        self.robot = PendulumNormal()
        BaseBulletEnv.__init__(self, self.robot, render=False)
        self.stateId = -1

        self.recording = False
 def __init__(self):
     self.robot = InvertedPendulumSwingup()
     BaseBulletEnv.__init__(self, self.robot)
     self.stateId = -1
 def __init__(self, rand_init=True):
     self.robot = Reacher(rand_init)
     BaseBulletEnv.__init__(self, self.robot)
示例#28
0
 def __init__(self, target):
     self.robot = ReacherRobot(target)
     BaseBulletEnv.__init__(self, self.robot)
 def __init__(self):
     self.robot = InvertedDoublePendulum()
     BaseBulletEnv.__init__(self, self.robot)
     self.stateId = -1
示例#30
0
 def reset(self):
     f = BaseBulletEnv._reset(self)[:-3]
     state = self.observation()
     state = np.reshape(state, CNN_IMG_WIDTH * CNN_IMG_HEIGHT)
     return np.concatenate((state, f))