-
Notifications
You must be signed in to change notification settings - Fork 3
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
Is it possible to add an object at runtime? #286
Comments
This should be possible yes! As long as the object is not an agent. I will look into it tomorrow to see if I can make a code snippet for you. Otherwise I will implement a You do need some access point to the world though. So through another object or agent (with agent making more sense). Which ofcourse can be an invisible one just doing its thing of adding that object. Through altering the State won't work. As the State in a agent is simply its perceptions, not the actual world. |
It's actually also possible to add a new agent on the fly, as can be seen in this Covid Triage tool MATRX case here: https://github.com/matrx-software/MHC-for-triage-agents/blob/00ca653b798cd8a0302a33870fa54d483c13e2ba/mhc/patient_planner.py#L293. However, I think it's best if we add an |
Thank you both! I think I managed, by using a similar process as @thaije mentioned. Created class AddGhostBlock(Action). class AddGhostBlock(Action):
def __init__(self, duration_in_ticks=0):
super().__init__(duration_in_ticks)
def is_possible(self, grid_world, agent_id, **kwargs):
# check that we have all variables
# TODO
# success
return AddObjectResult(AddObjectResult.ACTION_SUCCEEDED, True)
def mutate(self, grid_world, agent_id, **kwargs):
obj_body_args = {
"location": [24,10],
"name": "Collect Block",
#"class_callable": GhostBlock,
"visualize_colour": '#332288',
"visualize_shape": 0,
"drop_zone_nr": 1
}
# create the new object
env_object = GhostBlock(**obj_body_args)
# register the new object
grid_world._register_env_object(env_object)
return AddObjectResult(AddObjectResult.ACTION_SUCCEEDED, True) |
What is your question?
Is it possible to add an object to the world at runtime?
I would like to change the blocks in the drop-off zones in runtime. Is this possible? What's the best way to do this? I see you have the action RemoveObject, but not the AddObject. In any case, I'd like to add it to a specific position (no need of getting an agent involved and all its characteristics).
I have also considered altering the state of the world through the perception of one "ghost" agent. Does that work?
Thanks!
To what is your question related?
The text was updated successfully, but these errors were encountered: