Beispiel #1
0
def build_world(args, enable_draw):
    arg_parser = build_arg_parser(args)
    print("enable_draw=", enable_draw)
    env = PyBulletDeepMimicEnv(args, enable_draw)
    world = RLWorld(env, arg_parser)
    #world.env.set_playback_speed(playback_speed)

    motion_file = arg_parser.parse_string("motion_file")
    print("motion_file=", motion_file)
    bodies = arg_parser.parse_ints("fall_contact_bodies")
    print("bodies=", bodies)
    int_output_path = arg_parser.parse_string("int_output_path")
    print("int_output_path=", int_output_path)
    agent_files = pybullet_data.getDataPath() + "/" + arg_parser.parse_string(
        "agent_files")

    AGENT_TYPE_KEY = "AgentType"

    print("agent_file=", agent_files)
    with open(agent_files) as data_file:
        json_data = json.load(data_file)
        print("json_data=", json_data)
        assert AGENT_TYPE_KEY in json_data
        agent_type = json_data[AGENT_TYPE_KEY]
        print("agent_type=", agent_type)
        agent = PPOAgent(world, id, json_data)

        agent.set_enable_training(True)
        world.reset()
    return world
Beispiel #2
0
def build_world(args, enable_draw):
  arg_parser = build_arg_parser(args)
  print("enable_draw=", enable_draw)
  env = PyBulletDeepMimicEnv(arg_parser, enable_draw)
  world = RLWorld(env, arg_parser)
  #world.env.set_playback_speed(playback_speed)

  motion_file = arg_parser.parse_string("motion_file")
  print("motion_file=", motion_file)
  bodies = arg_parser.parse_ints("fall_contact_bodies")
  print("bodies=", bodies)
  int_output_path = arg_parser.parse_string("int_output_path")
  print("int_output_path=", int_output_path)
  agent_files = pybullet_data.getDataPath() + "/" + arg_parser.parse_string("agent_files")

  AGENT_TYPE_KEY = "AgentType"

  print("agent_file=", agent_files)
  with open(agent_files) as data_file:
    json_data = json.load(data_file)
    print("json_data=", json_data)
    assert AGENT_TYPE_KEY in json_data
    agent_type = json_data[AGENT_TYPE_KEY]
    print("agent_type=", agent_type)
    agent = PPOAgent(world, id, json_data)

    agent.set_enable_training(False)
    world.reset()
  return world
def build_world(enable_draw, arg_file):
    arg_parser = ArgParser()

    arg_parser.load_file(arg_file)
    arg_parser.parse_string("motion_file")

    env = PyBulletDeepMimicEnv(arg_parser=arg_parser, enable_draw=enable_draw)

    world = RLWorld(env, arg_parser)

    agent_data = load_agent_data(agent_file)

    PPOAgent(world=world, id=id, json_data=agent_data)

    return world