Ejemplo n.º 1
0
    def _reset_platform_frontend(self):
        """Reset the platform frontend."""
        # reset is not really possible
        if self.platform is not None:
            raise RuntimeError(
                "Once started, this environment cannot be reset.")

        self.platform = robot_fingers.TriFingerPlatformFrontend()
Ejemplo n.º 2
0
def main():
    robot = robot_fingers.TriFingerPlatformFrontend()

    while True:
        action = robot_interfaces.trifinger.Action(
            position=get_random_position())
        for _ in range(1000):
            t = robot.append_desired_action(action)
            robot.wait_until_timeindex(t)

        obs = robot.get_robot_observation(t)
        print(obs.position)
def main():
    # the difficulty level and the goal pose (as JSON string) are passed as
    # arguments
    difficulty = int(sys.argv[1])
    goal_pose_json = sys.argv[2]
    goal = json.loads(goal_pose_json)
    print("Goal: %s/%s (difficulty: %d)" %
          (goal["position"], goal["orientation"], difficulty))

    # create the robot frontend
    frontend = robot_fingers.TriFingerPlatformFrontend()

    # move the robot
    move_up_and_down(frontend, episode_length)

    # It is possible to create custom files in "/output"
    with open("/output/hello.txt", "w") as fh:
        fh.write("Hello there!\n")
Ejemplo n.º 4
0
    def reset(self):
        # cannot reset multiple times
        if self.platform is not None:
            raise RuntimeError(
                "Once started, this environment cannot be reset.")

        self.platform = robot_fingers.TriFingerPlatformFrontend()

        # if no goal is given, sample one randomly
        if self.goal is None:
            goal = task.sample_goal()
        else:
            goal = self.goal

        self.goal_masks = task.generate_goal_mask(self.camera_params, goal)

        self.info = {"time_index": -1}

        # need to already do one step to get initial observation
        # TODO disable frameskip here?
        observation, _, _, _ = self.step(self._initial_action)

        return observation