Skip to content

ipa320/ros2model

Repository files navigation

Ros Model Parser

License ROS Build Status Python Build Status

Technical Maintainer: ipa-nhg (Nadia Hammoudeh Garcia, Fraunhofer IPA) - nadia.hammoudeh.garcia@ipa.fraunhofer.de

This Ros package holds python interpreters for the ROS models created using the SeRoNet toolchain. These models (.ros and .rossystem extensions) can be used to describe ROS nodes, their interaction and the instantiation at runtime for further information please check the ROS model tutorials.

In addition, the Toolchain offers automatic extractors of the models from the original ROS code, on one hand with static code analyzers (based on HAROS) and on the other hand with introspectors at runtime.

For the static code analysis we made available a web interface able to inspect code hosted on Git and get its model representation as feedback http://ros-model.seronet-project.de/.

Install with ROS

  1. clone this repository into the source folder in your workspace, such as:
    ws/src/ros2model
    
  2. Source ROS workspace
    source /opt/ros/humble/setup.bash
    
  3. Back to the folder "ws", create and active venv
    python3 -m venv venv --system-site-packages --symlinks
    source venv/bin/activate
    
  4. Install poetry and install dependencies run
    pip install poetry
    poetry install -C src/ros2model/
    
  5. compile it as ROS package
    python -m colcon build --packages-select ros2model --symlink-install
    
    source install/local_setup.bash
    
  6. config python path in this case we are using python3.10 in venv
    export PYTHONPATH=$PYTHONPATH:$(pwd)/venv/lib/python3.10/site-packages/
    

Run

  1. Create ros node models from a run-time system:

    
    ros2 model node -o test/nodes # it will save generated file in folder "test/nodes"
    

    You can run the command below to get more usage information.

    ros2 model node -h
    
    usage: ros2 model node [-h] [--spin-time SPIN_TIME] [-s] [--no-daemon] [-o OUTPUT_FOLDER] [--include_hidden_nodes]
                        [--include_hidden_interfaces]
    
    Create .ros2 for each node in a runtime system
    
    options:
    -h, --help            show this help message and exit
    --spin-time SPIN_TIME
                            Spin time in seconds to wait for discovery (only applies when not using an already running daemon)
    -s, --use-sim-time    Enable ROS simulation time
    --no-daemon           Do not spawn nor use an already running daemon
    -o OUTPUT_FOLDER, --output_folder OUTPUT_FOLDER
                            The folder for storing the generated models.
    --include_hidden_nodes
                            Consider hidden nodes.
    --include_hidden_interfaces
                            Consider hidden topics, services or actions.
    
  2. Create a ros system model from a run-time system:

    ros2 model system -o test/turtlesim # save the system in test folder and named as "turtlesim.rossystem"
    

    You can run the command below to get more usage information.

    ros2 model system -h
    
    usage: ros2 model system [-h] [--spin-time SPIN_TIME] [-s] [--no-daemon] [-o OUTPUT_FILE] [--include_hidden_nodes]
                         [--include_hidden_interfaces]
    
    Create .rossystem for a runtime system
    
    options:
    -h, --help            show this help message and exit
    --spin-time SPIN_TIME
                            Spin time in seconds to wait for discovery (only applies when not using an already running daemon)
    -s, --use-sim-time    Enable ROS simulation time
    --no-daemon           Do not spawn nor use an already running daemon
    -o OUTPUT_FILE, --output_file OUTPUT_FILE
                            The system model file path.
    --include_hidden_nodes
                            Consider hidden nodes.
    --include_hidden_interfaces
                            Consider hidden topics, services or actions.
    

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published