Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kumar-sanjeeev committed Jan 4, 2025
1 parent 6a9b4ff commit 301e282
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 28 deletions.
40 changes: 13 additions & 27 deletions docs/source/yaml/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,40 +9,25 @@ Specifically, each world draws from a set of **location** and **object** metadat

Worlds themselves can be created programmatically, or defined using world YAML files.

For the programmatic approach, you can create a world as follows.

**Option 1** : Using ``set_metadata`` : Supports specifying metadata with a single YAML file for locations and one for objects.

.. code-block:: python
from pyrobosim.core import Robot, World
world = World()
world.set_metadata(locations="/path/to/location_data.yaml",
objects="/path/to/object_data.yaml")
# Then, you can add the other entities
world.add_robot(...)
world.add_room(...)
world.add_hallway(...)
world.add_location(...)
world.add_object(...)
**Option 2** : Using ``add_metadata`` : Supports specifying metadata with multiple YAML files for locations and for objects.
For the programmatic approach, you can create a world as follows either using ``set_metadata`` or ``add_metadata``.

.. code-block:: python
from pyrobosim.core import Robot, World
world = World()
world.add_metadata(locations="/path/to/location_data1.yaml",
objects="/path/to/object_data1.yaml")
world.add_metadata(locations=["/path/to/location_data2.yaml"],
objects=[
"/path/to/object_data2.yaml",
"/path/to/object_data3.yaml",
])
# locations and objects can accept either a single file path or a list of file paths.
world.add_metadata(
locations=[
"/path/to/location_data1.yaml",
"/path/to/location_data2.yaml"
],
objects=[
"/path/to/object_data1.yaml",
"/path/to/object_data2.yaml"
]
)
# Then, you can add the other entities
world.add_robot(...)
Expand All @@ -51,6 +36,7 @@ For the programmatic approach, you can create a world as follows.
world.add_location(...)
world.add_object(...)
For the YAML approach, you can directly point to the location and object metadata in the world YAML file itself.

.. code-block:: yaml
Expand Down
2 changes: 1 addition & 1 deletion docs/source/yaml/world_schema.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The world schema looks as follows, where ``<angle brackets>`` are placeholders:
- <path/to/location_data1_file.yaml>
- <path/to/location_data2_file.yaml>
- ...
- path/to/location_dataN_file.yaml
- <path/to/location_dataN_file.yaml>
objects:
- </path/to/object_data1_file.yaml>
- </path/to/object_data2_file.yaml>
Expand Down

0 comments on commit 301e282

Please sign in to comment.