Skip to content

Commit

Permalink
docs: Add examples to README
Browse files Browse the repository at this point in the history
  • Loading branch information
huyenngn committed Apr 15, 2024
1 parent 3d60eec commit 5d669be
Show file tree
Hide file tree
Showing 10 changed files with 16,181 additions and 1 deletion.
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
~ SPDX-License-Identifier: Apache-2.0
-->

# capella-ros-tools
# Capella ROS Tools

![image](https://github.com/DSD-DBS/capella-ros-tools/actions/workflows/build-test-publish.yml/badge.svg)
![image](https://github.com/DSD-DBS/capella-ros-tools/actions/workflows/lint.yml/badge.svg)
Expand All @@ -14,6 +14,29 @@ Tools for importing ROS .msg files into Capella data package and vice versa.

Read the [full documentation on Github pages](https://dsd-dbs.github.io/capella-ros-tools).

# Examples

Import ROS .msg files to Capella model layer's root data package:

```sh
python -m capella_ros_tools \
import \
-i tests/data/data_model/example_msgs \
-m tests/data/empty_project_60 \
-l la \
--no-deps
```

Export Capella model layer's root data package as ROS .msg files:

```sh
python -m capella_ros_tools \
export \
-m tests/data/melody_model_60 \
-l la \
-o tests/data/melody_msgs
```

# Installation

You can install the latest released version directly from PyPI.
Expand Down
2 changes: 2 additions & 0 deletions capella_ros_tools/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ def export_capella(
current_pkg = getattr(model, layer).data_package
else:
raise click.UsageError("Either --root or --layer must be provided")

output.mkdir(exist_ok=True, parents=True)
exporter.export(current_pkg, output) # type: ignore


Expand Down
11 changes: 11 additions & 0 deletions tests/data/melody_model_60/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>6_0</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
2 changes: 2 additions & 0 deletions tests/data/melody_model_60/.project.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SPDX-FileCopyrightText: Copyright DB InfraGO AG
SPDX-License-Identifier: Apache-2.0
6 changes: 6 additions & 0 deletions tests/data/melody_model_60/Melody Model Test.afm
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata:Metadata xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:metadata="http://www.polarsys.org/kitalpha/ad/metadata/1.0.0" id="_-kIvQKDzEeqf7Mw7EIo_Ew">
<viewpointReferences id="_-lINwKDzEeqf7Mw7EIo_Ew" vpId="org.polarsys.capella.core.viewpoint" version="6.0.0"/>
<viewpointReferences id="_4DaT8PHWEeq9N-vcO9FSUw" vpId="org.polarsys.kitalpha.vp.requirements" version="0.13.0"/>
<viewpointReferences id="_4FtaAPHWEeq9N-vcO9FSUw" vpId="org.polarsys.capella.vp.requirements" version="0.13.0"/>
</metadata:Metadata>
2 changes: 2 additions & 0 deletions tests/data/melody_model_60/Melody Model Test.afm.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SPDX-FileCopyrightText: Copyright DB InfraGO AG
SPDX-License-Identifier: Apache-2.0
13,006 changes: 13,006 additions & 0 deletions tests/data/melody_model_60/Melody Model Test.aird

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions tests/data/melody_model_60/Melody Model Test.aird.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SPDX-FileCopyrightText: Copyright DB InfraGO AG
SPDX-License-Identifier: Apache-2.0
3,124 changes: 3,124 additions & 0 deletions tests/data/melody_model_60/Melody Model Test.capella

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions tests/data/melody_model_60/Melody Model Test.capella.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SPDX-FileCopyrightText: Copyright DB InfraGO AG
SPDX-License-Identifier: Apache-2.0

0 comments on commit 5d669be

Please sign in to comment.