google-deepmind / lab

A customisable 3D platform for agent-based AI research
Other
7.11k stars 1.37k forks source link

api:pickup not working #80

Closed cowhi closed 6 years ago

cowhi commented 6 years ago

Hi, I am trying to get something to happen when the agent picks up something. Overwriting the pickup method in the lua factory does not work. To test if it ever gets called I tried to get an output from the original implementation in deepmind/engine/context.cc, but apparently this never happens. Doing the same with other hooks, as has_episode_ended, suggests that it should print out something when called. Specifically, I want the episode to end when I walk into the goal object instead of loading a new map and keep going until episodeLengthSeconds. Is there any way I can achieve this? Maybe even from python just calling a goalReached or something? Thx and merry christmas :)

cowhi commented 6 years ago

I am using a workaround now with the rewards for the objects. Everything has even rewards but the goal is odd, so if a modulo on the total reward returns 1, I know I have reached the goal. Don't think it's the best solution, but it is working for now. Would still be great to know how I can handle that directly in the environment.

charlesbeattie commented 6 years ago

Hi, it is required that the pickup has a non zero 'id' in its spawnVars. Unfortunately the id has to be a string but read as an integer. Example in seek_avoid: https://github.com/deepmind/lab/blob/87f8993d7e586fca8a68c3e1b5c042555b4653f5/assets/game_scripts/factories/seek_avoid_factory.lua#L52