in envs/thor_beacons.py [0:0]
def step(self, action):
if 'image_to_world' not in self.state.metadata:
self.state.metadata['image_to_world'] = self.projector.image_to_world(self.agent_pose(self.state), self.state.depth_frame)
prev_state = {'depth': np.array(self.state.depth_frame),
'P': self.state.metadata['image_to_world'].clone(),
'agent_y': self.state.metadata['agent']['position']['y']
}
obs, rewards, done, info = super().step(action)
# place beacon for interaction
if info['action'] in self.interaction_set:
beacon = self.get_beacon_position(prev_state, info)
if beacon is not None:
# place_beacon is called AFTER the action is executed. Place for previous time-step
self.beacons.append({'t':self.t-1, 'action': info['action'], 'success': info['success'], **beacon})
# get image_to_world for last timestep
self.state.metadata['image_to_world'] = self.projector.image_to_world(self.agent_pose(self.state), self.state.depth_frame)
hist = self.compile_history(self.state)
self.history.append({'t':self.t-1, **hist})
# if final timestep, then compute masks for the entire trajectory and add to info
if self.t==self.max_t:
info['traj_masks'] = self.compute_masks()
return obs, rewards, done, info