Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to update current position using Triggers:update(currentPosition) #195

Closed
jafphd opened this issue Jul 9, 2020 · 1 comment
Closed

Comments

@jafphd
Copy link

jafphd commented Jul 9, 2020

Hi, I found a problem when trying to update the current position of the agent using this:

local PositionTrigger = require 'common.position_trigger'
myTriggers = PositionTrigger.new()
myTriggers:update(currentPosition)

If currentPosition is, for example, equal to {0, 0} (I mean, manually placing any two values and in this way creating an explicit table), then there is not any problem. However, if I try to create a table as {tonumber(cp(1)), tonumber(cp(2))} with cp = tensor.DoubleTensor(game:playerInfo().pos), then I get this error error message:

[deepmind/engine/context.cc:843] Check failed: result.ok()[hasEpisodeFinished] - [deepmind.lab.LuaMazeGeneration.fromWorldPos] - [fromWorldPos] - Must provide x, y

I still do not know how to solve this issue and why both ways to create a table are different. I would appreciate if you can let me know how to solve this problem. Thank you in advance!

@jafphd
Copy link
Author

jafphd commented Jul 10, 2020

I think I solved it after a lot of researching about LUA programming. I am going to describe the solution in case it is useful for someonelse. I found useful this information: https://github.com/deepmind/lab/blob/master/docs/developers/reference/tensor.md

The code must be changed to the following one:

local PositionTrigger = require 'common.position_trigger'
myTriggers = PositionTrigger.new()
p= game:playerInfo().pos
currentPosition = {p[1], p[2]}
myTriggers:update(currentPosition)

@jafphd jafphd closed this as completed Jul 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant