.. _my-kbenvs: ************ Environments ************ VirtualHome is composed of 7 scenes where activities can be executed. Each scene is encoded as a dictionary, containing a node for every object and edges between them representing relationships. Each environment can be updated by modifying the corresponding dictionary. We call this dictionary :ref:`EnvironmentGraph`. You can load each environment using :meth:`unity_simulator.UnityCommunication.reset` function, specifying the matching environment id. You can retrieve the information of an environment using :meth:`unity_simulator.UnityCommunication.environment_graph`. After loading an environment, you can modify it using :meth:`unity_simulator.UnityCommunication.expand_scene`. ====== Scenes ====== Below is a list of the 7 scenes included in VirtualHome. .. list-table:: :widths: 20 100 :header-rows: 1 * - Scene Id - Apartment View * - 0 - .. image:: ../../images/doc/apartments/scene1rot.png :width: 50% * - 1 - .. image:: ../../images/doc/apartments/scene2rot.png :width: 50% * - 2 - .. image:: ../../images/doc/apartments/scene3rot.png :width: 50% * - 3 - .. image:: ../../images/doc/apartments/scene4rot.png :width: 50% * - 4 - .. image:: ../../images/doc/apartments/scene5rot.png :width: 50% * - 5 - .. image:: ../../images/doc/apartments/scene6rot.png :width: 50% * - 6 - .. image:: ../../images/doc/apartments/scene7rot.png :width: 50% ================ EnvironmentGraph ================ The EnvironmentGraph is the way to represent a scene in VirtualHome. It is represented as a dictionary of node, corresponding to objects, and edges, corresponding to relationships. Here is an example: .. code-block:: json { "nodes":[ { "id":1, "class_name":"character", "states":[ ], "properties":[ ], "category":"Person" }, { "id":2, "class_name":"kitchen", "states":[ ], "properties":[ ], "category":"Room" } ], "edges":[ { "from_id":1, "to_id":2, "relation_type":"INSIDE" } ] } The structure of the Graph is documented below. EnvironmentGraph **************** .. json:object:: EnvironmentGraph :property nodes: list of objects :proptype nodes: list(:json:object:`Nodes`) :property edges: list of relationships between objects :proptype edges: list(:json:object:`Edges`) .. json:object:: Nodes :property int id: id of object :property str class_name: class_name of the object :property str category: cateogry of the object :property str prefab_name: name of the Unity game object used :property list(str) states: states of the objects :property list(str) properties: properties of the objects :property bounding_box: bounding box of the given object :proptype bounding_box: list(:json:object:`BoundingBox`) :property obj_transform: 3D information of the given object :proptype obj_transform: :json:object:`ObjTransform` .. json:object:: BoundingBox :property list(float) center: center of the bounding box, in x,y,z :property list(float) size: size of the bounding box, in x,y,z. The size is axis aligned .. json:object:: ObjTransform :property list(float) position: x,y,z position of the game object. Does not necessarily match with BoundingBox center. :property list(float) rotation: x,y,z,w representation a quaternion of the object rotation https://docs.unity3d.com/ScriptReference/Quaternion.html .. json:object:: Edges :property int from_id: id of Node in the from relationship :property int to_id: id of Node in the to relationship :property str relation_type: relationship between the 2 objects. States ****** Objects can have the following states .. list-table:: :widths: 20 100 :header-rows: 1 * - State - Meaning * - `OPEN` - Indicates whether a container is open. * - `CLOSED` - Indicates whether a container is closed. * - `ON` - Indicates whether a light, electronic device is ON. * - `OFF` - Indicates whether a light, electronic device is OFF. Properties ********** Objects can have the following properties. Some have effect on the Uniy Simulator and some are just used to categorize the objects. We only indicate meaning for the former. .. list-table:: :widths: 20 100 :header-rows: 1 * - Property - Meaning * - `CAN_OPEN` - Whether the object can be opened * - `CLOTHES` - * - `CONTAINERS` - * - COVER_OBJECT - * - `CREAM` - * - `CUTTABLE` - * - `DRINKABLE` - * - `EATABLE` - * - `GRABBABLE` - Whether the object can be grabbed * - `HANGABLE` - * - `HAS_PAPER` - * - `HAS_PLUG` - * - `HAS_SWITCH` - Whether the object can be turned on or off * - `LIEABLE` - * - `LOOKABLE` - * - `MOVABLE` - * - `POURABLE` - * - `READABLE` - * - `RECIPIENT` - * - `SITTABLE` - Whether the agent can sit in this object * - `SURFACE` - Whether the agent can place things on this object Relationships ************* Objects can have different relationships between each other, we describe here their meaning .. list-table:: :widths: 20 100 :header-rows: 1 * - Relation Type - Meaning * - `ON` - Object `from_id` is on top of object `to_id`. * - `INSIDE` - Object `from_id` is inside of object `to_id`. * - `BETWEEN` - Used for doors. Door connects with room `to_id`. * - `CLOSE` - Object `from_id` is close to object `to_id` (< 1.5 metres). * - `FACING` - Object `to_id` is visible from objects `from_id` and distance is < 5 metres. If object1 is a sofa or a chair it should also be turned towards object2. * - `HOLDS_RH` - Character `from_id` holds object `to_id` with the right hand. * - `HOLDS_LH` - Character `from_id` holds object `to_id` with the left hand. * - `SITTING` - Character `from_id` is sitting in object `to_id`.