This project provides tools to create and deploy runtime monitors for your Robot Operating System applications.
This package can be installed with pip:
pip install hpl-rv-rosYou can use this project to generate code both as a library and as a standalone tool.
First, you will need a mapping of ROS topic types to message types. This can be specified in YAML or JSON formats, when provided as a file. For example:
%YAML 1.2
# file: topics.yaml
---
/a: std_msgs/Int64
/b: std_msgs/Int64
/p: std_msgs/Bool
/q: std_msgs/BoolThen, you will also need to provide a HPL specification. This can be either a list of properties, or a .hpl file, depending on how you want to use this package.
This package provides the hpl-rv-ros CLI script.
- a path to the topic type mapping file
- either a list of properties or a list of
.hplfiles, depending on flags
- flag
--rospy: generate ROS1 code instead of ROS2 code - flag
-for--files: treat positional arguments as a list of paths to.hplfiles instead of a list of properties - argument
-oor--output: pass a path to an output file for the generated code (default: print to screen)
To generate ROS2 code:
hpl-rv-ros -f -o rclpy_node.py topics.yaml properties.hplTo generate ROS1 code:
hpl-rv-ros --rospy -f -o rospy_node.py topics.yaml properties.hplThis repository provides the hplrv_ros Python package.
from typing import Dict, List
from pathlib import Path
from hpl.ast import HplProperty
from hpl.parser import property_parser
from hplrv_ros.rclpy import generate_node as generate_rclpy
from hplrv_ros.rospy import generate_node as generate_rospy
parser = property_parser()
topic_types: Dict[str, str] = { '/a': 'std_msgs/Int32' }
properties: List[HplProperty] = [parser.parse('globally: no /a {data > 0}')]
rclpy_code: str = generate_rclpy(properties, topic_types)
rospy_code: str = generate_rospy(properties, topic_types)
path: Path = Path('rclpy_node.py')
path.write_text(rclpy_code, encoding='utf-8')
path = Path('rospy_node.py')
path.write_text(rospy_code, encoding='utf-8')The .github directory comes with a number of files to configure certain GitHub features.
- Various Issue templates can be found under
ISSUE_TEMPLATE. - A Pull Request template can be found at
PULL_REQUEST_TEMPLATE.md. - Automatically mark issues as stale after a period of inactivity. The configuration file can be found at
.stale.yml. - Keep package dependencies up to date with Dependabot. The configuration file can be found at
dependabot.yml. - Keep Release Drafts automatically up to date with Pull Requests, using the Release Drafter GitHub Action. The configuration file can be found at
release-drafter.ymland the workflow atworkflows/release-drafter.yml. - Automatic package building and publishing when pushing a new version tag to
main. The workflow can be found atworkflows/publish-package.yml.
This package sets up various tox environments for static checks, testing, building and publishing.
It is also configured with pre-commit hooks to perform static checks and automatic formatting.
If you do not use tox, you can build the package with build and install a development version with pip.
Assume cd into the repository's root.
To install the pre-commit hooks:
pre-commit installTo run type checking:
tox -e typecheckTo run linting tools:
tox -e lintTo run automatic formatting:
tox -e formatTo run tests:
toxTo build the package:
tox -e buildTo build the package (with build):
python -m buildTo clean the previous build files:
tox -e cleanTo test package publication (publish to Test PyPI):
tox -e publishTo publish the package to PyPI:
tox -e publish -- --repository pypiTo install an editable version:
pip install -e .