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(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
def build_agent(world, id, file): agent = None with open(pybullet_data.getDataPath()+"/"+file) as data_file: json_data = json.load(data_file) assert AGENT_TYPE_KEY in json_data agent_type = json_data[AGENT_TYPE_KEY] if (agent_type == PPOAgent.NAME): agent = PPOAgent(world, id, json_data) else: assert False, 'Unsupported agent type: ' + agent_type return agent
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