Skip to content

Commit

Permalink
Reorganized documentation regarding normal usage and data model gener…
Browse files Browse the repository at this point in the history
…ation (#44)

Signed-off-by: Aaron Chong <[email protected]>
  • Loading branch information
aaronchongth authored Jul 14, 2023
1 parent c695d3b commit 7f5beec
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ Collection of json message schemas which bridges the C++ and python components o

# Usage

Download pkg for python model generation
```bash
pip3 install datamodel-code-generator
```

Compile with [colcon](https://colcon.readthedocs.io/en/released/) is recommended

```bash
Expand All @@ -30,10 +25,30 @@ nlohmann::json schema = rmf_api_msgs::schemas::task_state

```py
from rmf_api_msgs import schemas
from rmf_api_msgs.models import task_state

# get schema
schema = schemas.task_state()
```

# Python data model generation

To generate the data models based on the schemas, install `datamodel-code-generator`

```bash
pip3 install datamodel-code-generator
```

Recompile with [colcon](https://colcon.readthedocs.io/en/released/)

```bash
colcon build --packages-select rmf_api_msgs
source install/setup.bash
```

The generated data models can then be accessed and used for development,

```py
from rmf_api_msgs.models import task_state

# create task_state model
booking = task_state.Booking(id = "id0001")
Expand Down

0 comments on commit 7f5beec

Please sign in to comment.