diff --git a/README.md b/README.md index 12c3440..ce0d4bf 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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")