code
stringlengths
3
6.57k
len(self.wall_texcs)
np.concatenate(self.wall_texcs)
np.array([])
reshape(0, 2)
_render(self)
glColor3f(1, 1, 1)
self.floor_tex.bind()
glBegin(GL_POLYGON)
glNormal3f(0, 1, 0)
range(self.floor_verts.shape[0])
glTexCoord2f(*self.floor_texcs[i, :])
glVertex3f(*self.floor_verts[i, :])
glEnd()
self.ceil_tex.bind()
glBegin(GL_POLYGON)
glNormal3f(0, -1, 0)
range(self.ceil_verts.shape[0])
glTexCoord2f(*self.ceil_texcs[i, :])
glVertex3f(*self.ceil_verts[i, :])
glEnd()
self.wall_tex.bind()
glBegin(GL_QUADS)
range(self.wall_verts.shape[0])
glNormal3f(*self.wall_norms[i, :])
glTexCoord2f(*self.wall_texcs[i, :])
glVertex3f(*self.wall_verts[i, :])
glEnd()
MiniWorldEnv(gym.Env)
Actions(IntEnum)
spaces.Discrete(len(self.actions)
into (shadow OpenGL context)
pyglet.window.Window(width=1, height=1, visible=False)
glEnable(GL_DEPTH_TEST)
glEnable(GL_CULL_FACE)
FrameBuffer(obs_width, obs_height, 8)
FrameBuffer(window_width, window_height, 16)
self.seed()
self.reset()
close(self)
seed(self, seed=None)
RandGen(seed)
reset(self)
parameters (domain randomization)
Agent()
is (N, 2, 3)
self._gen_world()
world (domain randomization)
self.params.get_max('forward_step')
ent.randomize(self.params, rand)
min([r.min_x for r in self.rooms])
max([r.max_x for r in self.rooms])
min([r.min_z for r in self.rooms])
max([r.max_z for r in self.rooms])
len(self.wall_segs)
self._gen_static_data()
self._render_static()
self.render_obs()
_get_carry_pos(self, agent_pos, ent)
max(self.agent.cam_height - ent.height - 0.3, 0)
move_agent(self, fwd_dist, fwd_drift)
self.intersect(self.agent, next_pos, self.agent.radius)
self._get_carry_pos(next_pos, carrying)
self.intersect(carrying, next_carrying_pos, carrying.radius)
turn_agent(self, turn_angle)
self._get_carry_pos(self.agent.pos, carrying)
self.intersect(carrying, pos, carrying.radius)
step(self, action)
self.params.sample(rand, 'forward_step')
self.params.sample(rand, 'forward_drift')
self.params.sample(rand, 'turn_step')
self.move_agent(fwd_step, fwd_drift)
self.move_agent(-fwd_step, fwd_drift)
self.turn_agent(turn_step)
self.turn_agent(-turn_step)
self.intersect(self.agent, test_pos, 1.2 * self.agent.radius)
isinstance(ent, Entity)
self._get_carry_pos(self.agent.pos, self.agent.carrying)
self.render_obs()
self.add_room(outline=outline, **kwargs)
add_room(self, **kwargs)
len(self.wall_segs)
Room(**kwargs)
self.rooms.append(room)
find_facing_edges()
range(room_a.num_walls)
range(room_b.num_walls)
np.dot(norm_a, norm_b)
np.dot(norm_a, dir)
find_facing_edges()
np.linalg.norm(a - d)
np.linalg.norm(b - a)
np.linalg.norm(d - c)
np.stack([c, b, a, d])
np.stack([outline[:, 0], outline[:, 2]], axis=1)
self.rooms.append(room)
room.add_portal(1, start_pos=0, end_pos=len_a)
room.add_portal(3, start_pos=0, end_pos=len_b)
len(self.rooms)
len(self.wall_segs)
self._gen_static_data()