Skip to main content

AIDDL External ROS2 Library

This library provides conversions between the AI Domain Definition Language (AIDDL) framework and ROS2. The main purpose of these converters is to be used in the aiddl_ros2_bridge ROS2 package (TODO: link) and ultimately decouple the AIDDL framework from ROS throught aiddl_external_grpc. ROS2 nodes from the aiddl_ros2_bridge can be configured to dynamically load converters. The overall envisioned usage of these packages is:

  1. Install aiddl_external_ros2
  2. Clone & build aiddl_ros2_bridge
  3. Optional: write custom converters if needed (for custom ROS2 messages, services, or actions).
  • Write a simple Python package with one class per message, service, or action and install it locally
  • Use aiddl_external_ros2 to convert existing messages where possible (e.g., Pose, PoseStamped)
  1. Write a YAML file describing ROS2 nodes and their AIDDL converters (from this package)
  2. Launch all ROS2 nodes and control your robots through aiddl_external_grpc

Overview

Interaction with ROS2 comes in three flavors: messages, services and actions. For each of these we use different static methods.

Messages

Messages can be converted between AIDDL and ROS2 formats. The two methods for this are ros2aiddl and aiddl2ros. Thw following example shows how strings are converted.

class StringConverter:
    @staticmethod
    def ros2aiddl(string_msg):
        return Str(string_msg)

    @staticmethod
    def aiddl2ros(string):
        return string.string

Services

Services allow to call functions in ROS2 so we need to convert the arguments of the service call from AIDDL to ROS and the result from ROS to AIDDL. The two methods for this are request_aiddl2ros and result_ros2aiddl and their implementation is exactly as for messages. Usually service converters rely heavily on message converters (since their inputs and outputs are ROS messages).

Actions

ROS2 actions allow sending goals to action servers that are then executed over a period time. During execution, feedback messages can be provided and after execution a result message is sent. So overall we need three converters which are request_aiddl2ros to accept goals, feedback_ros2aiddl to convert feedback, and result_aiddl2ros to convert the result.

The following example converts from AIDDL to the Nav2 action NavigateToPose. (The result message of the action is empty, so the corresponding converter simply returns the constant symbol NIL.)

class NavigateToPoseConverter(object):
    @staticmethod
    def request_aiddl2ros(term: Term):
        msg = NavigateToPose.Goal()
        msg.pose = PoseStampedConverter.aiddl2ros(term[0])
        msg.behavior_tree = term[1].unpack()
        return msg

    @staticmethod
    def feedback_ros2aiddl(msg):
        msg = NavigateToPose.Feedback()
        current_pose_term = PoseStampedConverter.ros2aiddl(msg.current_pose)
        navigation_time = DurationConverter.ros2aiddl(msg.navigation_time)
        estimated_time_remaining = DurationConverter.ros2aiddl(msg.estimated_time_remaining)
        number_of_recoveries = Int(msg.number_of_recoveries)
        distance_remaining = Real(msg.distance_remaining)
        return List(
            KeyVal(Sym("current_pose"), current_pose_term),
            KeyVal(Sym("navigation_time"), navigation_time),
            KeyVal(Sym("estimated_time_remaining"), estimated_time_remaining),
            KeyVal(Sym("number_of_recoveries"), number_of_recoveries),
            KeyVal(Sym("distance_remaining"), distance_remaining)
        )

    @staticmethod
    def result_ros2aiddl(msg):
        return Sym("NIL")

Available Converters

The following table lists all available converters with the full module and class name so they can be directly used in the configuration of aiddl_ros2_bridge nodes.

Messages

Messages can be translated from AIDDL to ROS (A->R) and vice versa (R->A). The Direction column indicates which of these options are implemented in the current version. In most cases both should be supported, but some ROS topics (e.g., visualization markers) may be supported for publishing from AIDDL to ROS only since we do not anticipate wanting to read them ourselves.

ROS2 Class Converter Class Direction
builtin_interfaces.msg.Duration aiddl_external_ros2.msg.builtin.DurationConverter both
builtin_interfaces.msg.Time aiddl_external_ros2.msg.builtin.TimeConverter both
std_msgs.msg.Header aiddl_external_ros2.msg.std.HeaderConverter both
std_msgs.msg.String aiddl_external_ros2.msg.std.StringConverter both
geometry_msgs.msg.Point aiddl_external_ros2.msg.geometry.PointConverter both
geometry_msgs.msg.Pose aiddl_external_ros2.msg.geometry.PoseConverter both
geometry_msgs.msg.PoseStamped aiddl_external_ros2.msg.geometry.PoseStamped Converter both
nav_msgs.msg.MapMetaData aiddl_external_ros2.msg.nav.MapMetaDataConverter R->A
nav_msgs.msg.OccupancyGrid aiddl_external_ros2.msg.nav.OccupancyGridConverter R->A
visualization_msgs.msg.Marker aiddl_external_ros2.msg.marker.MarkerConverter A->R

Services

ROS2 Class Converter Class
nav_msgs.srv.GetMap aiddl_external_ros2.service.nav.GetMapConverter

Actions

ROS2 Class Converter Class
nav2_msgs.action.NavigateToPose aiddl_external_ros2.action.nav2.NavigateToPoseConverter

Open Issues

  • Support direct conversions from ROS to B to avoid intermediate AIDDL conversion
  • Add remaining converters from std_msgs

Version History

0.2.1

  • Move constants to appropriate sub-packages
  • Fix package structure to reflect ROS2 structure
  • Documentation

0.1.0

  • Ported functionality from ROS1 version

Metadata

Release files for aiddl-external-ros2 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiddl-external-ros2 0.2.2
File Size Uploaded Provenance
aiddl_external_ros2-0.2.2.tar.gz 11.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for aiddl-external-ros2 0.2.2
File Interpreter ABI Platform
aiddl_external_ros2-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 28.5 kB

Release files / aiddl_external_ros2-0.2.2.tar.gz

Download URL aiddl_external_ros2-0.2.2.tar.gz
Size 11.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e99cd303a33a305d4ae2ec7f02ae7b10b93efd699044a3d506001b7525ee0369
BLAKE2b-256 checksum
How to use checksums
6b837cc57f103b8e6a0da3b7920661e0f0934b92283ad3af30590a5caa7c0410
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 colorama/0.4.4 importlib-metadata/6.8.0 keyring/24.3.0 pkginfo/1.9.6 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.28.2 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12

Release files / aiddl_external_ros2-0.2.2-py3-none-any.whl

Download URL aiddl_external_ros2-0.2.2-py3-none-any.whl
Size 17.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
decb3a65110337e0e192a627cdbe4feda41aad0bf0dd88d15e7d296f5532a979
BLAKE2b-256 checksum
How to use checksums
1e7825c69ee65cdf83d50b6576d8f92982053dea68ff46376fa85e49f4a148b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 colorama/0.4.4 importlib-metadata/6.8.0 keyring/24.3.0 pkginfo/1.9.6 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.28.2 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12

Security for aiddl-external-ros2 0.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page