-
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
Change agent image size during simulation #329
Comments
Hey @rsverhagen94! Adjusting visualization properties on the fly can indeed be a hassle. Can you provide a bit of a code snippet on what you tried with the |
@jwaa thanks for the quick reply! I tried the following code in the |
Now a bit later reply, sorry for that. It seems that changing the visualization properties is a bit of as hassle since an update. Could you try this: self.agent_properties["visualize_size"] = 5.0 All of the visualization properties are in their nested dictionaries, but the part that modifies it throughout MATRX cannot handle such nested properties. So the solution MATRX now uses is to translate all of them to Let me know if this works! |
This returns the following error: Traceback (most recent call last):
File "main.py", line 51, in <module>
carry_together_case.run(scenario)
File "/home/ruben/Downloads/moving_out/case/carry_together_case.py", line 196, in run
world.run(builder.api_info)
File "/home/ruben/.local/lib/python3.8/site-packages/matrx/grid_world.py", line 246, in run
is_done, tick_duration = self.__step()
File "/home/ruben/.local/lib/python3.8/site-packages/matrx/grid_world.py", line 697, in __step
agent_obj._set_agent_changed_properties(agent_properties)
File "/home/ruben/.local/lib/python3.8/site-packages/matrx/objects/agent_body.py", line 237, in _set_agent_changed_properties
raise Exception(f"Agent {self.obj_id} tried to remove the property {prop}, which is not allowed.")
Exception: Agent robot tried to remove the property visualize_size, which is not allowed. When adding the agent using |
Ah, that is too bad. It seems there is a bug there. A workaround is to add the
Also good to know. The past few hotfixes did altered the property mechanism, so it might be worthwhile to upgrade and test it with a newer version. |
@rsverhagen94 I wrote a solution for MATRX here, although it is a hacky one you could try and see if it fixes it for you. Alternatively, you can wait until we implemented a hotfix and update your MATRX version. As a side note; size needs to be an integer as it is a multitude of a grid square :) |
This indeed works! Thanks a lot @jwaa :-) |
What is your question?
Is it possible to change image size of agents while the simulation is already running? I tried using self.agent_properties, but without success.
To what is your question related?
The text was updated successfully, but these errors were encountered: