diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 3bbae5d9..0b4c75a9 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -1,4 +1,4 @@ -FROM ros:jazzy AS as2fm +FROM ros:jazzy AS moco SHELL ["/bin/bash", "-o", "pipefail", "-c"] # Install requirements @@ -16,10 +16,12 @@ RUN cd /smc_storm_executable && \ rm -rf /var/lib/apt/lists/* RUN ln /smc_storm_executable/bin/smc_storm /usr/local/bin -# Add AS2FM +# Add MOCO RUN mkdir -p /colcon_ws/src -COPY . /colcon_ws/src/as2fm -RUN pip3 install --break-system-packages /colcon_ws/src/as2fm[dev] +COPY . /colcon_ws/src/moco +#TODO fix package name once release is up +RUN pip3 install --break-system-packages /colcon_ws/src/moco[dev] + # Make ROS workspace and build it RUN source /opt/ros/jazzy/setup.bash && \ @@ -30,6 +32,6 @@ RUN source /opt/ros/jazzy/setup.bash && \ CMD /bin/bash COPY .docker/entrypoint.sh /entrypoint.sh RUN chmod +x entrypoint.sh -WORKDIR /colcon_ws/src/as2fm +WORKDIR /colcon_ws/src/moco ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 15922140..34a37225 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -6,8 +6,15 @@ on: pull_request: env: - REGISTRY_IMAGE: ghcr.io/${{ github.repository_owner }}/as2fm - REGISTRY_IMAGE_LATEST: ghcr.io/${{ github.repository_owner }}/as2fm:latest + + OWNER: '${{ github.repository_owner }}' + + # TODO hardcoded, should instead get github.repository_owner and convert to lowercase + # (This breaks tests in forks) + OWNER_LC: 'nevertools' + + REGISTRY_IMAGE: ghcr.io/$OWNER_LC/moco + REGISTRY_IMAGE_LATEST: ghcr.io/$OWNER_LC/moco:latest RAW_BRANCH_NAME: ${{ github.head_ref || github.ref_name }} jobs: build: @@ -31,7 +38,7 @@ jobs: - name: Push to gh registry with sha and branch if: ${{ !github.event.pull_request.head.repo.fork }} run: | - echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin + echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $OWNER_LC --password-stdin # tag with sha and push docker tag ${{ env.REGISTRY_IMAGE_LATEST }} ${{ env.REGISTRY_IMAGE }}:${{ github.sha }} docker push ${{ env.REGISTRY_IMAGE }}:${{ github.sha }} @@ -41,11 +48,11 @@ jobs: docker push ${{ env.REGISTRY_IMAGE }}:$BRANCH_NAME echo "TAG_NAME=$BRANCH_NAME" >> $GITHUB_ENV - name: Testing - run: docker run ${{ env.REGISTRY_IMAGE_LATEST }} pytest /colcon_ws/src/as2fm + run: docker run ${{ env.REGISTRY_IMAGE_LATEST }} pytest /colcon_ws/src/moco - name: Push to gh registry with latest if this is main if: github.ref == 'refs/heads/main' run: | - echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin + echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $OWNER_LC --password-stdin # only from main we actually push to latest docker push ${{ env.REGISTRY_IMAGE_LATEST }} echo "TAG_NAME=latest" >> $GITHUB_ENV diff --git a/.gitignore b/.gitignore index 7c7ded91..2979d496 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,8 @@ build/ # Sphinx API/ +# Output folders of examples shouldn't be uploaded to github repo +/examples/**/output/ ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 38bf4fcd..f68bb06e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,7 +3,7 @@ Want to contribute? Great! You can do so through the standard GitHub pull request model. For large contributions we do encourage you to file a ticket in the GitHub issues tracking system prior to any code development to coordinate -with the as2fm development team early in the process. +with the moco development team early in the process. Coordinating up front helps to avoid frustration later on. Your contribution must be licensed under the Apache-2.0 license, the license @@ -89,7 +89,7 @@ Often employers or academic institution have ownership over code that is written in certain circumstances, so please do due diligence to ensure that you have the right to submit the code. -If you are a developer who is authorized to contribute to as2fm +If you are a developer who is authorized to contribute to moco on behalf of your employer, then please use your corporate email address in the Signed-off-by tag. Otherwise please use a personal email address. @@ -100,7 +100,7 @@ Each contributor is responsible for identifying themselves in the Please add the respective information corresponding to the Signed-off-by tag as part of your first pull request. -If you are a developer who is authorized to contribute to as2fm +If you are a developer who is authorized to contribute to moco on behalf of your employer, then add your company / organization to the list of copyright holders in the [NOTICE](NOTICE) file. As author of a corporate contribution you can also add your name and corporate email address as in the diff --git a/NOTICE b/NOTICE index e61fcb35..4f0f5039 100644 --- a/NOTICE +++ b/NOTICE @@ -1,4 +1,4 @@ -# This is the official list of AS2FM copyright holders and authors. +# This is the official list of moco copyright holders and authors. # # Often employers or academic institutions have ownership over code that is # written in certain circumstances, so please do due diligence to ensure that diff --git a/README.md b/README.md index ecbe4b08..24db50c4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Autonomous Systems to Formal Models (AS2FM) +# Autonomous Systems to Formal Models (moco) ## Summary overview @@ -6,7 +6,7 @@ This package provides tools to convert the high level representation of an auton ## Documentation -Please access the documentation via [convince-project.github.io/AS2FM](https://convince-project.github.io/AS2FM) +Please access the documentation via [convince-project.github.io/moco](https://convince-project.github.io/moco) ## Further Information @@ -16,8 +16,8 @@ See [Contributing](./CONTRIBUTING.md). ### Feedback -Feedback is highly appreciated. Please open issues on new ideas, bugs, etc. here at [as2fm/issues](https://github.com/convince-project/as2fm/issues) or reach out to the maintainers. +Feedback is highly appreciated. Please open issues on new ideas, bugs, etc. here at [moco/issues](https://github.com/convince-project/moco/issues) or reach out to the maintainers. ### License -AS2FM comes under the Apache-2.0 license, see [LICENSE](./LICENSE). +moco comes under the Apache-2.0 license, see [LICENSE](./LICENSE). diff --git a/docker-compose.yml b/docker-compose.yml index 50b17f5e..a218ba7b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,11 +1,11 @@ services: base: - image: ghcr.io/convince-project/as2fm:latest + image: ghcr.io/nevertools/moco:latest # TODO fix link once release is up build: context: . dockerfile: .docker/Dockerfile - target: as2fm + target: moco # Ensures signals are actually passed and reaped in the container for shutdowns. # https://docs.docker.com/compose/compose-file/compose-file-v3/#init init: true @@ -29,7 +29,7 @@ services: - QTWEBENGINE_DISABLE_SANDBOX=1 volumes: # Mount the workshop source code - - ./:/colcon_ws/src/as2fm:rw + - ./:/colcon_ws/src/moco:rw # Allows graphical programs in the container - /tmp/.X11-unix:/tmp/.X11-unix:rw - ${XAUTHORITY:-$HOME/.Xauthority}:/root/.Xauthority @@ -39,6 +39,6 @@ services: extends: base command: > bash -c " - python3 -m pytest /colcon_ws/src/as2fm + python3 -m pytest /colcon_ws/src/moco " profiles: [test] diff --git a/docs/README.md b/docs/README.md index c04bd518..a9e03c12 100644 --- a/docs/README.md +++ b/docs/README.md @@ -3,9 +3,9 @@ Before you can build the documentation, you need to install the required packages as described above, since also the code API documentation of those packages is built. ``` -pip install ../as2fm_common -pip install ../scxml_converter -pip install ../jani_generator +pip install ../moco_common +pip install ../roaml_converter +pip install ../roaml_generator pip install -r requirements.txt make html ``` diff --git a/docs/source/api.rst b/docs/source/api.rst index 52689baf..41c5ea92 100644 --- a/docs/source/api.rst +++ b/docs/source/api.rst @@ -6,4 +6,4 @@ API :template: custom-module-template.rst :recursive: - as2fm + moco diff --git a/docs/source/installation.rst b/docs/source/installation.rst index 09a867d6..6d93d4c2 100644 --- a/docs/source/installation.rst +++ b/docs/source/installation.rst @@ -75,9 +75,9 @@ AS2FM Python Package .. code-block:: bash - python3 -m pip uninstall as2fm_common - python3 -m pip uninstall jani_generator - python3 -m pip uninstall scxml_converter + python3 -m pip uninstall moco_common + python3 -m pip uninstall roaml_generator + python3 -m pip uninstall roaml_converter python3 -m pip uninstall jani_visualizer python3 -m pip uninstall trace_visualizer diff --git a/docs/source/tutorials.rst b/docs/source/tutorials.rst index c1e36e61..80838fd9 100644 --- a/docs/source/tutorials.rst +++ b/docs/source/tutorials.rst @@ -49,7 +49,7 @@ Reference Model: Fetch & Carry Robot For this tutorial we use the model defined here: `tutorial_fetch_and_carry `_. A classical fetch and carry task is implemented there. A robot should drive to the pantry where food is stored, pick up snacks, drive to the table and place the snacks there. The robot should be done with this task after at most 100 seconds. -The model consists of a `main.xml `_ file, referencing the BT `bt_tree.xml `_ running in the system and the SCXML files modeling the BT plugins for navigating `bt_navigate_action.scxml `_, picking `bt_pick_action.scxml `_ file, referencing the BT `bt_tree.xml `_ running in the system and the SCXML files modeling the BT plugins for navigating `bt_navigate_action.scxml `_, picking `bt_pick_action.scxml `__, and placing `bt_place_action.scxml `_, as well as the world model `world.scxml `_. Finally, there is the property to check later with SMC Storm in JANI format in `properties.jani `_. All of those components are summarized and collected in the `main.xml `_ file. diff --git a/docs/test_doc.py b/docs/test_doc.py index 4084fe86..22ca4c97 100644 --- a/docs/test_doc.py +++ b/docs/test_doc.py @@ -19,7 +19,7 @@ CWD = "cwd" EXPECTED_FILES = "expected-files" -AS2FM_FOLDER = os.path.join(__file__, "..", "..") +MOCO_FOLDER = os.path.join(__file__, "..", "..") def evaluate_bash_block(example, cwd): @@ -105,13 +105,15 @@ def collect_docs(): documents = [] for f_path in all_rst_files: doc = sybil.parse(f_path) - rel_path = os.path.relpath(f_path, AS2FM_FOLDER) + rel_path = os.path.relpath(f_path, MOCO_FOLDER) if len(list(doc)) > 0: documents.append([rel_path, list(doc)]) print(f"Found {len(documents)} .rst files with code to test.") return documents +# TODO rewrite the documentation, then remove this skip mark +@pytest.mark.skip(reason="Docs are gonna have to be redone, no point in testing the old ones") @pytest.mark.parametrize("path, blocks", collect_docs()) def test_doc_rst(path, blocks): """Testing all code blocks in one *.rst file under `path`.""" @@ -147,7 +149,7 @@ def test_doc_rst(path, blocks): print(f"Evaluating environment >{env}< with {options} ...") if CWD not in options: options[CWD] = "." - cwd = os.path.realpath(os.path.join(AS2FM_FOLDER, options[CWD])) + cwd = os.path.realpath(os.path.join(MOCO_FOLDER, options[CWD])) print(f"In folder {cwd}") expected_files = [] diff --git a/pyproject.toml b/pyproject.toml index 65435691..bfad1922 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["setuptools>=61.0.0", "wheel", "pip>=24.2"] build-backend = "setuptools.build_meta" [project] -name = "as2fm" +name = "moco" version = "0.0.1" description = "" readme = "README.md" @@ -19,13 +19,13 @@ classifiers = [ keywords = [] # TODO: Check dependencies to remove dependencies = [ - # as2fm_common + # moco_common "lxml", - # jani_generator + # roaml_generator "jsonschema", "esprima", "escodegen", - # scxml_converter + # roaml_converter "typing-extensions>=4.12.2", ] requires-python = ">=3.10" @@ -33,16 +33,16 @@ requires-python = ">=3.10" # Comment these lines out, since they prevent the package from being found in code # [tool.setuptools.packages.find] # where = ["src"] -# include = ["as2fm", "as2fm.*"] +# include = ["moco", "moco.*"] # # [tool.setuptools.package-dir] -# "as2fm" = "src/as2fm" +# "moco" = "src/moco" [tool.setuptools.package-data] -"as2fm.resources" = ["bt_control_nodes/*.scxml"] +"moco.resources" = ["bt_control_nodes/*.scxml"] [project.scripts] -as2fm_scxml_to_jani = "as2fm.jani_generator.main:main_scxml_to_jani" # TODO: rename this function +moco_roaml_to_scxml = "moco.roaml_generator.main:main_roaml_to_scxml" # TODO: rename this function [project.optional-dependencies] dev = [ diff --git a/ros_support_interfaces/grid_robot_interfaces/README.md b/ros_support_interfaces/grid_robot_interfaces/README.md index b4a6a3b7..a62a9264 100644 --- a/ros_support_interfaces/grid_robot_interfaces/README.md +++ b/ros_support_interfaces/grid_robot_interfaces/README.md @@ -1 +1 @@ -Used in `test/jani_generator/_test_data/grid_robot_blackboard` +Used in `test/roaml_generator/_test_data/grid_robot_blackboard` diff --git a/ros_support_interfaces/as2fm_test_ros_interfaces/CMakeLists.txt b/ros_support_interfaces/moco_test_ros_interfaces/CMakeLists.txt similarity index 75% rename from ros_support_interfaces/as2fm_test_ros_interfaces/CMakeLists.txt rename to ros_support_interfaces/moco_test_ros_interfaces/CMakeLists.txt index 3611b4be..72e46717 100644 --- a/ros_support_interfaces/as2fm_test_ros_interfaces/CMakeLists.txt +++ b/ros_support_interfaces/moco_test_ros_interfaces/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.5) -project(as2fm_test_ros_interfaces) +project(moco_test_ros_interfaces) # find dependencies find_package(ament_cmake REQUIRED) diff --git a/ros_support_interfaces/as2fm_test_ros_interfaces/package.xml b/ros_support_interfaces/moco_test_ros_interfaces/package.xml similarity index 91% rename from ros_support_interfaces/as2fm_test_ros_interfaces/package.xml rename to ros_support_interfaces/moco_test_ros_interfaces/package.xml index 0dff6b0b..d7bad620 100644 --- a/ros_support_interfaces/as2fm_test_ros_interfaces/package.xml +++ b/ros_support_interfaces/moco_test_ros_interfaces/package.xml @@ -1,14 +1,14 @@ - as2fm_test_ros_interfaces + moco_test_ros_interfaces 0.0.0 Meta package depending on all interface we use in the tests. Marco Lampacrescia Apache License 2.0 Marco Lampacrescia - as2fm_test_srvs + moco_test_srvs example_interfaces geometry_msgs std_msgs diff --git a/ros_support_interfaces/as2fm_test_srvs/CMakeLists.txt b/ros_support_interfaces/moco_test_srvs/CMakeLists.txt similarity index 96% rename from ros_support_interfaces/as2fm_test_srvs/CMakeLists.txt rename to ros_support_interfaces/moco_test_srvs/CMakeLists.txt index 08d71c92..092045c7 100644 --- a/ros_support_interfaces/as2fm_test_srvs/CMakeLists.txt +++ b/ros_support_interfaces/moco_test_srvs/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.5) -project(as2fm_test_srvs) +project(moco_test_srvs) # Default to C99 if(NOT CMAKE_C_STANDARD) diff --git a/ros_support_interfaces/as2fm_test_srvs/package.xml b/ros_support_interfaces/moco_test_srvs/package.xml similarity index 96% rename from ros_support_interfaces/as2fm_test_srvs/package.xml rename to ros_support_interfaces/moco_test_srvs/package.xml index 0fabaa21..02e4447a 100644 --- a/ros_support_interfaces/as2fm_test_srvs/package.xml +++ b/ros_support_interfaces/moco_test_srvs/package.xml @@ -1,7 +1,7 @@ - as2fm_test_srvs + moco_test_srvs 0.0.0 Test interface for ensuring Float support in ROS. Marco Lampacrescia diff --git a/ros_support_interfaces/as2fm_test_srvs/srv/SetFloat.srv b/ros_support_interfaces/moco_test_srvs/srv/SetFloat.srv similarity index 100% rename from ros_support_interfaces/as2fm_test_srvs/srv/SetFloat.srv rename to ros_support_interfaces/moco_test_srvs/srv/SetFloat.srv diff --git a/ros_support_interfaces/nested_interfaces/README.md b/ros_support_interfaces/nested_interfaces/README.md index 3b0602b8..a6ddb422 100644 --- a/ros_support_interfaces/nested_interfaces/README.md +++ b/ros_support_interfaces/nested_interfaces/README.md @@ -1 +1 @@ -Used in `test/jani_generator/_test_data/nested_data_ros` +Used in `test/roaml_generator/_test_data/nested_data_ros` diff --git a/src/as2fm/jani_generator/__init__.py b/src/as2fm/jani_generator/__init__.py deleted file mode 100644 index c43278a4..00000000 --- a/src/as2fm/jani_generator/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""Module jani_generator.""" diff --git a/src/as2fm/.pre-commit-config.yaml b/src/moco/.pre-commit-config.yaml similarity index 100% rename from src/as2fm/.pre-commit-config.yaml rename to src/moco/.pre-commit-config.yaml diff --git a/src/as2fm/__init__.py b/src/moco/__init__.py similarity index 100% rename from src/as2fm/__init__.py rename to src/moco/__init__.py diff --git a/src/as2fm/as2fm_common/__init__.py b/src/moco/moco_common/__init__.py similarity index 100% rename from src/as2fm/as2fm_common/__init__.py rename to src/moco/moco_common/__init__.py diff --git a/src/as2fm/as2fm_common/array_type.py b/src/moco/moco_common/array_type.py similarity index 99% rename from src/as2fm/as2fm_common/array_type.py rename to src/moco/moco_common/array_type.py index f78b1e26..96aa2f6d 100644 --- a/src/as2fm/as2fm_common/array_type.py +++ b/src/moco/moco_common/array_type.py @@ -16,7 +16,7 @@ from dataclasses import dataclass from typing import List, MutableSequence, Optional, Tuple, Type, Union, get_args -from as2fm.as2fm_common.common import ValidPlainScxmlTypes +from moco.moco_common.common import ValidPlainScxmlTypes ARRAY_BASE_TYPES = (int, float, None) diff --git a/src/as2fm/as2fm_common/common.py b/src/moco/moco_common/common.py similarity index 100% rename from src/as2fm/as2fm_common/common.py rename to src/moco/moco_common/common.py diff --git a/src/as2fm/as2fm_common/ecmascript_interpretation.py b/src/moco/moco_common/ecmascript_interpretation.py similarity index 98% rename from src/as2fm/as2fm_common/ecmascript_interpretation.py rename to src/moco/moco_common/ecmascript_interpretation.py index 6950f1b3..d628608b 100644 --- a/src/as2fm/as2fm_common/ecmascript_interpretation.py +++ b/src/moco/moco_common/ecmascript_interpretation.py @@ -24,13 +24,13 @@ from esprima.syntax import Syntax from lxml.etree import _Element as XmlElement -from as2fm.as2fm_common.ecmascript_interpretation_functions import ( +from moco.moco_common.ecmascript_interpretation_functions import ( ValidECMAScriptTypes, get_ast_expression_type, get_dict_from_object_expression, get_list_from_array_expr, ) -from as2fm.as2fm_common.logging import check_assertion, get_error_msg +from moco.moco_common.logging import check_assertion, get_error_msg class ArrayAccess: diff --git a/src/as2fm/as2fm_common/ecmascript_interpretation_functions.py b/src/moco/moco_common/ecmascript_interpretation_functions.py similarity index 98% rename from src/as2fm/as2fm_common/ecmascript_interpretation_functions.py rename to src/moco/moco_common/ecmascript_interpretation_functions.py index 59fcfa7c..ad454374 100644 --- a/src/as2fm/as2fm_common/ecmascript_interpretation_functions.py +++ b/src/moco/moco_common/ecmascript_interpretation_functions.py @@ -18,8 +18,8 @@ import esprima from esprima.syntax import Syntax -from as2fm.as2fm_common.array_type import ArrayInfo, array_value_to_type_info -from as2fm.as2fm_common.common import ValidPlainScxmlTypes +from moco.moco_common.array_type import ArrayInfo, array_value_to_type_info +from moco.moco_common.common import ValidPlainScxmlTypes # Definition of a valid ECMAScript expression type ValidECMAScriptTypes = Union[ diff --git a/src/as2fm/as2fm_common/logging.py b/src/moco/moco_common/logging.py similarity index 98% rename from src/as2fm/as2fm_common/logging.py rename to src/moco/moco_common/logging.py index 6bada50b..c49f8d06 100644 --- a/src/as2fm/as2fm_common/logging.py +++ b/src/moco/moco_common/logging.py @@ -23,7 +23,7 @@ from lxml.etree import _Element as XmlElement -from as2fm.as2fm_common.common import is_comment +from moco.moco_common.common import is_comment LOCATION_INFO = Tuple[str, int] # filename, line_number SUPPORTED_LOCATIONS = Union[XmlElement, LOCATION_INFO, str] @@ -73,7 +73,7 @@ def _get_xml_location(element: XmlElement) -> LOCATION_INFO: ) assert INTERNAL_FILEPATH_ATTR in element.attrib.keys(), ( "The element must have a filepath attribute. This is set by " - "`as2fm_common.logging.set_filepath_for_all_elements`." + "`moco_common.logging.set_filepath_for_all_elements`." ) path = element.attrib[INTERNAL_FILEPATH_ATTR] sourceline = element.sourceline diff --git a/src/as2fm/resources/bt_control_nodes/always_failure.scxml b/src/moco/resources/bt_control_nodes/always_failure.scxml similarity index 100% rename from src/as2fm/resources/bt_control_nodes/always_failure.scxml rename to src/moco/resources/bt_control_nodes/always_failure.scxml diff --git a/src/as2fm/resources/bt_control_nodes/always_success.scxml b/src/moco/resources/bt_control_nodes/always_success.scxml similarity index 100% rename from src/as2fm/resources/bt_control_nodes/always_success.scxml rename to src/moco/resources/bt_control_nodes/always_success.scxml diff --git a/src/as2fm/resources/bt_control_nodes/blackboard_check_int.scxml b/src/moco/resources/bt_control_nodes/blackboard_check_int.scxml similarity index 100% rename from src/as2fm/resources/bt_control_nodes/blackboard_check_int.scxml rename to src/moco/resources/bt_control_nodes/blackboard_check_int.scxml diff --git a/src/as2fm/resources/bt_control_nodes/fallback.scxml b/src/moco/resources/bt_control_nodes/fallback.scxml similarity index 100% rename from src/as2fm/resources/bt_control_nodes/fallback.scxml rename to src/moco/resources/bt_control_nodes/fallback.scxml diff --git a/src/as2fm/resources/bt_control_nodes/if_then_else.scxml b/src/moco/resources/bt_control_nodes/if_then_else.scxml similarity index 100% rename from src/as2fm/resources/bt_control_nodes/if_then_else.scxml rename to src/moco/resources/bt_control_nodes/if_then_else.scxml diff --git a/src/as2fm/resources/bt_control_nodes/inverter.scxml b/src/moco/resources/bt_control_nodes/inverter.scxml similarity index 100% rename from src/as2fm/resources/bt_control_nodes/inverter.scxml rename to src/moco/resources/bt_control_nodes/inverter.scxml diff --git a/src/as2fm/resources/bt_control_nodes/reactive_fallback.scxml b/src/moco/resources/bt_control_nodes/reactive_fallback.scxml similarity index 100% rename from src/as2fm/resources/bt_control_nodes/reactive_fallback.scxml rename to src/moco/resources/bt_control_nodes/reactive_fallback.scxml diff --git a/src/as2fm/resources/bt_control_nodes/reactive_sequence.scxml b/src/moco/resources/bt_control_nodes/reactive_sequence.scxml similarity index 100% rename from src/as2fm/resources/bt_control_nodes/reactive_sequence.scxml rename to src/moco/resources/bt_control_nodes/reactive_sequence.scxml diff --git a/src/as2fm/resources/bt_control_nodes/retry_node.scxml b/src/moco/resources/bt_control_nodes/retry_node.scxml similarity index 100% rename from src/as2fm/resources/bt_control_nodes/retry_node.scxml rename to src/moco/resources/bt_control_nodes/retry_node.scxml diff --git a/src/as2fm/resources/bt_control_nodes/sequence.scxml b/src/moco/resources/bt_control_nodes/sequence.scxml similarity index 100% rename from src/as2fm/resources/bt_control_nodes/sequence.scxml rename to src/moco/resources/bt_control_nodes/sequence.scxml diff --git a/src/as2fm/resources/bt_control_nodes/sequence_with_memory.scxml b/src/moco/resources/bt_control_nodes/sequence_with_memory.scxml similarity index 100% rename from src/as2fm/resources/bt_control_nodes/sequence_with_memory.scxml rename to src/moco/resources/bt_control_nodes/sequence_with_memory.scxml diff --git a/src/as2fm/resources/bt_control_nodes/set_blackboard.scxml b/src/moco/resources/bt_control_nodes/set_blackboard.scxml similarity index 100% rename from src/as2fm/resources/bt_control_nodes/set_blackboard.scxml rename to src/moco/resources/bt_control_nodes/set_blackboard.scxml diff --git a/src/as2fm/jani_generator/ros_helpers/__init__.py b/src/moco/roaml_converter/__init__.py similarity index 100% rename from src/as2fm/jani_generator/ros_helpers/__init__.py rename to src/moco/roaml_converter/__init__.py diff --git a/src/as2fm/scxml_converter/bt_converter.py b/src/moco/roaml_converter/bt_converter.py similarity index 95% rename from src/as2fm/scxml_converter/bt_converter.py rename to src/moco/roaml_converter/bt_converter.py index 62a3b0f1..590efdc5 100644 --- a/src/as2fm/scxml_converter/bt_converter.py +++ b/src/moco/roaml_converter/bt_converter.py @@ -25,10 +25,10 @@ from lxml import etree as ET from lxml.etree import _Element as XmlElement -from as2fm.as2fm_common.array_type import get_default_expression_for_type, value_to_string_expr -from as2fm.scxml_converter.data_types.struct_definition import StructDefinition -from as2fm.scxml_converter.data_types.type_utils import SCXML_DATA_STR_TO_TYPE -from as2fm.scxml_converter.scxml_entries import ( +from moco.moco_common.array_type import get_default_expression_for_type, value_to_string_expr +from moco.roaml_converter.data_types.struct_definition import StructDefinition +from moco.roaml_converter.data_types.type_utils import SCXML_DATA_STR_TO_TYPE +from moco.roaml_converter.scxml_entries import ( BtChildTickStatus, BtTickChild, RosRateCallback, @@ -42,7 +42,7 @@ ScxmlState, ScxmlTransition, ) -from as2fm.scxml_converter.scxml_entries.bt_utils import ( +from moco.roaml_converter.scxml_entries.bt_utils import ( BT_BLACKBOARD_EVENT_VALUE, BT_BLACKBOARD_GET, BT_BLACKBOARD_REQUEST, @@ -127,7 +127,7 @@ def load_available_bt_plugins( bt_plugin_scxml = ScxmlRoot.from_scxml_file(path, custom_data_types) available_bt_plugins.update({bt_plugin_scxml.get_name(): bt_plugin_scxml}) internal_bt_plugins_path = ( - resource_files("as2fm").joinpath("resources").joinpath("bt_control_nodes") + resource_files("moco").joinpath("resources").joinpath("bt_control_nodes") ) for plugin_path in internal_bt_plugins_path.iterdir(): if plugin_path.is_file() and plugin_path.suffix == ".scxml": diff --git a/src/as2fm/scxml_converter/data_types/json_struct_definition.py b/src/moco/roaml_converter/data_types/json_struct_definition.py similarity index 97% rename from src/as2fm/scxml_converter/data_types/json_struct_definition.py rename to src/moco/roaml_converter/data_types/json_struct_definition.py index f2ed8556..94bbfd5f 100644 --- a/src/as2fm/scxml_converter/data_types/json_struct_definition.py +++ b/src/moco/roaml_converter/data_types/json_struct_definition.py @@ -17,8 +17,8 @@ import os from typing import Any, Dict, List, Tuple -from as2fm.as2fm_common.logging import log_warning -from as2fm.scxml_converter.data_types.struct_definition import StructDefinition +from moco.moco_common.logging import log_warning +from moco.roaml_converter.data_types.struct_definition import StructDefinition ARRAY = "array" OBJECT = "object" diff --git a/src/as2fm/scxml_converter/data_types/struct_definition.py b/src/moco/roaml_converter/data_types/struct_definition.py similarity index 97% rename from src/as2fm/scxml_converter/data_types/struct_definition.py rename to src/moco/roaml_converter/data_types/struct_definition.py index 813be4fd..51d5b1ac 100644 --- a/src/as2fm/scxml_converter/data_types/struct_definition.py +++ b/src/moco/roaml_converter/data_types/struct_definition.py @@ -17,15 +17,15 @@ from lxml.etree import _Element as XmlElement -from as2fm.as2fm_common.array_type import ArrayInfo -from as2fm.as2fm_common.common import ValidPlainScxmlTypes -from as2fm.as2fm_common.ecmascript_interpretation import ( +from moco.moco_common.array_type import ArrayInfo +from moco.moco_common.common import ValidPlainScxmlTypes +from moco.moco_common.ecmascript_interpretation import ( ast_expression_to_string, get_object_expression_as_dict, make_ast_array_expression, ) -from as2fm.as2fm_common.logging import check_assertion, get_error_msg -from as2fm.scxml_converter.data_types.type_utils import ( +from moco.moco_common.logging import check_assertion, get_error_msg +from moco.roaml_converter.data_types.type_utils import ( get_array_type_and_dimensions_from_string, is_type_string_array, is_type_string_base_type, diff --git a/src/as2fm/scxml_converter/data_types/type_utils.py b/src/moco/roaml_converter/data_types/type_utils.py similarity index 97% rename from src/as2fm/scxml_converter/data_types/type_utils.py rename to src/moco/roaml_converter/data_types/type_utils.py index 660047b8..7b462052 100644 --- a/src/as2fm/scxml_converter/data_types/type_utils.py +++ b/src/moco/roaml_converter/data_types/type_utils.py @@ -18,8 +18,8 @@ from lxml.etree import _Element as XmlElement -from as2fm.as2fm_common.array_type import ArrayInfo -from as2fm.as2fm_common.ecmascript_interpretation import parse_ecmascript_expr_to_type +from moco.moco_common.array_type import ArrayInfo +from moco.moco_common.ecmascript_interpretation import parse_ecmascript_expr_to_type # TODO: add lower and upper bounds depending on the n. of bits used. # TODO: add support to uint diff --git a/src/as2fm/scxml_converter/data_types/xml_struct_definition.py b/src/moco/roaml_converter/data_types/xml_struct_definition.py similarity index 92% rename from src/as2fm/scxml_converter/data_types/xml_struct_definition.py rename to src/moco/roaml_converter/data_types/xml_struct_definition.py index d9b20951..d4c77283 100644 --- a/src/as2fm/scxml_converter/data_types/xml_struct_definition.py +++ b/src/moco/roaml_converter/data_types/xml_struct_definition.py @@ -18,9 +18,9 @@ import lxml.etree as ET from lxml.etree import _Element as XmlElement -from as2fm.as2fm_common.common import remove_namespace -from as2fm.as2fm_common.logging import get_error_msg, set_filepath_for_all_sub_elements -from as2fm.scxml_converter.data_types.struct_definition import StructDefinition +from moco.moco_common.common import remove_namespace +from moco.moco_common.logging import get_error_msg, set_filepath_for_all_sub_elements +from moco.roaml_converter.data_types.struct_definition import StructDefinition class XmlStructDefinition(StructDefinition): diff --git a/src/as2fm/scxml_converter/scxml_entries/__init__.py b/src/moco/roaml_converter/scxml_entries/__init__.py similarity index 100% rename from src/as2fm/scxml_converter/scxml_entries/__init__.py rename to src/moco/roaml_converter/scxml_entries/__init__.py diff --git a/src/as2fm/scxml_converter/scxml_entries/bt_utils.py b/src/moco/roaml_converter/scxml_entries/bt_utils.py similarity index 98% rename from src/as2fm/scxml_converter/scxml_entries/bt_utils.py rename to src/moco/roaml_converter/scxml_entries/bt_utils.py index c418909a..a80a915e 100644 --- a/src/as2fm/scxml_converter/scxml_entries/bt_utils.py +++ b/src/moco/roaml_converter/scxml_entries/bt_utils.py @@ -19,9 +19,9 @@ from enum import Enum, auto from typing import Dict, Optional, Tuple, Type, Union -from as2fm.scxml_converter.data_types.type_utils import SCXML_DATA_STR_TO_TYPE -from as2fm.scxml_converter.scxml_entries import ScxmlBase -from as2fm.scxml_converter.scxml_entries.utils import ( +from moco.roaml_converter.data_types.type_utils import SCXML_DATA_STR_TO_TYPE +from moco.roaml_converter.scxml_entries import ScxmlBase +from moco.roaml_converter.scxml_entries.utils import ( PLAIN_SCXML_EVENT_DATA_PREFIX, to_integer, ) diff --git a/src/as2fm/scxml_converter/scxml_entries/ros_utils.py b/src/moco/roaml_converter/scxml_entries/ros_utils.py similarity index 97% rename from src/as2fm/scxml_converter/scxml_entries/ros_utils.py rename to src/moco/roaml_converter/scxml_entries/ros_utils.py index e52735da..e25385d7 100644 --- a/src/as2fm/scxml_converter/scxml_entries/ros_utils.py +++ b/src/moco/roaml_converter/scxml_entries/ros_utils.py @@ -18,8 +18,8 @@ import re from typing import Any, Dict, List, Tuple, Type -from as2fm.scxml_converter.scxml_entries import RosField, ScxmlBase -from as2fm.scxml_converter.scxml_entries.utils import all_non_empty_strings +from moco.roaml_converter.scxml_entries import RosField, ScxmlBase +from moco.roaml_converter.scxml_entries.utils import all_non_empty_strings MSG_TYPE_SUBSTITUTIONS = { "boolean": "bool", @@ -130,7 +130,7 @@ def get_srv_type_params(service_definition: str) -> Tuple[Dict[str, str], Dict[s srv_module = __import__(interface_ns + ".srv", fromlist=[""]) srv_class = getattr(srv_module, interface_type) - # TODO: Fields can be nested. Look AS2FM/scxml_converter/src/scxml_converter/scxml_converter.py + # TODO: Fields can be nested. Look MOCO/roaml_converter/src/roaml_converter/roaml_converter.py req_fields = extract_params_from_ros_type(srv_class.Request) res_fields = extract_params_from_ros_type(srv_class.Response) @@ -325,15 +325,15 @@ def append_ros_declaration(self, scxml_ros_declaration: ScxmlBase) -> None: :param scxml_ros_declaration: The ROS declaration to add (inheriting from RosDeclaration). """ - from as2fm.scxml_converter.scxml_entries.scxml_ros_action_client import RosActionClient - from as2fm.scxml_converter.scxml_entries.scxml_ros_action_server import RosActionServer - from as2fm.scxml_converter.scxml_entries.scxml_ros_base import RosDeclaration - from as2fm.scxml_converter.scxml_entries.scxml_ros_service import ( + from moco.roaml_converter.scxml_entries.scxml_ros_action_client import RosActionClient + from moco.roaml_converter.scxml_entries.scxml_ros_action_server import RosActionServer + from moco.roaml_converter.scxml_entries.scxml_ros_base import RosDeclaration + from moco.roaml_converter.scxml_entries.scxml_ros_service import ( RosServiceClient, RosServiceServer, ) - from as2fm.scxml_converter.scxml_entries.scxml_ros_timer import RosTimeRate - from as2fm.scxml_converter.scxml_entries.scxml_ros_topic import ( + from moco.roaml_converter.scxml_entries.scxml_ros_timer import RosTimeRate + from moco.roaml_converter.scxml_entries.scxml_ros_topic import ( RosTopicPublisher, RosTopicSubscriber, ) diff --git a/src/as2fm/scxml_converter/scxml_entries/scxml_base.py b/src/moco/roaml_converter/scxml_entries/scxml_base.py similarity index 97% rename from src/as2fm/scxml_converter/scxml_entries/scxml_base.py rename to src/moco/roaml_converter/scxml_entries/scxml_base.py index cbc9fd94..9602579e 100644 --- a/src/as2fm/scxml_converter/scxml_entries/scxml_base.py +++ b/src/moco/roaml_converter/scxml_entries/scxml_base.py @@ -22,7 +22,7 @@ from lxml.etree import _Element as XmlElement from typing_extensions import Self -from as2fm.scxml_converter.data_types.struct_definition import StructDefinition +from moco.roaml_converter.data_types.struct_definition import StructDefinition class ScxmlBase: diff --git a/src/as2fm/scxml_converter/scxml_entries/scxml_bt_base.py b/src/moco/roaml_converter/scxml_entries/scxml_bt_base.py similarity index 97% rename from src/as2fm/scxml_converter/scxml_entries/scxml_bt_base.py rename to src/moco/roaml_converter/scxml_entries/scxml_bt_base.py index 7e752468..e1650a0e 100644 --- a/src/as2fm/scxml_converter/scxml_entries/scxml_bt_base.py +++ b/src/moco/roaml_converter/scxml_entries/scxml_bt_base.py @@ -23,21 +23,21 @@ from lxml import etree as ET from lxml.etree import _Element as XmlElement -from as2fm.scxml_converter.data_types.struct_definition import StructDefinition -from as2fm.scxml_converter.scxml_entries import ( +from moco.roaml_converter.data_types.struct_definition import StructDefinition +from moco.roaml_converter.scxml_entries import ( ScxmlExecutionBody, ScxmlIf, ScxmlSend, ScxmlTransition, ScxmlTransitionTarget, ) -from as2fm.scxml_converter.scxml_entries.bt_utils import process_bt_child_seq_id -from as2fm.scxml_converter.scxml_entries.utils import ( +from moco.roaml_converter.scxml_entries.bt_utils import process_bt_child_seq_id +from moco.roaml_converter.scxml_entries.utils import ( CallbackType, convert_expression_with_object_arrays, get_plain_expression, ) -from as2fm.scxml_converter.scxml_entries.xml_utils import assert_xml_tag_ok, get_xml_attribute +from moco.roaml_converter.scxml_entries.xml_utils import assert_xml_tag_ok, get_xml_attribute class BtGenericRequestHandle(ScxmlTransition): diff --git a/src/as2fm/scxml_converter/scxml_entries/scxml_bt_comm_interfaces.py b/src/moco/roaml_converter/scxml_entries/scxml_bt_comm_interfaces.py similarity index 93% rename from src/as2fm/scxml_converter/scxml_entries/scxml_bt_comm_interfaces.py rename to src/moco/roaml_converter/scxml_entries/scxml_bt_comm_interfaces.py index dd5505eb..0bf99305 100644 --- a/src/as2fm/scxml_converter/scxml_entries/scxml_bt_comm_interfaces.py +++ b/src/moco/roaml_converter/scxml_entries/scxml_bt_comm_interfaces.py @@ -21,29 +21,29 @@ from lxml.etree import _Element as XmlElement -from as2fm.as2fm_common.common import is_valid_variable_name -from as2fm.as2fm_common.logging import check_assertion -from as2fm.scxml_converter.data_types.struct_definition import StructDefinition -from as2fm.scxml_converter.scxml_entries import ( +from moco.moco_common.common import is_valid_variable_name +from moco.moco_common.logging import check_assertion +from moco.roaml_converter.data_types.struct_definition import StructDefinition +from moco.roaml_converter.scxml_entries import ( ScxmlExecutionBody, ScxmlParam, ScxmlSend, ScxmlTransitionTarget, ) -from as2fm.scxml_converter.scxml_entries.bt_utils import ( +from moco.roaml_converter.scxml_entries.bt_utils import ( BtResponse, generate_bt_halt_event, generate_bt_halt_response_event, generate_bt_tick_event, generate_bt_tick_response_event, ) -from as2fm.scxml_converter.scxml_entries.scxml_bt_base import ( +from moco.roaml_converter.scxml_entries.scxml_bt_base import ( BtGenericRequestHandle, BtGenericRequestSend, BtGenericStatusHandle, BtGenericStatusSend, ) -from as2fm.scxml_converter.scxml_entries.xml_utils import assert_xml_tag_ok, get_xml_attribute +from moco.roaml_converter.scxml_entries.xml_utils import assert_xml_tag_ok, get_xml_attribute class BtTick(BtGenericRequestHandle): diff --git a/src/as2fm/scxml_converter/scxml_entries/scxml_bt_in_port.py b/src/moco/roaml_converter/scxml_entries/scxml_bt_in_port.py similarity index 86% rename from src/as2fm/scxml_converter/scxml_entries/scxml_bt_in_port.py rename to src/moco/roaml_converter/scxml_entries/scxml_bt_in_port.py index 495ddf96..43ef5ad8 100644 --- a/src/as2fm/scxml_converter/scxml_entries/scxml_bt_in_port.py +++ b/src/moco/roaml_converter/scxml_entries/scxml_bt_in_port.py @@ -22,10 +22,10 @@ from lxml import etree as ET from lxml.etree import _Element as XmlElement -from as2fm.scxml_converter.data_types.struct_definition import StructDefinition -from as2fm.scxml_converter.scxml_entries import ScxmlBase -from as2fm.scxml_converter.scxml_entries.utils import is_non_empty_string -from as2fm.scxml_converter.scxml_entries.xml_utils import assert_xml_tag_ok, get_xml_attribute +from moco.roaml_converter.data_types.struct_definition import StructDefinition +from moco.roaml_converter.scxml_entries import ScxmlBase +from moco.roaml_converter.scxml_entries.utils import is_non_empty_string +from moco.roaml_converter.scxml_entries.xml_utils import assert_xml_tag_ok, get_xml_attribute class BtGetValueInputPort(ScxmlBase): diff --git a/src/as2fm/scxml_converter/scxml_entries/scxml_bt_out_port.py b/src/moco/roaml_converter/scxml_entries/scxml_bt_out_port.py similarity index 89% rename from src/as2fm/scxml_converter/scxml_entries/scxml_bt_out_port.py rename to src/moco/roaml_converter/scxml_entries/scxml_bt_out_port.py index 08c3b9d3..a52b21b6 100644 --- a/src/as2fm/scxml_converter/scxml_entries/scxml_bt_out_port.py +++ b/src/moco/roaml_converter/scxml_entries/scxml_bt_out_port.py @@ -22,17 +22,17 @@ from lxml import etree as ET from lxml.etree import _Element as XmlElement -from as2fm.scxml_converter.data_types.struct_definition import StructDefinition -from as2fm.scxml_converter.scxml_entries import ScxmlParam, ScxmlSend -from as2fm.scxml_converter.scxml_entries.bt_utils import ( +from moco.roaml_converter.data_types.struct_definition import StructDefinition +from moco.roaml_converter.scxml_entries import ScxmlParam, ScxmlSend +from moco.roaml_converter.scxml_entries.bt_utils import ( BT_SET_BLACKBOARD_PARAM, BtPortsHandler, generate_bt_blackboard_set, get_blackboard_variable_name, is_blackboard_reference, ) -from as2fm.scxml_converter.scxml_entries.utils import is_non_empty_string -from as2fm.scxml_converter.scxml_entries.xml_utils import assert_xml_tag_ok, get_xml_attribute +from moco.roaml_converter.scxml_entries.utils import is_non_empty_string +from moco.roaml_converter.scxml_entries.xml_utils import assert_xml_tag_ok, get_xml_attribute class BtSetValueOutputPort(ScxmlSend): diff --git a/src/as2fm/scxml_converter/scxml_entries/scxml_bt_port_declaration.py b/src/moco/roaml_converter/scxml_entries/scxml_bt_port_declaration.py similarity index 93% rename from src/as2fm/scxml_converter/scxml_entries/scxml_bt_port_declaration.py rename to src/moco/roaml_converter/scxml_entries/scxml_bt_port_declaration.py index f6872cd1..871bd03f 100644 --- a/src/as2fm/scxml_converter/scxml_entries/scxml_bt_port_declaration.py +++ b/src/moco/roaml_converter/scxml_entries/scxml_bt_port_declaration.py @@ -22,10 +22,10 @@ from lxml import etree as ET from lxml.etree import _Element as XmlElement -from as2fm.scxml_converter.data_types.struct_definition import StructDefinition -from as2fm.scxml_converter.scxml_entries import ScxmlBase -from as2fm.scxml_converter.scxml_entries.utils import is_non_empty_string -from as2fm.scxml_converter.scxml_entries.xml_utils import assert_xml_tag_ok, get_xml_attribute +from moco.roaml_converter.data_types.struct_definition import StructDefinition +from moco.roaml_converter.scxml_entries import ScxmlBase +from moco.roaml_converter.scxml_entries.utils import is_non_empty_string +from moco.roaml_converter.scxml_entries.xml_utils import assert_xml_tag_ok, get_xml_attribute class BtInputPortDeclaration(ScxmlBase): diff --git a/src/as2fm/scxml_converter/scxml_entries/scxml_data.py b/src/moco/roaml_converter/scxml_entries/scxml_data.py similarity index 95% rename from src/as2fm/scxml_converter/scxml_entries/scxml_data.py rename to src/moco/roaml_converter/scxml_entries/scxml_data.py index 8aa503a2..ed8a2a6c 100644 --- a/src/as2fm/scxml_converter/scxml_entries/scxml_data.py +++ b/src/moco/roaml_converter/scxml_entries/scxml_data.py @@ -23,12 +23,12 @@ from lxml import etree as ET from lxml.etree import _Element as XmlElement -from as2fm.as2fm_common.common import is_comment -from as2fm.as2fm_common.logging import check_assertion, get_error_msg, log_error -from as2fm.scxml_converter.data_types.struct_definition import ( +from moco.moco_common.common import is_comment +from moco.moco_common.logging import check_assertion, get_error_msg, log_error +from moco.roaml_converter.data_types.struct_definition import ( StructDefinition, ) -from as2fm.scxml_converter.data_types.type_utils import ( +from moco.roaml_converter.data_types.type_utils import ( convert_string_to_type, get_array_type_and_dimensions_from_string, get_data_type_from_string, @@ -37,19 +37,19 @@ is_type_string_array, is_type_string_base_type, ) -from as2fm.scxml_converter.scxml_entries import BtGetValueInputPort, ScxmlBase -from as2fm.scxml_converter.scxml_entries.bt_utils import ( +from moco.roaml_converter.scxml_entries import BtGetValueInputPort, ScxmlBase +from moco.roaml_converter.scxml_entries.bt_utils import ( BtPortsHandler, BtResponse, is_blackboard_reference, ) -from as2fm.scxml_converter.scxml_entries.ros_utils import ScxmlRosDeclarationsContainer -from as2fm.scxml_converter.scxml_entries.type_utils import ScxmlStructDeclarationsContainer -from as2fm.scxml_converter.scxml_entries.utils import ( +from moco.roaml_converter.scxml_entries.ros_utils import ScxmlRosDeclarationsContainer +from moco.roaml_converter.scxml_entries.type_utils import ScxmlStructDeclarationsContainer +from moco.roaml_converter.scxml_entries.utils import ( convert_expression_with_string_literals, get_plain_variable_name, ) -from as2fm.scxml_converter.scxml_entries.xml_utils import ( +from moco.roaml_converter.scxml_entries.xml_utils import ( assert_xml_tag_ok, get_xml_attribute, read_value_from_xml_arg_or_child, diff --git a/src/as2fm/scxml_converter/scxml_entries/scxml_data_model.py b/src/moco/roaml_converter/scxml_entries/scxml_data_model.py similarity index 89% rename from src/as2fm/scxml_converter/scxml_entries/scxml_data_model.py rename to src/moco/roaml_converter/scxml_entries/scxml_data_model.py index 98d5b385..b4e24d39 100644 --- a/src/as2fm/scxml_converter/scxml_entries/scxml_data_model.py +++ b/src/moco/roaml_converter/scxml_entries/scxml_data_model.py @@ -22,14 +22,14 @@ from lxml import etree as ET from lxml.etree import _Element as XmlElement -from as2fm.as2fm_common.common import is_comment -from as2fm.as2fm_common.logging import get_error_msg, log_error -from as2fm.scxml_converter.data_types.struct_definition import StructDefinition -from as2fm.scxml_converter.scxml_entries import ScxmlBase, ScxmlData -from as2fm.scxml_converter.scxml_entries.bt_utils import BtPortsHandler -from as2fm.scxml_converter.scxml_entries.ros_utils import ScxmlRosDeclarationsContainer -from as2fm.scxml_converter.scxml_entries.type_utils import ScxmlStructDeclarationsContainer -from as2fm.scxml_converter.scxml_entries.xml_utils import assert_xml_tag_ok +from moco.moco_common.common import is_comment +from moco.moco_common.logging import get_error_msg, log_error +from moco.roaml_converter.data_types.struct_definition import StructDefinition +from moco.roaml_converter.scxml_entries import ScxmlBase, ScxmlData +from moco.roaml_converter.scxml_entries.bt_utils import BtPortsHandler +from moco.roaml_converter.scxml_entries.ros_utils import ScxmlRosDeclarationsContainer +from moco.roaml_converter.scxml_entries.type_utils import ScxmlStructDeclarationsContainer +from moco.roaml_converter.scxml_entries.xml_utils import assert_xml_tag_ok class ScxmlDataModel(ScxmlBase): diff --git a/src/as2fm/scxml_converter/scxml_entries/scxml_executable_entries.py b/src/moco/roaml_converter/scxml_entries/scxml_executable_entries.py similarity index 98% rename from src/as2fm/scxml_converter/scxml_entries/scxml_executable_entries.py rename to src/moco/roaml_converter/scxml_entries/scxml_executable_entries.py index baa8d2f9..dbb24fdf 100644 --- a/src/as2fm/scxml_converter/scxml_entries/scxml_executable_entries.py +++ b/src/moco/roaml_converter/scxml_entries/scxml_executable_entries.py @@ -23,23 +23,23 @@ from lxml import etree as ET from lxml.etree import _Element as XmlElement -from as2fm.as2fm_common.common import is_comment -from as2fm.as2fm_common.logging import get_error_msg -from as2fm.scxml_converter.data_types.struct_definition import StructDefinition -from as2fm.scxml_converter.scxml_entries import ( +from moco.moco_common.common import is_comment +from moco.moco_common.logging import get_error_msg +from moco.roaml_converter.data_types.struct_definition import StructDefinition +from moco.roaml_converter.scxml_entries import ( BtGetValueInputPort, ScxmlBase, ScxmlParam, ScxmlRosDeclarationsContainer, ) -from as2fm.scxml_converter.scxml_entries.bt_utils import ( +from moco.roaml_converter.scxml_entries.bt_utils import ( BtPortsHandler, get_input_variable_as_scxml_expression, is_blackboard_reference, is_removed_bt_event, ) -from as2fm.scxml_converter.scxml_entries.type_utils import ScxmlStructDeclarationsContainer -from as2fm.scxml_converter.scxml_entries.utils import ( +from moco.roaml_converter.scxml_entries.type_utils import ScxmlStructDeclarationsContainer +from moco.roaml_converter.scxml_entries.utils import ( CallbackType, convert_expression_with_object_arrays, convert_expression_with_string_literals, @@ -47,7 +47,7 @@ get_plain_expression, is_non_empty_string, ) -from as2fm.scxml_converter.scxml_entries.xml_utils import ( +from moco.roaml_converter.scxml_entries.xml_utils import ( assert_xml_tag_ok, get_xml_attribute, read_value_from_xml_child, diff --git a/src/as2fm/scxml_converter/scxml_entries/scxml_param.py b/src/moco/roaml_converter/scxml_entries/scxml_param.py similarity index 92% rename from src/as2fm/scxml_converter/scxml_entries/scxml_param.py rename to src/moco/roaml_converter/scxml_entries/scxml_param.py index 3feda531..eb198b8b 100644 --- a/src/as2fm/scxml_converter/scxml_entries/scxml_param.py +++ b/src/moco/roaml_converter/scxml_entries/scxml_param.py @@ -22,22 +22,22 @@ from lxml import etree as ET from lxml.etree import _Element as XmlElement -from as2fm.as2fm_common.ecmascript_interpretation import has_operators, is_literal -from as2fm.scxml_converter.data_types.struct_definition import StructDefinition -from as2fm.scxml_converter.scxml_entries import BtGetValueInputPort, ScxmlBase -from as2fm.scxml_converter.scxml_entries.bt_utils import ( +from moco.moco_common.ecmascript_interpretation import has_operators, is_literal +from moco.roaml_converter.data_types.struct_definition import StructDefinition +from moco.roaml_converter.scxml_entries import BtGetValueInputPort, ScxmlBase +from moco.roaml_converter.scxml_entries.bt_utils import ( BtPortsHandler, get_input_variable_as_scxml_expression, is_blackboard_reference, ) -from as2fm.scxml_converter.scxml_entries.type_utils import ScxmlStructDeclarationsContainer -from as2fm.scxml_converter.scxml_entries.utils import ( +from moco.roaml_converter.scxml_entries.type_utils import ScxmlStructDeclarationsContainer +from moco.roaml_converter.scxml_entries.utils import ( CallbackType, convert_expression_with_object_arrays, get_plain_variable_name, is_non_empty_string, ) -from as2fm.scxml_converter.scxml_entries.xml_utils import ( +from moco.roaml_converter.scxml_entries.xml_utils import ( assert_xml_tag_ok, get_xml_attribute, read_value_from_xml_arg_or_child, diff --git a/src/as2fm/scxml_converter/scxml_entries/scxml_root.py b/src/moco/roaml_converter/scxml_entries/scxml_root.py similarity index 96% rename from src/as2fm/scxml_converter/scxml_entries/scxml_root.py rename to src/moco/roaml_converter/scxml_entries/scxml_root.py index 170ec97d..e90287e1 100644 --- a/src/as2fm/scxml_converter/scxml_entries/scxml_root.py +++ b/src/moco/roaml_converter/scxml_entries/scxml_root.py @@ -23,14 +23,14 @@ from lxml import etree as ET from lxml.etree import _Element as XmlElement -from as2fm.as2fm_common.common import is_comment, remove_namespace -from as2fm.as2fm_common.logging import ( +from moco.moco_common.common import is_comment, remove_namespace +from moco.moco_common.logging import ( check_assertion, get_error_msg, set_filepath_for_all_sub_elements, ) -from as2fm.scxml_converter.data_types.struct_definition import StructDefinition -from as2fm.scxml_converter.scxml_entries import ( +from moco.roaml_converter.data_types.struct_definition import StructDefinition +from moco.roaml_converter.scxml_entries import ( BtInputPortDeclaration, BtOutputPortDeclaration, BtPortDeclarations, @@ -41,11 +41,11 @@ ScxmlRosDeclarationsContainer, ScxmlState, ) -from as2fm.scxml_converter.scxml_entries.bt_utils import BtPortsHandler -from as2fm.scxml_converter.scxml_entries.scxml_ros_base import RosDeclaration -from as2fm.scxml_converter.scxml_entries.type_utils import ScxmlStructDeclarationsContainer -from as2fm.scxml_converter.scxml_entries.utils import is_non_empty_string -from as2fm.scxml_converter.scxml_entries.xml_utils import ( +from moco.roaml_converter.scxml_entries.bt_utils import BtPortsHandler +from moco.roaml_converter.scxml_entries.scxml_ros_base import RosDeclaration +from moco.roaml_converter.scxml_entries.type_utils import ScxmlStructDeclarationsContainer +from moco.roaml_converter.scxml_entries.utils import is_non_empty_string +from moco.roaml_converter.scxml_entries.xml_utils import ( assert_xml_tag_ok, get_children_as_scxml, get_xml_attribute, diff --git a/src/as2fm/scxml_converter/scxml_entries/scxml_ros_action_client.py b/src/moco/roaml_converter/scxml_entries/scxml_ros_action_client.py similarity index 95% rename from src/as2fm/scxml_converter/scxml_entries/scxml_ros_action_client.py rename to src/moco/roaml_converter/scxml_entries/scxml_ros_action_client.py index f5872035..787b5869 100644 --- a/src/as2fm/scxml_converter/scxml_entries/scxml_ros_action_client.py +++ b/src/moco/roaml_converter/scxml_entries/scxml_ros_action_client.py @@ -25,9 +25,9 @@ from lxml import etree as ET from lxml.etree import _Element as XmlElement -from as2fm.scxml_converter.data_types.struct_definition import StructDefinition -from as2fm.scxml_converter.scxml_entries import ScxmlRosDeclarationsContainer, ScxmlTransition -from as2fm.scxml_converter.scxml_entries.ros_utils import ( +from moco.roaml_converter.data_types.struct_definition import StructDefinition +from moco.roaml_converter.scxml_entries import ScxmlRosDeclarationsContainer, ScxmlTransition +from moco.roaml_converter.scxml_entries.ros_utils import ( generate_action_feedback_handle_event, generate_action_goal_handle_accepted_event, generate_action_goal_handle_rejected_event, @@ -35,14 +35,14 @@ generate_action_result_handle_event, is_action_type_known, ) -from as2fm.scxml_converter.scxml_entries.scxml_ros_base import ( +from moco.roaml_converter.scxml_entries.scxml_ros_base import ( RosCallback, RosDeclaration, RosTrigger, ) -from as2fm.scxml_converter.scxml_entries.type_utils import ScxmlStructDeclarationsContainer -from as2fm.scxml_converter.scxml_entries.utils import CallbackType, is_non_empty_string -from as2fm.scxml_converter.scxml_entries.xml_utils import assert_xml_tag_ok, get_xml_attribute +from moco.roaml_converter.scxml_entries.type_utils import ScxmlStructDeclarationsContainer +from moco.roaml_converter.scxml_entries.utils import CallbackType, is_non_empty_string +from moco.roaml_converter.scxml_entries.xml_utils import assert_xml_tag_ok, get_xml_attribute class RosActionClient(RosDeclaration): diff --git a/src/as2fm/scxml_converter/scxml_entries/scxml_ros_action_server.py b/src/moco/roaml_converter/scxml_entries/scxml_ros_action_server.py similarity index 97% rename from src/as2fm/scxml_converter/scxml_entries/scxml_ros_action_server.py rename to src/moco/roaml_converter/scxml_entries/scxml_ros_action_server.py index 56161039..78973fe2 100644 --- a/src/as2fm/scxml_converter/scxml_entries/scxml_ros_action_server.py +++ b/src/moco/roaml_converter/scxml_entries/scxml_ros_action_server.py @@ -24,8 +24,8 @@ from action_msgs.msg import GoalStatus from lxml.etree import _Element as XmlElement -from as2fm.scxml_converter.scxml_entries import ScxmlParam, ScxmlRosDeclarationsContainer, ScxmlSend -from as2fm.scxml_converter.scxml_entries.ros_utils import ( +from moco.roaml_converter.scxml_entries import ScxmlParam, ScxmlRosDeclarationsContainer, ScxmlSend +from moco.roaml_converter.scxml_entries.ros_utils import ( generate_action_feedback_event, generate_action_goal_accepted_event, generate_action_goal_handle_event, @@ -35,13 +35,13 @@ generate_action_thread_free_event, is_action_type_known, ) -from as2fm.scxml_converter.scxml_entries.scxml_ros_base import ( +from moco.roaml_converter.scxml_entries.scxml_ros_base import ( RosCallback, RosDeclaration, RosTrigger, ) -from as2fm.scxml_converter.scxml_entries.type_utils import ScxmlStructDeclarationsContainer -from as2fm.scxml_converter.scxml_entries.utils import CallbackType +from moco.roaml_converter.scxml_entries.type_utils import ScxmlStructDeclarationsContainer +from moco.roaml_converter.scxml_entries.utils import CallbackType class RosActionServer(RosDeclaration): diff --git a/src/as2fm/scxml_converter/scxml_entries/scxml_ros_action_server_thread.py b/src/moco/roaml_converter/scxml_entries/scxml_ros_action_server_thread.py similarity index 95% rename from src/as2fm/scxml_converter/scxml_entries/scxml_ros_action_server_thread.py rename to src/moco/roaml_converter/scxml_entries/scxml_ros_action_server_thread.py index afa9bafe..bdf4c93d 100644 --- a/src/as2fm/scxml_converter/scxml_entries/scxml_ros_action_server_thread.py +++ b/src/moco/roaml_converter/scxml_entries/scxml_ros_action_server_thread.py @@ -23,8 +23,8 @@ from lxml.etree import _Element as XmlElement -from as2fm.scxml_converter.data_types.struct_definition import StructDefinition -from as2fm.scxml_converter.scxml_entries import ( +from moco.roaml_converter.data_types.struct_definition import StructDefinition +from moco.roaml_converter.scxml_entries import ( RosField, ScxmlBase, ScxmlDataModel, @@ -34,21 +34,21 @@ ScxmlTransition, ScxmlTransitionTarget, ) -from as2fm.scxml_converter.scxml_entries.bt_utils import BtPortsHandler -from as2fm.scxml_converter.scxml_entries.ros_utils import ( +from moco.roaml_converter.scxml_entries.bt_utils import BtPortsHandler +from moco.roaml_converter.scxml_entries.ros_utils import ( generate_action_thread_execution_start_event, generate_action_thread_free_event, sanitize_ros_interface_name, ) -from as2fm.scxml_converter.scxml_entries.scxml_ros_action_server import RosActionServer -from as2fm.scxml_converter.scxml_entries.scxml_ros_base import RosCallback, RosTrigger -from as2fm.scxml_converter.scxml_entries.type_utils import ScxmlStructDeclarationsContainer -from as2fm.scxml_converter.scxml_entries.utils import ( +from moco.roaml_converter.scxml_entries.scxml_ros_action_server import RosActionServer +from moco.roaml_converter.scxml_entries.scxml_ros_base import RosCallback, RosTrigger +from moco.roaml_converter.scxml_entries.type_utils import ScxmlStructDeclarationsContainer +from moco.roaml_converter.scxml_entries.utils import ( PLAIN_SCXML_EVENT_DATA_PREFIX, CallbackType, is_non_empty_string, ) -from as2fm.scxml_converter.scxml_entries.xml_utils import ( +from moco.roaml_converter.scxml_entries.xml_utils import ( assert_xml_tag_ok, get_children_as_scxml, get_xml_attribute, @@ -180,7 +180,7 @@ def as_plain_scxml( This returns a list of ScxmlRoot objects, using ScxmlBase to avoid circular dependencies. """ - from as2fm.scxml_converter.scxml_entries import ScxmlRoot + from moco.roaml_converter.scxml_entries import ScxmlRoot # This is an independent automaton, no structs shall be provided from outside. assert struct_declarations is None, "Unexpected struct_declarations. Should be None." diff --git a/src/as2fm/scxml_converter/scxml_entries/scxml_ros_base.py b/src/moco/roaml_converter/scxml_entries/scxml_ros_base.py similarity index 97% rename from src/as2fm/scxml_converter/scxml_entries/scxml_ros_base.py rename to src/moco/roaml_converter/scxml_entries/scxml_ros_base.py index bc923c8e..93beb4e7 100644 --- a/src/as2fm/scxml_converter/scxml_entries/scxml_ros_base.py +++ b/src/moco/roaml_converter/scxml_entries/scxml_ros_base.py @@ -20,9 +20,9 @@ from lxml import etree as ET from lxml.etree import _Element as XmlElement -from as2fm.as2fm_common.common import is_comment -from as2fm.scxml_converter.data_types.struct_definition import StructDefinition -from as2fm.scxml_converter.scxml_entries import ( +from moco.moco_common.common import is_comment +from moco.roaml_converter.data_types.struct_definition import StructDefinition +from moco.roaml_converter.scxml_entries import ( BtGetValueInputPort, RosField, ScxmlBase, @@ -33,17 +33,17 @@ ScxmlTransition, ScxmlTransitionTarget, ) -from as2fm.scxml_converter.scxml_entries.bt_utils import BtPortsHandler, is_blackboard_reference -from as2fm.scxml_converter.scxml_entries.scxml_executable_entries import ( +from moco.roaml_converter.scxml_entries.bt_utils import BtPortsHandler, is_blackboard_reference +from moco.roaml_converter.scxml_entries.scxml_executable_entries import ( set_execution_body_callback_type, ) -from as2fm.scxml_converter.scxml_entries.type_utils import ScxmlStructDeclarationsContainer -from as2fm.scxml_converter.scxml_entries.utils import ( +from moco.roaml_converter.scxml_entries.type_utils import ScxmlStructDeclarationsContainer +from moco.roaml_converter.scxml_entries.utils import ( CallbackType, get_plain_expression, is_non_empty_string, ) -from as2fm.scxml_converter.scxml_entries.xml_utils import ( +from moco.roaml_converter.scxml_entries.xml_utils import ( assert_xml_tag_ok, get_xml_attribute, read_value_from_xml_arg_or_child, diff --git a/src/as2fm/scxml_converter/scxml_entries/scxml_ros_field.py b/src/moco/roaml_converter/scxml_entries/scxml_ros_field.py similarity index 89% rename from src/as2fm/scxml_converter/scxml_entries/scxml_ros_field.py rename to src/moco/roaml_converter/scxml_entries/scxml_ros_field.py index 02ea3634..abaa985a 100644 --- a/src/as2fm/scxml_converter/scxml_entries/scxml_ros_field.py +++ b/src/moco/roaml_converter/scxml_entries/scxml_ros_field.py @@ -20,16 +20,16 @@ from lxml import etree as ET from lxml.etree import _Element as XmlElement -from as2fm.scxml_converter.data_types.struct_definition import StructDefinition -from as2fm.scxml_converter.scxml_entries import BtGetValueInputPort, ScxmlParam -from as2fm.scxml_converter.scxml_entries.type_utils import ScxmlStructDeclarationsContainer -from as2fm.scxml_converter.scxml_entries.utils import ( +from moco.roaml_converter.data_types.struct_definition import StructDefinition +from moco.roaml_converter.scxml_entries import BtGetValueInputPort, ScxmlParam +from moco.roaml_converter.scxml_entries.type_utils import ScxmlStructDeclarationsContainer +from moco.roaml_converter.scxml_entries.utils import ( ROS_FIELD_PREFIX, CallbackType, get_plain_expression, is_non_empty_string, ) -from as2fm.scxml_converter.scxml_entries.xml_utils import ( +from moco.roaml_converter.scxml_entries.xml_utils import ( assert_xml_tag_ok, get_xml_attribute, read_value_from_xml_arg_or_child, diff --git a/src/as2fm/scxml_converter/scxml_entries/scxml_ros_service.py b/src/moco/roaml_converter/scxml_entries/scxml_ros_service.py similarity index 95% rename from src/as2fm/scxml_converter/scxml_entries/scxml_ros_service.py rename to src/moco/roaml_converter/scxml_entries/scxml_ros_service.py index e49c4dce..4c879f59 100644 --- a/src/as2fm/scxml_converter/scxml_entries/scxml_ros_service.py +++ b/src/moco/roaml_converter/scxml_entries/scxml_ros_service.py @@ -22,20 +22,20 @@ from typing import Type -from as2fm.scxml_converter.scxml_entries import ScxmlRosDeclarationsContainer -from as2fm.scxml_converter.scxml_entries.ros_utils import ( +from moco.roaml_converter.scxml_entries import ScxmlRosDeclarationsContainer +from moco.roaml_converter.scxml_entries.ros_utils import ( generate_srv_request_event, generate_srv_response_event, generate_srv_server_request_event, generate_srv_server_response_event, is_srv_type_known, ) -from as2fm.scxml_converter.scxml_entries.scxml_ros_base import ( +from moco.roaml_converter.scxml_entries.scxml_ros_base import ( RosCallback, RosDeclaration, RosTrigger, ) -from as2fm.scxml_converter.scxml_entries.utils import CallbackType +from moco.roaml_converter.scxml_entries.utils import CallbackType class RosServiceServer(RosDeclaration): diff --git a/src/as2fm/scxml_converter/scxml_entries/scxml_ros_timer.py b/src/moco/roaml_converter/scxml_entries/scxml_ros_timer.py similarity index 86% rename from src/as2fm/scxml_converter/scxml_entries/scxml_ros_timer.py rename to src/moco/roaml_converter/scxml_entries/scxml_ros_timer.py index 07259b2d..6c1bdc7f 100644 --- a/src/as2fm/scxml_converter/scxml_entries/scxml_ros_timer.py +++ b/src/moco/roaml_converter/scxml_entries/scxml_ros_timer.py @@ -20,13 +20,13 @@ from lxml import etree as ET from lxml.etree import _Element as XmlElement -from as2fm.scxml_converter.data_types.struct_definition import StructDefinition -from as2fm.scxml_converter.scxml_entries import ScxmlRosDeclarationsContainer -from as2fm.scxml_converter.scxml_entries.bt_utils import BtPortsHandler -from as2fm.scxml_converter.scxml_entries.ros_utils import generate_rate_timer_event -from as2fm.scxml_converter.scxml_entries.scxml_ros_base import RosCallback, RosDeclaration -from as2fm.scxml_converter.scxml_entries.utils import CallbackType, is_non_empty_string -from as2fm.scxml_converter.scxml_entries.xml_utils import assert_xml_tag_ok, get_xml_attribute +from moco.roaml_converter.data_types.struct_definition import StructDefinition +from moco.roaml_converter.scxml_entries import ScxmlRosDeclarationsContainer +from moco.roaml_converter.scxml_entries.bt_utils import BtPortsHandler +from moco.roaml_converter.scxml_entries.ros_utils import generate_rate_timer_event +from moco.roaml_converter.scxml_entries.scxml_ros_base import RosCallback, RosDeclaration +from moco.roaml_converter.scxml_entries.utils import CallbackType, is_non_empty_string +from moco.roaml_converter.scxml_entries.xml_utils import assert_xml_tag_ok, get_xml_attribute class RosTimeRate(RosDeclaration): diff --git a/src/as2fm/scxml_converter/scxml_entries/scxml_ros_topic.py b/src/moco/roaml_converter/scxml_entries/scxml_ros_topic.py similarity index 91% rename from src/as2fm/scxml_converter/scxml_entries/scxml_ros_topic.py rename to src/moco/roaml_converter/scxml_entries/scxml_ros_topic.py index 0e5e9927..2ea57fa6 100644 --- a/src/as2fm/scxml_converter/scxml_entries/scxml_ros_topic.py +++ b/src/moco/roaml_converter/scxml_entries/scxml_ros_topic.py @@ -22,15 +22,15 @@ from typing import Type -from as2fm.as2fm_common.logging import log_error -from as2fm.scxml_converter.scxml_entries import ScxmlRosDeclarationsContainer -from as2fm.scxml_converter.scxml_entries.ros_utils import generate_topic_event, is_msg_type_known -from as2fm.scxml_converter.scxml_entries.scxml_ros_base import ( +from moco.moco_common.logging import log_error +from moco.roaml_converter.scxml_entries import ScxmlRosDeclarationsContainer +from moco.roaml_converter.scxml_entries.ros_utils import generate_topic_event, is_msg_type_known +from moco.roaml_converter.scxml_entries.scxml_ros_base import ( RosCallback, RosDeclaration, RosTrigger, ) -from as2fm.scxml_converter.scxml_entries.utils import CallbackType +from moco.roaml_converter.scxml_entries.utils import CallbackType class RosTopicPublisher(RosDeclaration): diff --git a/src/as2fm/scxml_converter/scxml_entries/scxml_state.py b/src/moco/roaml_converter/scxml_entries/scxml_state.py similarity index 96% rename from src/as2fm/scxml_converter/scxml_entries/scxml_state.py rename to src/moco/roaml_converter/scxml_entries/scxml_state.py index ffe10367..fd53a909 100644 --- a/src/as2fm/scxml_converter/scxml_entries/scxml_state.py +++ b/src/moco/roaml_converter/scxml_entries/scxml_state.py @@ -22,10 +22,10 @@ from lxml import etree as ET from lxml.etree import _Element as XmlElement -from as2fm.as2fm_common.common import is_comment -from as2fm.as2fm_common.logging import check_assertion, get_error_msg -from as2fm.scxml_converter.data_types.struct_definition import StructDefinition -from as2fm.scxml_converter.scxml_entries import ( +from moco.moco_common.common import is_comment +from moco.moco_common.logging import check_assertion, get_error_msg +from moco.roaml_converter.data_types.struct_definition import StructDefinition +from moco.roaml_converter.scxml_entries import ( EventsToAutomata, ScxmlBase, ScxmlExecutableEntry, @@ -35,12 +35,12 @@ ScxmlTransition, ScxmlTransitionTarget, ) -from as2fm.scxml_converter.scxml_entries.bt_utils import ( +from moco.roaml_converter.scxml_entries.bt_utils import ( BT_BLACKBOARD_GET, BT_BLACKBOARD_REQUEST, BtPortsHandler, ) -from as2fm.scxml_converter.scxml_entries.scxml_executable_entries import ( +from moco.roaml_converter.scxml_entries.scxml_executable_entries import ( add_targets_to_scxml_sends, as_plain_execution_body, execution_body_from_xml, @@ -51,8 +51,8 @@ set_execution_body_callback_type, valid_execution_body, ) -from as2fm.scxml_converter.scxml_entries.type_utils import ScxmlStructDeclarationsContainer -from as2fm.scxml_converter.scxml_entries.utils import CallbackType, generate_tag_to_class_map +from moco.roaml_converter.scxml_entries.type_utils import ScxmlStructDeclarationsContainer +from moco.roaml_converter.scxml_entries.utils import CallbackType, generate_tag_to_class_map class ScxmlState(ScxmlBase): diff --git a/src/as2fm/scxml_converter/scxml_entries/scxml_transition.py b/src/moco/roaml_converter/scxml_entries/scxml_transition.py similarity index 96% rename from src/as2fm/scxml_converter/scxml_entries/scxml_transition.py rename to src/moco/roaml_converter/scxml_entries/scxml_transition.py index aad5eba5..91fbf3fc 100644 --- a/src/as2fm/scxml_converter/scxml_entries/scxml_transition.py +++ b/src/moco/roaml_converter/scxml_entries/scxml_transition.py @@ -22,29 +22,29 @@ from lxml import etree as ET from lxml.etree import _Element as XmlElement -from as2fm.as2fm_common.common import EPSILON, is_comment -from as2fm.scxml_converter.data_types.struct_definition import StructDefinition -from as2fm.scxml_converter.scxml_entries import ( +from moco.moco_common.common import EPSILON, is_comment +from moco.roaml_converter.data_types.struct_definition import StructDefinition +from moco.roaml_converter.scxml_entries import ( ScxmlBase, ScxmlExecutionBody, ScxmlRosDeclarationsContainer, ScxmlTransitionTarget, ) -from as2fm.scxml_converter.scxml_entries.bt_utils import BtPortsHandler, is_removed_bt_event -from as2fm.scxml_converter.scxml_entries.scxml_executable_entries import ( +from moco.roaml_converter.scxml_entries.bt_utils import BtPortsHandler, is_removed_bt_event +from moco.roaml_converter.scxml_entries.scxml_executable_entries import ( EventsToAutomata, ScxmlExecutableEntry, add_targets_to_scxml_sends, execution_body_from_xml, ) -from as2fm.scxml_converter.scxml_entries.type_utils import ScxmlStructDeclarationsContainer -from as2fm.scxml_converter.scxml_entries.utils import ( +from moco.roaml_converter.scxml_entries.type_utils import ScxmlStructDeclarationsContainer +from moco.roaml_converter.scxml_entries.utils import ( CallbackType, convert_expression_with_string_literals, get_plain_expression, is_non_empty_string, ) -from as2fm.scxml_converter.scxml_entries.xml_utils import get_xml_attribute +from moco.roaml_converter.scxml_entries.xml_utils import get_xml_attribute class ScxmlTransition(ScxmlBase): diff --git a/src/as2fm/scxml_converter/scxml_entries/scxml_transition_target.py b/src/moco/roaml_converter/scxml_entries/scxml_transition_target.py similarity index 94% rename from src/as2fm/scxml_converter/scxml_entries/scxml_transition_target.py rename to src/moco/roaml_converter/scxml_entries/scxml_transition_target.py index d2af4caa..0d199981 100644 --- a/src/as2fm/scxml_converter/scxml_entries/scxml_transition_target.py +++ b/src/moco/roaml_converter/scxml_entries/scxml_transition_target.py @@ -23,15 +23,15 @@ from lxml import etree as ET from lxml.etree import _Element as XmlElement -from as2fm.scxml_converter.data_types.struct_definition import StructDefinition -from as2fm.scxml_converter.scxml_entries import ( +from moco.roaml_converter.data_types.struct_definition import StructDefinition +from moco.roaml_converter.scxml_entries import ( ScxmlBase, ScxmlExecutableEntry, ScxmlExecutionBody, ScxmlRosDeclarationsContainer, ) -from as2fm.scxml_converter.scxml_entries.bt_utils import BtPortsHandler -from as2fm.scxml_converter.scxml_entries.scxml_executable_entries import ( +from moco.roaml_converter.scxml_entries.bt_utils import BtPortsHandler +from moco.roaml_converter.scxml_entries.scxml_executable_entries import ( execution_body_from_xml, has_bt_blackboard_input, instantiate_exec_body_bt_events, @@ -41,9 +41,9 @@ valid_execution_body, valid_execution_body_entry_types, ) -from as2fm.scxml_converter.scxml_entries.type_utils import ScxmlStructDeclarationsContainer -from as2fm.scxml_converter.scxml_entries.utils import CallbackType, is_non_empty_string -from as2fm.scxml_converter.scxml_entries.xml_utils import get_xml_attribute +from moco.roaml_converter.scxml_entries.type_utils import ScxmlStructDeclarationsContainer +from moco.roaml_converter.scxml_entries.utils import CallbackType, is_non_empty_string +from moco.roaml_converter.scxml_entries.xml_utils import get_xml_attribute class ScxmlTransitionTarget(ScxmlBase): diff --git a/src/as2fm/scxml_converter/scxml_entries/type_utils.py b/src/moco/roaml_converter/scxml_entries/type_utils.py similarity index 96% rename from src/as2fm/scxml_converter/scxml_entries/type_utils.py rename to src/moco/roaml_converter/scxml_entries/type_utils.py index b4d12167..85681e10 100644 --- a/src/as2fm/scxml_converter/scxml_entries/type_utils.py +++ b/src/moco/roaml_converter/scxml_entries/type_utils.py @@ -17,10 +17,10 @@ from typing import Dict, List, Optional, Tuple, Type, Union -from as2fm.as2fm_common.ecmascript_interpretation import ArrayAccess, split_by_access -from as2fm.as2fm_common.logging import get_error_msg -from as2fm.scxml_converter.data_types.struct_definition import StructDefinition -from as2fm.scxml_converter.data_types.type_utils import ( +from moco.moco_common.ecmascript_interpretation import ArrayAccess, split_by_access +from moco.moco_common.logging import get_error_msg +from moco.roaml_converter.data_types.struct_definition import StructDefinition +from moco.roaml_converter.data_types.type_utils import ( ARRAY_LENGTH_SUFFIX, ARRAY_LENGTH_TYPE, ArrayInfo, diff --git a/src/as2fm/scxml_converter/scxml_entries/utils.py b/src/moco/roaml_converter/scxml_entries/utils.py similarity index 98% rename from src/as2fm/scxml_converter/scxml_entries/utils.py rename to src/moco/roaml_converter/scxml_entries/utils.py index cc3614d8..27e5b0b8 100644 --- a/src/as2fm/scxml_converter/scxml_entries/utils.py +++ b/src/moco/roaml_converter/scxml_entries/utils.py @@ -24,20 +24,20 @@ from esprima.syntax import Syntax from lxml.etree import _Element as XmlElement -from as2fm.as2fm_common.ecmascript_interpretation import ( +from moco.moco_common.ecmascript_interpretation import ( MemberAccessCheckException, ast_expression_to_string, has_array_access, parse_expression_to_ast, split_by_access, ) -from as2fm.as2fm_common.logging import check_assertion, get_error_msg, log_error -from as2fm.scxml_converter.data_types.type_utils import ( +from moco.moco_common.logging import check_assertion, get_error_msg, log_error +from moco.roaml_converter.data_types.type_utils import ( ARRAY_LENGTH_SUFFIX, MEMBER_ACCESS_SUBSTITUTION, ) -from as2fm.scxml_converter.scxml_entries.scxml_base import ScxmlBase -from as2fm.scxml_converter.scxml_entries.type_utils import ScxmlStructDeclarationsContainer +from moco.roaml_converter.scxml_entries.scxml_base import ScxmlBase +from moco.roaml_converter.scxml_entries.type_utils import ScxmlStructDeclarationsContainer PLAIN_EVENT_KEY: str = "_event" PLAIN_SCXML_EVENT_PREFIX: str = f"{PLAIN_EVENT_KEY}." diff --git a/src/as2fm/scxml_converter/scxml_entries/xml_utils.py b/src/moco/roaml_converter/scxml_entries/xml_utils.py similarity index 96% rename from src/as2fm/scxml_converter/scxml_entries/xml_utils.py rename to src/moco/roaml_converter/scxml_entries/xml_utils.py index ab9812c0..70eb12a3 100644 --- a/src/as2fm/scxml_converter/scxml_entries/xml_utils.py +++ b/src/moco/roaml_converter/scxml_entries/xml_utils.py @@ -17,10 +17,10 @@ from lxml.etree import _Element as XmlElement -from as2fm.as2fm_common.common import is_comment -from as2fm.as2fm_common.logging import get_error_msg, log_error -from as2fm.scxml_converter.data_types.struct_definition import StructDefinition -from as2fm.scxml_converter.scxml_entries import ScxmlBase +from moco.moco_common.common import is_comment +from moco.moco_common.logging import get_error_msg, log_error +from moco.roaml_converter.data_types.struct_definition import StructDefinition +from moco.roaml_converter.scxml_entries import ScxmlBase class XmlUtilsError(Exception): diff --git a/src/moco/roaml_generator/__init__.py b/src/moco/roaml_generator/__init__.py new file mode 100644 index 00000000..5ebbec6a --- /dev/null +++ b/src/moco/roaml_generator/__init__.py @@ -0,0 +1 @@ +"""Module roaml_generator.""" diff --git a/src/as2fm/jani_generator/convince_jani_helpers/__init__.py b/src/moco/roaml_generator/convince_jani_helpers/__init__.py similarity index 100% rename from src/as2fm/jani_generator/convince_jani_helpers/__init__.py rename to src/moco/roaml_generator/convince_jani_helpers/__init__.py diff --git a/src/as2fm/jani_generator/convince_jani_helpers/convince_to_plain_jani.py b/src/moco/roaml_generator/convince_jani_helpers/convince_to_plain_jani.py similarity index 99% rename from src/as2fm/jani_generator/convince_jani_helpers/convince_to_plain_jani.py rename to src/moco/roaml_generator/convince_jani_helpers/convince_to_plain_jani.py index 4bc4bced..aa7b2ac7 100644 --- a/src/as2fm/jani_generator/convince_jani_helpers/convince_to_plain_jani.py +++ b/src/moco/roaml_generator/convince_jani_helpers/convince_to_plain_jani.py @@ -22,7 +22,7 @@ from os import path from typing import List -from as2fm.jani_generator.jani_entries import ( +from moco.roaml_generator.jani_entries import ( JaniAutomaton, JaniComposition, JaniModel, diff --git a/src/as2fm/jani_generator/jani_entries/__init__.py b/src/moco/roaml_generator/jani_entries/__init__.py similarity index 100% rename from src/as2fm/jani_generator/jani_entries/__init__.py rename to src/moco/roaml_generator/jani_entries/__init__.py diff --git a/src/as2fm/jani_generator/jani_entries/jani_assignment.py b/src/moco/roaml_generator/jani_entries/jani_assignment.py similarity index 94% rename from src/as2fm/jani_generator/jani_entries/jani_assignment.py rename to src/moco/roaml_generator/jani_entries/jani_assignment.py index f96530d0..4d2ed8aa 100644 --- a/src/as2fm/jani_generator/jani_entries/jani_assignment.py +++ b/src/moco/roaml_generator/jani_entries/jani_assignment.py @@ -19,8 +19,8 @@ from typing import Dict -from as2fm.jani_generator.jani_entries import JaniConstant, JaniExpression, generate_jani_expression -from as2fm.jani_generator.jani_entries.jani_convince_expression_expansion import expand_expression +from moco.roaml_generator.jani_entries import JaniConstant, JaniExpression, generate_jani_expression +from moco.roaml_generator.jani_entries.jani_convince_expression_expansion import expand_expression class JaniAssignment: diff --git a/src/as2fm/jani_generator/jani_entries/jani_automaton.py b/src/moco/roaml_generator/jani_entries/jani_automaton.py similarity index 98% rename from src/as2fm/jani_generator/jani_entries/jani_automaton.py rename to src/moco/roaml_generator/jani_entries/jani_automaton.py index 2889691a..17558ae9 100644 --- a/src/as2fm/jani_generator/jani_entries/jani_automaton.py +++ b/src/moco/roaml_generator/jani_entries/jani_automaton.py @@ -17,7 +17,7 @@ from typing import Any, Dict, List, Optional, Set -from as2fm.jani_generator.jani_entries import JaniConstant, JaniEdge, JaniVariable +from moco.roaml_generator.jani_entries import JaniConstant, JaniEdge, JaniVariable class JaniAutomaton: diff --git a/src/as2fm/jani_generator/jani_entries/jani_composition.py b/src/moco/roaml_generator/jani_entries/jani_composition.py similarity index 100% rename from src/as2fm/jani_generator/jani_entries/jani_composition.py rename to src/moco/roaml_generator/jani_entries/jani_composition.py diff --git a/src/as2fm/jani_generator/jani_entries/jani_constant.py b/src/moco/roaml_generator/jani_entries/jani_constant.py similarity index 98% rename from src/as2fm/jani_generator/jani_entries/jani_constant.py rename to src/moco/roaml_generator/jani_entries/jani_constant.py index ab20caa0..1886579e 100644 --- a/src/as2fm/jani_generator/jani_entries/jani_constant.py +++ b/src/moco/roaml_generator/jani_entries/jani_constant.py @@ -17,7 +17,7 @@ from typing import Optional, Type, Union, get_args -from as2fm.jani_generator.jani_entries import JaniExpression +from moco.roaml_generator.jani_entries import JaniExpression ValidTypes = Union[bool, int, float] diff --git a/src/as2fm/jani_generator/jani_entries/jani_convince_expression_expansion.py b/src/moco/roaml_generator/jani_entries/jani_convince_expression_expansion.py similarity index 99% rename from src/as2fm/jani_generator/jani_entries/jani_convince_expression_expansion.py rename to src/moco/roaml_generator/jani_entries/jani_convince_expression_expansion.py index 021a9e7c..0cbc133d 100644 --- a/src/as2fm/jani_generator/jani_entries/jani_convince_expression_expansion.py +++ b/src/moco/roaml_generator/jani_entries/jani_convince_expression_expansion.py @@ -19,13 +19,13 @@ from math import pi from typing import Callable, Dict, List, Union -from as2fm.jani_generator.jani_entries import ( +from moco.roaml_generator.jani_entries import ( JaniConstant, JaniDistribution, JaniExpression, JaniExpressionType, ) -from as2fm.jani_generator.jani_entries.jani_expression_generator import ( +from moco.roaml_generator.jani_entries.jani_expression_generator import ( abs_operator, and_operator, ceil_operator, diff --git a/src/as2fm/jani_generator/jani_entries/jani_edge.py b/src/moco/roaml_generator/jani_entries/jani_edge.py similarity index 97% rename from src/as2fm/jani_generator/jani_entries/jani_edge.py rename to src/moco/roaml_generator/jani_entries/jani_edge.py index d7220d34..b9cd89d7 100644 --- a/src/as2fm/jani_generator/jani_entries/jani_edge.py +++ b/src/moco/roaml_generator/jani_entries/jani_edge.py @@ -17,13 +17,13 @@ from typing import Any, Dict, List, Optional -from as2fm.jani_generator.jani_entries import ( +from moco.roaml_generator.jani_entries import ( JaniAssignment, JaniConstant, JaniExpression, JaniGuard, ) -from as2fm.jani_generator.jani_entries.jani_convince_expression_expansion import expand_expression +from moco.roaml_generator.jani_entries.jani_convince_expression_expansion import expand_expression class JaniEdge: diff --git a/src/as2fm/jani_generator/jani_entries/jani_expression.py b/src/moco/roaml_generator/jani_entries/jani_expression.py similarity index 98% rename from src/as2fm/jani_generator/jani_entries/jani_expression.py rename to src/moco/roaml_generator/jani_entries/jani_expression.py index 344e2e1e..8cbd231b 100644 --- a/src/as2fm/jani_generator/jani_entries/jani_expression.py +++ b/src/moco/roaml_generator/jani_entries/jani_expression.py @@ -20,9 +20,9 @@ from enum import Enum from typing import Any, Dict, List, Optional, Tuple, Union, get_args -from as2fm.as2fm_common.common import is_valid_variable_name -from as2fm.jani_generator.jani_entries import JaniValue -from as2fm.scxml_converter.scxml_entries.utils import ( +from moco.moco_common.common import is_valid_variable_name +from moco.roaml_generator.jani_entries import JaniValue +from moco.roaml_converter.scxml_entries.utils import ( MEMBER_ACCESS_SUBSTITUTION, PLAIN_SCXML_EVENT_DATA_PREFIX, ) diff --git a/src/as2fm/jani_generator/jani_entries/jani_expression_generator.py b/src/moco/roaml_generator/jani_entries/jani_expression_generator.py similarity index 98% rename from src/as2fm/jani_generator/jani_entries/jani_expression_generator.py rename to src/moco/roaml_generator/jani_entries/jani_expression_generator.py index ca77adce..dbeb3a17 100644 --- a/src/as2fm/jani_generator/jani_entries/jani_expression_generator.py +++ b/src/moco/roaml_generator/jani_entries/jani_expression_generator.py @@ -19,8 +19,8 @@ from typing import List, MutableSequence, Union -from as2fm.as2fm_common.array_type import ArrayInfo -from as2fm.jani_generator.jani_entries import JaniDistribution, JaniExpression +from moco.moco_common.array_type import ArrayInfo +from moco.roaml_generator.jani_entries import JaniDistribution, JaniExpression # Math operators diff --git a/src/as2fm/jani_generator/jani_entries/jani_guard.py b/src/moco/roaml_generator/jani_entries/jani_guard.py similarity index 97% rename from src/as2fm/jani_generator/jani_entries/jani_guard.py rename to src/moco/roaml_generator/jani_entries/jani_guard.py index c7a4a820..c20b50e4 100644 --- a/src/as2fm/jani_generator/jani_entries/jani_guard.py +++ b/src/moco/roaml_generator/jani_entries/jani_guard.py @@ -20,7 +20,7 @@ from typing import Optional, Union -from as2fm.jani_generator.jani_entries.jani_expression import JaniExpression +from moco.roaml_generator.jani_entries.jani_expression import JaniExpression class JaniGuard: diff --git a/src/as2fm/jani_generator/jani_entries/jani_helpers.py b/src/moco/roaml_generator/jani_entries/jani_helpers.py similarity index 97% rename from src/as2fm/jani_generator/jani_entries/jani_helpers.py rename to src/moco/roaml_generator/jani_entries/jani_helpers.py index 12f8ce1e..c88477c6 100644 --- a/src/as2fm/jani_generator/jani_entries/jani_helpers.py +++ b/src/moco/roaml_generator/jani_entries/jani_helpers.py @@ -15,8 +15,8 @@ from typing import List, Union -from as2fm.jani_generator.jani_entries import JaniAssignment, JaniEdge, JaniExpression, JaniModel -from as2fm.jani_generator.jani_entries.jani_convince_expression_expansion import ( +from moco.roaml_generator.jani_entries import JaniAssignment, JaniEdge, JaniExpression, JaniModel +from moco.roaml_generator.jani_entries.jani_convince_expression_expansion import ( expand_distribution_expressions, ) diff --git a/src/as2fm/jani_generator/jani_entries/jani_model.py b/src/moco/roaml_generator/jani_entries/jani_model.py similarity index 98% rename from src/as2fm/jani_generator/jani_entries/jani_model.py rename to src/moco/roaml_generator/jani_entries/jani_model.py index 9d6acc08..32e5d6e1 100644 --- a/src/as2fm/jani_generator/jani_entries/jani_model.py +++ b/src/moco/roaml_generator/jani_entries/jani_model.py @@ -20,8 +20,8 @@ from typing import Dict, List, Optional, Type, Union -from as2fm.as2fm_common.array_type import ArrayInfo -from as2fm.jani_generator.jani_entries import ( +from moco.moco_common.array_type import ArrayInfo +from moco.roaml_generator.jani_entries import ( JaniAutomaton, JaniComposition, JaniConstant, diff --git a/src/as2fm/jani_generator/jani_entries/jani_property.py b/src/moco/roaml_generator/jani_entries/jani_property.py similarity index 98% rename from src/as2fm/jani_generator/jani_entries/jani_property.py rename to src/moco/roaml_generator/jani_entries/jani_property.py index ac91566b..dd77dbc8 100644 --- a/src/as2fm/jani_generator/jani_entries/jani_property.py +++ b/src/moco/roaml_generator/jani_entries/jani_property.py @@ -20,8 +20,8 @@ from typing import Any, Dict, Optional -from as2fm.jani_generator.jani_entries import JaniConstant, JaniExpression -from as2fm.jani_generator.jani_entries.jani_convince_expression_expansion import expand_expression +from moco.roaml_generator.jani_entries import JaniConstant, JaniExpression +from moco.roaml_generator.jani_entries.jani_convince_expression_expansion import expand_expression class FilterProperty: diff --git a/src/as2fm/jani_generator/jani_entries/jani_utils.py b/src/moco/roaml_generator/jani_entries/jani_utils.py similarity index 93% rename from src/as2fm/jani_generator/jani_entries/jani_utils.py rename to src/moco/roaml_generator/jani_entries/jani_utils.py index c8c16ad9..03ce21de 100644 --- a/src/as2fm/jani_generator/jani_entries/jani_utils.py +++ b/src/moco/roaml_generator/jani_entries/jani_utils.py @@ -17,10 +17,10 @@ from typing import List, MutableSequence, Optional, Tuple, Type, Union -from as2fm.as2fm_common.array_type import ArrayInfo, get_default_expression_for_type, is_array_type -from as2fm.as2fm_common.common import ValidJaniTypes -from as2fm.jani_generator.jani_entries import JaniExpression, JaniExpressionType, JaniVariable -from as2fm.jani_generator.jani_entries.jani_expression_generator import array_create_operator +from moco.moco_common.array_type import ArrayInfo, get_default_expression_for_type, is_array_type +from moco.moco_common.common import ValidJaniTypes +from moco.roaml_generator.jani_entries import JaniExpression, JaniExpressionType, JaniVariable +from moco.roaml_generator.jani_entries.jani_expression_generator import array_create_operator def is_expression_array(expr: JaniExpression) -> bool: diff --git a/src/as2fm/jani_generator/jani_entries/jani_value.py b/src/moco/roaml_generator/jani_entries/jani_value.py similarity index 100% rename from src/as2fm/jani_generator/jani_entries/jani_value.py rename to src/moco/roaml_generator/jani_entries/jani_value.py diff --git a/src/as2fm/jani_generator/jani_entries/jani_variable.py b/src/moco/roaml_generator/jani_entries/jani_variable.py similarity index 97% rename from src/as2fm/jani_generator/jani_entries/jani_variable.py rename to src/moco/roaml_generator/jani_entries/jani_variable.py index 6d41c3a7..9335694f 100644 --- a/src/as2fm/jani_generator/jani_entries/jani_variable.py +++ b/src/moco/roaml_generator/jani_entries/jani_variable.py @@ -19,10 +19,10 @@ from typing import MutableSequence, Optional, Tuple, Type, Union, get_args -from as2fm.as2fm_common.array_type import ArrayInfo -from as2fm.as2fm_common.common import ValidJaniTypes -from as2fm.jani_generator.jani_entries import JaniExpression, JaniValue -from as2fm.jani_generator.jani_entries.jani_expression import SupportedExp +from moco.moco_common.array_type import ArrayInfo +from moco.moco_common.common import ValidJaniTypes +from moco.roaml_generator.jani_entries import JaniExpression, JaniValue +from moco.roaml_generator.jani_entries.jani_expression import SupportedExp class JaniVariable: diff --git a/src/as2fm/jani_generator/main.py b/src/moco/roaml_generator/main.py similarity index 63% rename from src/as2fm/jani_generator/main.py rename to src/moco/roaml_generator/main.py index 749d289e..cfcb6a16 100644 --- a/src/as2fm/jani_generator/main.py +++ b/src/moco/roaml_generator/main.py @@ -16,65 +16,55 @@ # limitations under the License. import argparse -import json import os -import timeit from typing import Optional, Sequence -from as2fm.jani_generator.convince_jani_helpers import convince_jani_parser -from as2fm.jani_generator.jani_entries import JaniModel -from as2fm.jani_generator.scxml_helpers.top_level_interpreter import interpret_top_level_xml +from moco.roaml_generator.scxml_helpers.top_level_interpreter import interpret_top_level_xml -def main_scxml_to_jani(_args: Optional[Sequence[str]] = None) -> None: +def main_roaml_to_scxml(_args: Optional[Sequence[str]] = None) -> None: """ - Main function for the SCXML to JANI conversion. + Main function for the RoaML to SCXML conversion. Module containing the main entry points, pulling all necessary files together. convince.jani \ BT.xml \ plugin.scxml \ - node1.scxml => main_scxml_to_jani => main.jani + node1.scxml => main_roaml_to_scxml => output folder node2.scxml / env.scxml / :param args: The arguments to parse. If None, sys.argv is used. :return: None """ - parser = argparse.ArgumentParser(description="Convert SCXML robot system models to JANI model.") + parser = argparse.ArgumentParser(description="Convert RoaML robot system models to plain SCXML.") parser.add_argument( "--generated-scxml-dir", type=str, default="./output", help="Path to the folder containing the generated plain-SCXML files.", ) - parser.add_argument( - "--jani-out-file", type=str, default="", help="Path to the generated jani file." - ) + parser.add_argument("main_xml", type=str, help="The path to the main XML file to interpret.") args = parser.parse_args(_args) # Check the main xml file provided by the user main_xml_file = args.main_xml assert os.path.isfile(main_xml_file), f"File {main_xml_file} does not exist." - assert main_xml_file.endswith(".xml"), "File {main_xml_file} is not a '.xml' file." + assert main_xml_file.endswith(".xml"), f"File {main_xml_file} is not a '.xml' file." # Process additional, optional parameters scxml_out_dir = args.generated_scxml_dir scxml_out_dir = None if len(scxml_out_dir) == 0 else scxml_out_dir - jani_out_file = ( - args.jani_out_file - if len(args.jani_out_file) > 0 - else main_xml_file.removesuffix("xml") + "jani" - ) - - print("AS2FM - RoAML to SCXML.\n") + + print("MOCO - RoAML to SCXML.\n") print(f"Loading model from {main_xml_file}.") - interpret_top_level_xml(main_xml_file, jani_file=jani_out_file, scxmls_dir=scxml_out_dir) + interpret_top_level_xml(main_xml_file, scxmls_dir=scxml_out_dir) + print(f"SCXML model saved to {scxml_out_dir}") if __name__ == "__main__": # for testing purposes only import sys - main_scxml_to_jani(sys.argv[1:]) + main_roaml_to_scxml(sys.argv[1:]) diff --git a/src/as2fm/jani_generator/scxml_helpers/__init__.py b/src/moco/roaml_generator/ros_helpers/__init__.py similarity index 100% rename from src/as2fm/jani_generator/scxml_helpers/__init__.py rename to src/moco/roaml_generator/ros_helpers/__init__.py diff --git a/src/as2fm/jani_generator/ros_helpers/ros_action_handler.py b/src/moco/roaml_generator/ros_helpers/ros_action_handler.py similarity index 98% rename from src/as2fm/jani_generator/ros_helpers/ros_action_handler.py rename to src/moco/roaml_generator/ros_helpers/ros_action_handler.py index 53192819..c426ee20 100644 --- a/src/as2fm/jani_generator/ros_helpers/ros_action_handler.py +++ b/src/moco/roaml_generator/ros_helpers/ros_action_handler.py @@ -19,8 +19,8 @@ from typing import Callable, Dict, List, Tuple -from as2fm.jani_generator.ros_helpers.ros_communication_handler import RosCommunicationHandler -from as2fm.scxml_converter.scxml_entries import ( +from moco.roaml_generator.ros_helpers.ros_communication_handler import RosCommunicationHandler +from moco.roaml_converter.scxml_entries import ( ScxmlAssign, ScxmlData, ScxmlDataModel, @@ -31,7 +31,7 @@ ScxmlState, ScxmlTransition, ) -from as2fm.scxml_converter.scxml_entries.ros_utils import ( +from moco.roaml_converter.scxml_entries.ros_utils import ( generate_action_feedback_event, generate_action_feedback_handle_event, generate_action_goal_accepted_event, @@ -46,7 +46,7 @@ get_action_type_params, sanitize_ros_interface_name, ) -from as2fm.scxml_converter.scxml_entries.utils import ( +from moco.roaml_converter.scxml_entries.utils import ( PLAIN_FIELD_EVENT_PREFIX, PLAIN_SCXML_EVENT_DATA_PREFIX, ROS_FIELD_PREFIX, diff --git a/src/as2fm/jani_generator/ros_helpers/ros_communication_handler.py b/src/moco/roaml_generator/ros_helpers/ros_communication_handler.py similarity index 95% rename from src/as2fm/jani_generator/ros_helpers/ros_communication_handler.py rename to src/moco/roaml_generator/ros_helpers/ros_communication_handler.py index 71efb7f8..f52044e3 100644 --- a/src/as2fm/jani_generator/ros_helpers/ros_communication_handler.py +++ b/src/moco/roaml_generator/ros_helpers/ros_communication_handler.py @@ -19,11 +19,11 @@ from typing import Dict, Iterator, List, Optional, Type -from as2fm.as2fm_common.array_type import get_default_expression_for_type, value_to_string_expr -from as2fm.jani_generator.jani_entries import JaniModel -from as2fm.scxml_converter.data_types.type_utils import get_data_type_from_string -from as2fm.scxml_converter.scxml_entries import ScxmlData, ScxmlRoot -from as2fm.scxml_converter.scxml_entries.utils import ROS_FIELD_PREFIX +from moco.moco_common.array_type import get_default_expression_for_type, value_to_string_expr +from moco.roaml_generator.jani_entries import JaniModel +from moco.roaml_converter.data_types.type_utils import get_data_type_from_string +from moco.roaml_converter.scxml_entries import ScxmlData, ScxmlRoot +from moco.roaml_converter.scxml_entries.utils import ROS_FIELD_PREFIX class RosCommunicationHandler: diff --git a/src/as2fm/jani_generator/ros_helpers/ros_service_handler.py b/src/moco/roaml_generator/ros_helpers/ros_service_handler.py similarity index 95% rename from src/as2fm/jani_generator/ros_helpers/ros_service_handler.py rename to src/moco/roaml_generator/ros_helpers/ros_service_handler.py index e0841e71..ef1c913b 100644 --- a/src/as2fm/jani_generator/ros_helpers/ros_service_handler.py +++ b/src/moco/roaml_generator/ros_helpers/ros_service_handler.py @@ -19,8 +19,8 @@ from typing import Dict, List -from as2fm.jani_generator.ros_helpers.ros_communication_handler import RosCommunicationHandler -from as2fm.scxml_converter.scxml_entries import ( +from moco.roaml_generator.ros_helpers.ros_communication_handler import RosCommunicationHandler +from moco.roaml_converter.scxml_entries import ( ScxmlAssign, ScxmlDataModel, ScxmlParam, @@ -29,7 +29,7 @@ ScxmlState, ScxmlTransition, ) -from as2fm.scxml_converter.scxml_entries.ros_utils import ( +from moco.roaml_converter.scxml_entries.ros_utils import ( generate_srv_request_event, generate_srv_response_event, generate_srv_server_request_event, @@ -37,7 +37,7 @@ get_srv_type_params, sanitize_ros_interface_name, ) -from as2fm.scxml_converter.scxml_entries.utils import PLAIN_FIELD_EVENT_PREFIX, ROS_FIELD_PREFIX +from moco.roaml_converter.scxml_entries.utils import PLAIN_FIELD_EVENT_PREFIX, ROS_FIELD_PREFIX class RosServiceHandler(RosCommunicationHandler): diff --git a/src/as2fm/jani_generator/ros_helpers/ros_timer.py b/src/moco/roaml_generator/ros_helpers/ros_timer.py similarity index 99% rename from src/as2fm/jani_generator/ros_helpers/ros_timer.py rename to src/moco/roaml_generator/ros_helpers/ros_timer.py index 1667f9aa..828345e2 100644 --- a/src/as2fm/jani_generator/ros_helpers/ros_timer.py +++ b/src/moco/roaml_generator/ros_helpers/ros_timer.py @@ -20,7 +20,7 @@ from math import floor, gcd from typing import List, Optional, Tuple -from as2fm.scxml_converter.scxml_entries import ( +from moco.roaml_converter.scxml_entries import ( RosField, RosTopicPublish, RosTopicPublisher, diff --git a/src/as2fm/scxml_converter/__init__.py b/src/moco/roaml_generator/scxml_helpers/__init__.py similarity index 100% rename from src/as2fm/scxml_converter/__init__.py rename to src/moco/roaml_generator/scxml_helpers/__init__.py diff --git a/src/as2fm/jani_generator/scxml_helpers/roaml_model.py b/src/moco/roaml_generator/scxml_helpers/roaml_model.py similarity index 97% rename from src/as2fm/jani_generator/scxml_helpers/roaml_model.py rename to src/moco/roaml_generator/scxml_helpers/roaml_model.py index a6372914..5f48705e 100644 --- a/src/as2fm/jani_generator/scxml_helpers/roaml_model.py +++ b/src/moco/roaml_generator/scxml_helpers/roaml_model.py @@ -21,15 +21,15 @@ import lxml.etree as ET from lxml.etree import _Element as XmlElement -from as2fm.as2fm_common.common import remove_namespace, string_as_bool -from as2fm.as2fm_common.logging import ( +from moco.moco_common.common import remove_namespace, string_as_bool +from moco.moco_common.logging import ( check_assertion, get_error_msg, set_filepath_for_all_sub_elements, ) -from as2fm.scxml_converter.data_types.json_struct_definition import JsonStructDefinition -from as2fm.scxml_converter.data_types.struct_definition import StructDefinition -from as2fm.scxml_converter.data_types.xml_struct_definition import XmlStructDefinition +from moco.roaml_converter.data_types.json_struct_definition import JsonStructDefinition +from moco.roaml_converter.data_types.struct_definition import StructDefinition +from moco.roaml_converter.data_types.xml_struct_definition import XmlStructDefinition @dataclass() diff --git a/src/as2fm/jani_generator/scxml_helpers/scxml_event.py b/src/moco/roaml_generator/scxml_helpers/scxml_event.py similarity index 97% rename from src/as2fm/jani_generator/scxml_helpers/scxml_event.py rename to src/moco/roaml_generator/scxml_helpers/scxml_event.py index 52edd501..9a378a4c 100644 --- a/src/as2fm/jani_generator/scxml_helpers/scxml_event.py +++ b/src/moco/roaml_generator/scxml_helpers/scxml_event.py @@ -21,17 +21,17 @@ from dataclasses import dataclass from typing import Dict, List, MutableSequence, Optional, Type, Union -from as2fm.jani_generator.ros_helpers.ros_timer import ( +from moco.roaml_generator.ros_helpers.ros_timer import ( ROS_TIMER_RATE_EVENT_PREFIX, is_global_timer_event, ) -from as2fm.scxml_converter.scxml_entries.bt_utils import ( +from moco.roaml_converter.scxml_entries.bt_utils import ( is_bt_halt_event, is_bt_halt_response_event, is_bt_tick_event, is_bt_tick_response_event, ) -from as2fm.scxml_converter.scxml_entries.ros_utils import ( +from moco.roaml_converter.scxml_entries.ros_utils import ( is_action_request_event, is_action_result_event, is_action_thread_event, @@ -58,7 +58,7 @@ def __init__(self, automaton_name: str, edge_action_name: str): self.edge_action_name = edge_action_name -# TODO: Make type holder data structure consistent over complete AS2FM (issue #101) +# TODO: Make type holder data structure consistent over complete moco (issue #101) @dataclass class EventParamType: """Information related to a parameter type.""" diff --git a/src/as2fm/jani_generator/scxml_helpers/scxml_event_processor.py b/src/moco/roaml_generator/scxml_helpers/scxml_event_processor.py similarity index 96% rename from src/as2fm/jani_generator/scxml_helpers/scxml_event_processor.py rename to src/moco/roaml_generator/scxml_helpers/scxml_event_processor.py index a51f8a61..c8d1795f 100644 --- a/src/as2fm/jani_generator/scxml_helpers/scxml_event_processor.py +++ b/src/moco/roaml_generator/scxml_helpers/scxml_event_processor.py @@ -19,24 +19,24 @@ from typing import Dict, List, MutableSequence, Optional, Tuple -from as2fm.as2fm_common.array_type import ArrayInfo, is_array_type -from as2fm.jani_generator.jani_entries import ( +from moco.moco_common.array_type import ArrayInfo, is_array_type +from moco.roaml_generator.jani_entries import ( JaniAutomaton, JaniComposition, JaniEdge, JaniModel, JaniVariable, ) -from as2fm.jani_generator.jani_entries.jani_expression_generator import array_create_operator -from as2fm.jani_generator.ros_helpers.ros_timer import ( +from moco.roaml_generator.jani_entries.jani_expression_generator import array_create_operator +from moco.roaml_generator.ros_helpers.ros_timer import ( GLOBAL_TIMER_AUTOMATON, GLOBAL_TIMER_TICK_ACTION, GLOBAL_TIMER_TICK_EVENT, ROS_TIMER_RATE_EVENT_PREFIX, ) -from as2fm.jani_generator.scxml_helpers.scxml_event import Event, EventsHolder -from as2fm.jani_generator.scxml_helpers.scxml_expression import get_array_length_var_name -from as2fm.scxml_converter.data_types.type_utils import MEMBER_ACCESS_SUBSTITUTION +from moco.roaml_generator.scxml_helpers.scxml_event import Event, EventsHolder +from moco.roaml_generator.scxml_helpers.scxml_expression import get_array_length_var_name +from moco.roaml_converter.data_types.type_utils import MEMBER_ACCESS_SUBSTITUTION JANI_TIMER_ENABLE_ACTION = "global_timer_enable" diff --git a/src/as2fm/jani_generator/scxml_helpers/scxml_expression.py b/src/moco/roaml_generator/scxml_helpers/scxml_expression.py similarity index 96% rename from src/as2fm/jani_generator/scxml_helpers/scxml_expression.py rename to src/moco/roaml_generator/scxml_helpers/scxml_expression.py index c9cee0a9..2531153a 100644 --- a/src/as2fm/jani_generator/scxml_helpers/scxml_expression.py +++ b/src/moco/roaml_generator/scxml_helpers/scxml_expression.py @@ -25,23 +25,23 @@ from esprima.syntax import Syntax from lxml.etree import _Element as XmlElement -from as2fm.as2fm_common.ecmascript_interpretation_functions import ( +from moco.moco_common.ecmascript_interpretation_functions import ( get_ast_expression_type, get_list_from_array_expr, ) -from as2fm.as2fm_common.logging import check_assertion, get_error_msg -from as2fm.jani_generator.jani_entries.jani_convince_expression_expansion import ( +from moco.moco_common.logging import check_assertion, get_error_msg +from moco.roaml_generator.jani_entries.jani_convince_expression_expansion import ( CALLABLE_OPERATORS_MAP, OPERATORS_TO_JANI_MAP, UNARY_OPERATORS_MAP, ) -from as2fm.jani_generator.jani_entries.jani_expression import JaniExpression -from as2fm.jani_generator.jani_entries.jani_expression_generator import ( +from moco.roaml_generator.jani_entries.jani_expression import JaniExpression +from moco.roaml_generator.jani_entries.jani_expression_generator import ( array_access_operator, array_value_operator, ) -from as2fm.jani_generator.jani_entries.jani_value import JaniValue -from as2fm.scxml_converter.data_types.type_utils import ARRAY_LENGTH_SUFFIX, ArrayInfo +from moco.roaml_generator.jani_entries.jani_value import JaniValue +from moco.roaml_converter.data_types.type_utils import ARRAY_LENGTH_SUFFIX, ArrayInfo JS_CALLABLE_PREFIX = "Math" diff --git a/src/as2fm/jani_generator/scxml_helpers/scxml_to_jani.py b/src/moco/roaml_generator/scxml_helpers/scxml_to_jani.py similarity index 93% rename from src/as2fm/jani_generator/scxml_helpers/scxml_to_jani.py rename to src/moco/roaml_generator/scxml_helpers/scxml_to_jani.py index f449cfbd..731175bd 100644 --- a/src/as2fm/jani_generator/scxml_helpers/scxml_to_jani.py +++ b/src/moco/roaml_generator/scxml_helpers/scxml_to_jani.py @@ -22,8 +22,8 @@ from copy import deepcopy from typing import Any, Dict, List, Optional -from as2fm.as2fm_common.logging import log_error -from as2fm.jani_generator.jani_entries import ( +from moco.moco_common.logging import log_error +from moco.roaml_generator.jani_entries import ( JaniAssignment, JaniAutomaton, JaniExpression, @@ -31,27 +31,27 @@ JaniModel, JaniVariable, ) -from as2fm.jani_generator.jani_entries.jani_expression_generator import ( +from moco.roaml_generator.jani_entries.jani_expression_generator import ( and_operator, array_access_operator, equal_operator, ) -from as2fm.jani_generator.jani_entries.jani_helpers import expand_random_variables_in_jani_model -from as2fm.jani_generator.jani_entries.jani_utils import ( +from moco.roaml_generator.jani_entries.jani_helpers import expand_random_variables_in_jani_model +from moco.roaml_generator.jani_entries.jani_utils import ( get_array_access_name_and_indexes, is_expression_array, is_expression_variable_or_array_access, ) -from as2fm.jani_generator.ros_helpers.ros_communication_handler import ( +from moco.roaml_generator.ros_helpers.ros_communication_handler import ( remove_empty_self_loops_from_interface_handlers_in_jani, ) -from as2fm.jani_generator.scxml_helpers.scxml_event import EventsHolder -from as2fm.jani_generator.scxml_helpers.scxml_event_processor import ( +from moco.roaml_generator.scxml_helpers.scxml_event import EventsHolder +from moco.roaml_generator.scxml_helpers.scxml_event_processor import ( implement_scxml_events_as_jani_syncs, ) -from as2fm.jani_generator.scxml_helpers.scxml_expression import get_array_length_var_name -from as2fm.jani_generator.scxml_helpers.scxml_to_jani_interfaces import BaseTag -from as2fm.scxml_converter.scxml_entries import ScxmlRoot +from moco.roaml_generator.scxml_helpers.scxml_expression import get_array_length_var_name +from moco.roaml_generator.scxml_helpers.scxml_to_jani_interfaces import BaseTag +from moco.roaml_converter.scxml_entries import ScxmlRoot def convert_scxml_root_to_jani_automaton( diff --git a/src/as2fm/jani_generator/scxml_helpers/scxml_to_jani_interfaces.py b/src/moco/roaml_generator/scxml_helpers/scxml_to_jani_interfaces.py similarity index 97% rename from src/as2fm/jani_generator/scxml_helpers/scxml_to_jani_interfaces.py rename to src/moco/roaml_generator/scxml_helpers/scxml_to_jani_interfaces.py index fffbef17..09b496e0 100644 --- a/src/as2fm/jani_generator/scxml_helpers/scxml_to_jani_interfaces.py +++ b/src/moco/roaml_generator/scxml_helpers/scxml_to_jani_interfaces.py @@ -19,41 +19,41 @@ from typing import Any, Dict, List, MutableSequence, Optional, Set, Tuple, Type -from as2fm.as2fm_common.array_type import ArrayInfo, get_array_type_and_sizes, get_padded_array -from as2fm.as2fm_common.common import EPSILON -from as2fm.as2fm_common.ecmascript_interpretation import ( +from moco.moco_common.array_type import ArrayInfo, get_array_type_and_sizes, get_padded_array +from moco.moco_common.common import EPSILON +from moco.moco_common.ecmascript_interpretation import ( get_array_expr_as_list, parse_ecmascript_expr_to_type, ) -from as2fm.as2fm_common.logging import check_assertion -from as2fm.jani_generator.jani_entries import ( +from moco.moco_common.logging import check_assertion +from moco.roaml_generator.jani_entries import ( JaniAutomaton, JaniEdge, JaniExpression, JaniValue, JaniVariable, ) -from as2fm.jani_generator.jani_entries.jani_expression_generator import array_value_operator -from as2fm.jani_generator.scxml_helpers.scxml_event import Event, EventsHolder, is_event_synched -from as2fm.jani_generator.scxml_helpers.scxml_expression import ( +from moco.roaml_generator.jani_entries.jani_expression_generator import array_value_operator +from moco.roaml_generator.scxml_helpers.scxml_event import Event, EventsHolder, is_event_synched +from moco.roaml_generator.scxml_helpers.scxml_expression import ( get_array_length_var_name, parse_ecmascript_to_jani_expression, ) -from as2fm.jani_generator.scxml_helpers.scxml_to_jani_interfaces_helpers import ( +from moco.roaml_generator.scxml_helpers.scxml_to_jani_interfaces_helpers import ( append_scxml_body_to_jani_automaton, append_scxml_body_to_jani_edge, check_valid_data_declaration, hash_element, merge_conditions, ) -from as2fm.scxml_converter.bt_converter import is_bt_root_scxml -from as2fm.scxml_converter.data_types.type_utils import ( +from moco.roaml_converter.bt_converter import is_bt_root_scxml +from moco.roaml_converter.data_types.type_utils import ( get_array_info, get_data_type_from_string, is_type_string_array, is_type_string_base_type, ) -from as2fm.scxml_converter.scxml_entries import ( +from moco.roaml_converter.scxml_entries import ( ScxmlBase, ScxmlDataModel, ScxmlRoot, diff --git a/src/as2fm/jani_generator/scxml_helpers/scxml_to_jani_interfaces_helpers.py b/src/moco/roaml_generator/scxml_helpers/scxml_to_jani_interfaces_helpers.py similarity index 97% rename from src/as2fm/jani_generator/scxml_helpers/scxml_to_jani_interfaces_helpers.py rename to src/moco/roaml_generator/scxml_helpers/scxml_to_jani_interfaces_helpers.py index b4233f28..359aadf0 100644 --- a/src/as2fm/jani_generator/scxml_helpers/scxml_to_jani_interfaces_helpers.py +++ b/src/moco/roaml_generator/scxml_helpers/scxml_to_jani_interfaces_helpers.py @@ -14,7 +14,7 @@ # limitations under the License. """ -Helper functions used in `as2fm.jani_generator.scxml_helpers.scxml_to_jani_interfaces`. +Helper functions used in `moco.roaml_generator.scxml_helpers.scxml_to_jani_interfaces`. """ from hashlib import sha256 @@ -23,14 +23,14 @@ import lxml.etree as ET from lxml.etree import _Element as XmlElement -from as2fm.as2fm_common.array_type import ArrayInfo, get_array_type_and_sizes -from as2fm.as2fm_common.ecmascript_interpretation import ( +from moco.moco_common.array_type import ArrayInfo, get_array_type_and_sizes +from moco.moco_common.ecmascript_interpretation import ( ValidECMAScriptTypes, get_array_expr_as_list, parse_ecmascript_expr_to_type, ) -from as2fm.as2fm_common.logging import check_assertion, get_error_msg, log_warning -from as2fm.jani_generator.jani_entries import ( +from moco.moco_common.logging import check_assertion, get_error_msg, log_warning +from moco.roaml_generator.jani_entries import ( JaniAssignment, JaniAutomaton, JaniEdge, @@ -39,7 +39,7 @@ JaniGuard, JaniVariable, ) -from as2fm.jani_generator.jani_entries.jani_expression_generator import ( +from moco.roaml_generator.jani_entries.jani_expression_generator import ( and_operator, array_access_operator, array_value_operator, @@ -47,18 +47,18 @@ not_operator, plus_operator, ) -from as2fm.jani_generator.jani_entries.jani_utils import ( +from moco.roaml_generator.jani_entries.jani_utils import ( generate_jani_variable, is_expression_array, is_variable_array, ) -from as2fm.jani_generator.scxml_helpers.scxml_event import Event, EventParamType, EventsHolder -from as2fm.jani_generator.scxml_helpers.scxml_expression import ( +from moco.roaml_generator.scxml_helpers.scxml_event import Event, EventParamType, EventsHolder +from moco.roaml_generator.scxml_helpers.scxml_expression import ( get_array_length_var_name, parse_ecmascript_to_jani_expression, ) -from as2fm.scxml_converter.data_types.type_utils import MEMBER_ACCESS_SUBSTITUTION -from as2fm.scxml_converter.scxml_entries import ( +from moco.roaml_converter.data_types.type_utils import MEMBER_ACCESS_SUBSTITUTION +from moco.roaml_converter.scxml_entries import ( ScxmlAssign, ScxmlBase, ScxmlExecutionBody, @@ -447,7 +447,7 @@ def append_scxml_body_to_jani_edge( # Update the events holder # TODO: expr might contain reference to event variables, that have no type specified # For now, we avoid the problem by using support variables in the model... - # See https://github.com/convince-project/AS2FM/issues/84 + # See https://github.com/convince-project/moco/issues/84 res_eval_type = parse_ecmascript_expr_to_type(expr, datamodel_vars, element_origin) res_eval_dims = 0 # In case of MutableSequences, we need to get the dimensionality of the result diff --git a/src/as2fm/jani_generator/scxml_helpers/top_level_interpreter.py b/src/moco/roaml_generator/scxml_helpers/top_level_interpreter.py similarity index 90% rename from src/as2fm/jani_generator/scxml_helpers/top_level_interpreter.py rename to src/moco/roaml_generator/scxml_helpers/top_level_interpreter.py index 7eb462c1..60782866 100644 --- a/src/as2fm/jani_generator/scxml_helpers/top_level_interpreter.py +++ b/src/moco/roaml_generator/scxml_helpers/top_level_interpreter.py @@ -22,27 +22,27 @@ from copy import deepcopy from typing import Dict, List, Optional -from as2fm.jani_generator.jani_entries import JaniModel, JaniProperty -from as2fm.jani_generator.ros_helpers.ros_action_handler import RosActionHandler -from as2fm.jani_generator.ros_helpers.ros_communication_handler import ( +from moco.roaml_generator.jani_entries import JaniModel, JaniProperty +from moco.roaml_generator.ros_helpers.ros_action_handler import RosActionHandler +from moco.roaml_generator.ros_helpers.ros_communication_handler import ( RosCommunicationHandler, generate_plain_scxml_from_handlers, update_ros_communication_handlers, ) -from as2fm.jani_generator.ros_helpers.ros_service_handler import RosServiceHandler -from as2fm.jani_generator.ros_helpers.ros_timer import RosTimer, make_global_timer_scxml -from as2fm.jani_generator.scxml_helpers.roaml_model import FullModel, RoamlDataStructures, RoamlMain -from as2fm.jani_generator.scxml_helpers.scxml_to_jani import ( +from moco.roaml_generator.ros_helpers.ros_service_handler import RosServiceHandler +from moco.roaml_generator.ros_helpers.ros_timer import RosTimer, make_global_timer_scxml +from moco.roaml_generator.scxml_helpers.roaml_model import FullModel, RoamlDataStructures, RoamlMain +from moco.roaml_generator.scxml_helpers.scxml_to_jani import ( convert_multiple_scxmls_to_jani, preprocess_jani_expressions, ) -from as2fm.scxml_converter.bt_converter import ( +from moco.roaml_converter.bt_converter import ( bt_converter, generate_blackboard_scxml, get_blackboard_variables_from_models, ) -from as2fm.scxml_converter.data_types.struct_definition import StructDefinition -from as2fm.scxml_converter.scxml_entries import EventsToAutomata, ScxmlRoot +from moco.roaml_converter.data_types.struct_definition import StructDefinition +from moco.roaml_converter.scxml_entries import EventsToAutomata, ScxmlRoot def generate_plain_scxml_models_and_timers(model: FullModel) -> List[ScxmlRoot]: @@ -145,7 +145,7 @@ def export_plain_scxml_models( def interpret_top_level_xml( - xml_path: str, *, jani_file: Optional[str] = None, scxmls_dir: Optional[str] = None + xml_path: str, scxmls_dir: Optional[str] = None ): """ Interpret the top-level XML file as a Jani model. And write it to a file. @@ -166,6 +166,9 @@ def interpret_top_level_xml( if scxmls_dir is not None: plain_scxml_dir = os.path.join(model_dir, scxmls_dir) export_plain_scxml_models(plain_scxml_dir, plain_scxml_models) + + # JANI file creation, to be removed + # if jani_file is not None: # jani_model: JaniModel = convert_multiple_scxmls_to_jani( # plain_scxml_models, model.max_array_size diff --git a/test/jani_generator/_test_data/probabilistic_transitions/SYNTAX_IDEA.scxml b/test/jani_generator/_test_data/probabilistic_transitions/SYNTAX_IDEA.scxml index 66ee065a..0b919cca 100644 --- a/test/jani_generator/_test_data/probabilistic_transitions/SYNTAX_IDEA.scxml +++ b/test/jani_generator/_test_data/probabilistic_transitions/SYNTAX_IDEA.scxml @@ -8,7 +8,7 @@ diff --git a/test/jani_generator/_test_data/set_float_srv_example/client.scxml b/test/jani_generator/_test_data/set_float_srv_example/client.scxml index 4938b683..2a71b1ed 100644 --- a/test/jani_generator/_test_data/set_float_srv_example/client.scxml +++ b/test/jani_generator/_test_data/set_float_srv_example/client.scxml @@ -6,7 +6,7 @@ model_src="" xmlns="http://www.w3.org/2005/07/scxml"> - + diff --git a/test/jani_generator/_test_data/set_float_srv_example/server.scxml b/test/jani_generator/_test_data/set_float_srv_example/server.scxml index d113a549..d49b87f7 100644 --- a/test/jani_generator/_test_data/set_float_srv_example/server.scxml +++ b/test/jani_generator/_test_data/set_float_srv_example/server.scxml @@ -10,7 +10,7 @@ - + diff --git a/test/jani_generator/test_systemtest_behavior_tree_scxml.py b/test/jani_generator/test_systemtest_behavior_tree_scxml.py deleted file mode 100644 index 54dfed83..00000000 --- a/test/jani_generator/test_systemtest_behavior_tree_scxml.py +++ /dev/null @@ -1,109 +0,0 @@ -# Copyright (c) 2024 - for information on the respective copyright owner -# see the NOTICE file - -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at - -# http://www.apache.org/licenses/LICENSE-2.0 - -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Test the SCXML conversion to JANI""" - -import os -import unittest - -import pytest - -from as2fm.jani_generator.scxml_helpers.top_level_interpreter import interpret_top_level_xml - -from ..as2fm_common.test_utilities_smc_storm import run_smc_storm_with_output - - -# pylint: disable=too-many-public-methods -class TestConversion(unittest.TestCase): - """ - Test the conversion of SCXML to JANI. - """ - - def _test_with_main( - self, - path_to_main_xml: str, - property_name: str, - expected_result_probability: float, - result_probability_tolerance: float = 0.0, - ): - """ - Testing the model resulting from the main xml file with the entrypoint. - - :param path_to_main_xml: The path to the main xml file. - :param property_name: The property name to test. - :param success: If the property is expected to be always satisfied or always not satisfied. - """ - test_folder = os.path.join(os.path.dirname(__file__), "_test_data") - main_xml_full_path = os.path.join(test_folder, path_to_main_xml) - generated_scxml_path = "generated_plain_scxml" - jani_file = "main.jani" - test_folder = os.path.dirname(main_xml_full_path) - interpret_top_level_xml( - main_xml_full_path, jani_file="main.jani", scxmls_dir=generated_scxml_path - ) - jani_file_path = os.path.join(test_folder, jani_file) - generated_scxml_path = os.path.join(test_folder, generated_scxml_path) - self.assertTrue(os.path.exists(jani_file_path)) - run_smc_storm_with_output( - f"--model {jani_file_path} --properties-names {property_name}", - [property_name, jani_file_path], - [], - expected_result_probability, - result_probability_tolerance, - ) - # Remove generated file (in case of test passed) - if os.path.exists(jani_file_path): - os.remove(jani_file_path) - if os.path.exists(generated_scxml_path): - for file in os.listdir(generated_scxml_path): - assert file.endswith(".scxml") - os.remove(os.path.join(generated_scxml_path, file)) - os.removedirs(generated_scxml_path) - - def test_reactive_sequence(self): - """Test the reactive_sequence behavior.""" - self._test_with_main( - os.path.join("bt_test_models", "main_test_reactive_sequence.xml"), - "ten_tick_zero_no_tick_one", - expected_result_probability=1.0, - ) - - def test_reactive_fallback(self): - """Test the reactive_fallback behavior.""" - self._test_with_main( - os.path.join("bt_test_models", "main_test_reactive_fallback.xml"), - "ten_tick_zero_no_tick_one", - expected_result_probability=1.0, - ) - - def test_sequence(self): - """Test the sequence behavior.""" - self._test_with_main( - os.path.join("bt_test_models", "main_test_sequence.xml"), - "regular_bt_test", - expected_result_probability=1.0, - ) - - def test_fallback(self): - """Test the sequence behavior.""" - self._test_with_main( - os.path.join("bt_test_models", "main_test_fallback.xml"), - "regular_bt_test", - expected_result_probability=1.0, - ) - - -if __name__ == "__main__": - pytest.main(["-s", "-v", __file__]) diff --git a/test/jani_generator/test_systemtest_main_xml_to_jani.py b/test/jani_generator/test_systemtest_main_xml_to_jani.py deleted file mode 100644 index 2ee97831..00000000 --- a/test/jani_generator/test_systemtest_main_xml_to_jani.py +++ /dev/null @@ -1,562 +0,0 @@ -# Copyright (c) 2025 - for information on the respective copyright owner -# see the NOTICE file - -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at - -# http://www.apache.org/licenses/LICENSE-2.0 - -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Test the conversion from a main.xml to JANI and running it with SMC Storm.""" - -import os - -import pytest - -from as2fm.jani_generator.scxml_helpers.top_level_interpreter import ( - RoamlMain, - interpret_top_level_xml, -) - -from ..as2fm_common.test_utilities_smc_storm import run_smc_storm_with_output -from .utils import json_jani_properties_match - -rel_examples_folder = os.path.join("..", "..", "..", "examples") - -PROB_ERROR_TOLERANCE = 0.015 - - -# pylint: disable=too-many-arguments, too-many-positional-arguments -def _test_with_main( - folder: str, - property_name: str, - expected_result_probability: float, - model_xml: str, - generate_plain_scxml: bool, - skip_smc: bool, - result_probability_tolerance: float, - trace_length_limit: int, - n_traces_limit: int, - skip_properties_load_check: bool, - disable_cache: bool, - n_threads: int, - batch_size: int, - _case_name: str, -): - """ - Testing the conversion of the model xml file with the entrypoint. - - :param folder: The folder containing the test data. - :param model_xml: the name of the xml file containing the model to evaluate. - :param generate_plain_scxml: If the plain SCXMLs should be generated. - :param skip_smc: If the model shall be executed using SMC (uses smc_storm). - :param property_name: The property name to test. - :param expected_result_probability: The expected probability the prop. is verified from SMC. - :param result_probability_tolerance: The allowed error for the prob. result. - :param trace_length_limit: the max length a single trace can reach - :param n_traces_limit: The max. number of iterations to run in SMC. - :param skip_properties_load_check: Disable the equality check for the loaded properties. - :param disable_cache: Whether to disable cache in smc_storm. - :param n_threads: How many threads to use. - :param batch_size: How many traces to compute in a batch before checking for convergence. - :param _case_name: Unused here. Needed to name the parameterized tests. - """ - test_data_dir = os.path.join(os.path.dirname(__file__), "_test_data", folder) - xml_main_path = os.path.join(test_data_dir, model_xml) - assert xml_main_path.endswith(".xml"), f"Unexpected format of main xml file {xml_main_path}" - model_jani = model_xml.removesuffix("xml") + "jani" - jani_path = os.path.join(test_data_dir, model_jani) - if os.path.exists(jani_path): - os.remove(jani_path) - generated_scxml_path = "generated_plain_scxml" if generate_plain_scxml else None - plain_scxml_path = os.path.join(test_data_dir, "generated_plain_scxml") - - if generate_plain_scxml: - plain_scxml_path = os.path.join(test_data_dir, "generated_plain_scxml") - - try: - interpret_top_level_xml( - xml_main_path, jani_file=model_jani, scxmls_dir=generated_scxml_path - ) - if generate_plain_scxml: - assert os.path.exists(plain_scxml_path), "Expected to find generated plain SCXMl files" - generated_files = os.listdir(plain_scxml_path) - # Ensure there is the data type comment in the generated SCXML - assert len(generated_files) > 0, "Expected at least one gen. SCXML file." - for file in os.listdir(plain_scxml_path): - with open(os.path.join(plain_scxml_path, file), "r", encoding="utf-8") as f: - # Make sure that the generated plain SCXML files use the agreed format - content = f.read() - if "" in content: - assert "