Comments (7)
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 self.agent_properties
attribute? Also include where you make the adjustments (i.e., in the decide_on_action
method).
from matrx.
@jwaa thanks for the quick reply! I tried the following code in the decide_on_action
method of the agent class:
self.agent_properties["visualization"]["size"] = 5.0
. When printing self.agent_properties
it actually shows the changed size, but no differences are visually noticeable in the simulation.
from matrx.
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 "visualization_<property name>"
.
Let me know if this works!
from matrx.
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.0All 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
"visualization_<property name>"
.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 builder.add_agent
, I included visualize_size
in customizable_properties
. I am using MATRX version 2.2.0 btw.
from matrx.
This returns the following error:
Ah, that is too bad. It seems there is a bug there. A workaround is to add the visualize_size
property when you make the agent with the WorldBuilder
with the original size as value. No guarantees that this will work though. I made #330 to fix it and with a more detailed description why it fails.
When adding the agent using
builder.add_agent
, I includedvisualize_size
incustomizable_properties
. I am using MATRX version 2.2.0 btw.
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.
from matrx.
@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 :)
from matrx.
@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 :-)
from matrx.
Related Issues (20)
- Team name assignment is ignored for agents
- Add state.state_update documentation and refactor
- `state.get_room_objects` doesn't work HOT 4
- Grabbing and dropping an object changes the obj ID HOT 2
- Make state available in object `update()` function
- Bug in function state.get_room_doors HOT 1
- Create MATRX tutorial(s) and fix existing tutorials HOT 4
- remove waypoint function HOT 3
- Navigator `get_all_waypoints` does not return updated waypoints HOT 1
- State get_closest_with_property function doesn't give closest object HOT 2
- Door object has hardcoded customizable properties HOT 1
- Custom pathplanner that takes preferences into account HOT 2
- Customizable properties not being passed for custom objects HOT 4
- Carrying objects with two agents? HOT 5
- Is it possible to use async in agent actions? HOT 2
- change_property of object cannot change img_name HOT 2
- Allow sending human message while busy HOT 5
- V2 simulation goals throw an error
- Changing an agent's visualization properties on run time fails HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from matrx.