ros2bridge


Nameros2bridge JSON
Version 0.2.6 PyPI version JSON
download
home_pagehttps://github.com/bonnybabukachappilly/ros2bridge
SummaryA bridge between websocket and DDS of ROS 2
upload_time2023-08-05 14:07:57
maintainer
docs_urlNone
authorBonny Babu
requires_python>=3.8
licenseGNU GENERAL PUBLIC LICENSE Version 3
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ROS WEBSOCKET BRIDGE

![version](https://img.shields.io/badge/Version-ROS%202%20FOXY-informational)
![license](https://img.shields.io/badge/license-GNU%20v3.0-blue)

## Overview

This is a package for converting ROS 2 DDS to WebSocket. This project was inspired by [rosbridge_suite](https://github.com/RobotWebTools/rosbridge_suite) by [Robo Web Tools](https://github.com/RobotWebTools). The implemented features are not for specific topics or services but all available ros interfaces. It's in early development, and not all interfaces are tested. Any bug reported will be fixed in upcoming releases.

When using the suite, I faced issues with ROS 2 and couldn't find a way to move forward. So I decided to create another which is not advanced as the suite but gets my job done. I decided to package it and publish it on PyPI for easy availability to others and for learning purposes. The code I use is different, and the features are not the same. The client libraries for the suite won't work because this is not a suite clone.

**Note: This project is not a suite clone. The architecture and implementation are different. Not all the features of the suite are not available in this project.**

## Requirements

----

* Ubuntu 20.04
* Python 3.8
* ROS 2 Foxy

## Installation

----

```bash
pip3 install ros2bridge
```

## Usage

----

```bash
python3 -m ros2bridge

```

**optional parameters:**

* -p, --port: For specific port. Default is 9020
* -n, --ngrok: WebSocket is hosted on local IP by default. If this flag is set ws are hosted internally

**NOTE: for using custom ros interface source that workspace before running the bridge.**

## Available ROS Interfaces

----

* Publisher
* Subscriber
* Service Client
* Action Client

**TODO:**
* Service Server
* Action Server

## Request structure

----

### Publisher

```json
{
    "operation": "publish",
    "topic": "/<topic_name>",
    "type": "<message_parent>/<message_type>",
    "message": "<message>"
}
```

* type eg: 'std_msgs/String'
* message eg: {"data": "HELLO WORLD !"}
* NOTE: the message should be in the format of the message type

### Subscriber

```json
{
    "operation": "subscribe",
    "topic": "/<topic_name>",
    "type": "<message_parent>/<message_type>",
}
```

* type eg: 'std_msgs/String'

NOTE: Subscribed messages will return in this format.

```json

{
    "operation": "subscribe",
    "topic": "/<topic_name>",
    "type": "<message_parent>/<message_type>",
    "message": "<message>"
}
```

* type eg: 'std_msgs/String'
* message eg: {"data": "HELLO WORLD !"}

NOTE: To unsubscribe from a topic send the following message to the server

```json
{
    "operation": "subscribe",
    "topic": "/<topic_name>",
    "type": "<message_parent>/<message_type>",
    "unsubscribe": true
}
```

* type eg: 'std_msgs/String'

### SERVICE CLIENT

For creating a service client

```json
{
    "operation": "srv_client",
    "action": "create",
    "srv_name": "/<service_name>",
    "srv_type": "<service_parent>/<service_type>"
}
```

For calling a service client

```json
{
    "operation": "srv_client",
    "action": "call",
    "srv_name": "/<service_name>",
    "srv_type": "<service_parent>/<service_type>",
    "message": "<message>"

}
```

* NOTE: the message should be in the format of the service type

### ACTION CLIENT

For creating an action client

```json
{
    "operation": "action_client",
    "action": "create",
    "action_name": "/<action_name>",
    "action_type": "<action_parent>/<action_type>"
}
```

For calling an action client

```json
{
    "operation": "action_client",
    "action": "call",
    "action_name": "/<action_name>",
    "action_type": "<action_parent>/<action_type>",
    "message": "<message>"
}
```

* NOTE: the message should be in the format of action type

Feedback from calling an action client

```json
{
    "operation": "action_client",
    "action": "call",
    "action_response": "<action_response>",
    "action_name": "/<action_name>",
    "action_type": "<action_parent>/<action_type>",
    "message": "<message>"

}
```

* NOTE: the message should be in the format of action type.
* NOTE: action_response will be any of 'response', 'feedback', or 'result'.

### QOS PROFILE

I added a QoS profile to the subscription.
No validation of QoS is added and no error is sent back to the client.

Available QoS settings for subscribers:

* QoSReliabilityPolicy
* QoSDurabilityPolicy
* QoSHistoryPolicy

For creating a Qos Profile add the following in addition to the above request syntax

```json
"qos": {
    "durability": "<durability>",
    "reliability": "<reliability>",
    "history": "<history>",
}
```

For options to provide please refer [to this docs]('https://docs.ros.org/en/rolling/Concepts/About-Quality-of-Service-Settings.html)

A general request will look like

```json
{
    "operation": "subscribe",
    "topic": "/<topic_name>",
    "type": "<message_parent>/<message_type>",
    "qos": {
        "durability": "<durability>",
        "reliability": "<reliability>",
        "history": "<history>",
    }
}
```

## Testing

----

For testing using tox, the ROS package is required and I haven't found a way to get around it. So testing within the system.

* MYPY
* FLAKE8
* PYTEST



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/bonnybabukachappilly/ros2bridge",
    "name": "ros2bridge",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "",
    "author": "Bonny Babu",
    "author_email": "bonnybabukachappilly@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/be/e1/dc87435a5d3f0842d12d820692ef142c20f72290e8fb69a8557bbce28df0/ros2bridge-0.2.6.tar.gz",
    "platform": null,
    "description": "# ROS WEBSOCKET BRIDGE\n\n![version](https://img.shields.io/badge/Version-ROS%202%20FOXY-informational)\n![license](https://img.shields.io/badge/license-GNU%20v3.0-blue)\n\n## Overview\n\nThis is a package for converting ROS 2 DDS to WebSocket. This project was inspired by [rosbridge_suite](https://github.com/RobotWebTools/rosbridge_suite) by [Robo Web Tools](https://github.com/RobotWebTools). The implemented features are not for specific topics or services but all available ros interfaces. It's in early development, and not all interfaces are tested. Any bug reported will be fixed in upcoming releases.\n\nWhen using the suite, I faced issues with ROS 2 and couldn't find a way to move forward. So I decided to create another which is not advanced as the suite but gets my job done. I decided to package it and publish it on PyPI for easy availability to others and for learning purposes. The code I use is different, and the features are not the same. The client libraries for the suite won't work because this is not a suite clone.\n\n**Note: This project is not a suite clone. The architecture and implementation are different. Not all the features of the suite are not available in this project.**\n\n## Requirements\n\n----\n\n* Ubuntu 20.04\n* Python 3.8\n* ROS 2 Foxy\n\n## Installation\n\n----\n\n```bash\npip3 install ros2bridge\n```\n\n## Usage\n\n----\n\n```bash\npython3 -m ros2bridge\n\n```\n\n**optional parameters:**\n\n* -p, --port: For specific port. Default is 9020\n* -n, --ngrok: WebSocket is hosted on local IP by default. If this flag is set ws are hosted internally\n\n**NOTE: for using custom ros interface source that workspace before running the bridge.**\n\n## Available ROS Interfaces\n\n----\n\n* Publisher\n* Subscriber\n* Service Client\n* Action Client\n\n**TODO:**\n* Service Server\n* Action Server\n\n## Request structure\n\n----\n\n### Publisher\n\n```json\n{\n    \"operation\": \"publish\",\n    \"topic\": \"/<topic_name>\",\n    \"type\": \"<message_parent>/<message_type>\",\n    \"message\": \"<message>\"\n}\n```\n\n* type eg: 'std_msgs/String'\n* message eg: {\"data\": \"HELLO WORLD !\"}\n* NOTE: the message should be in the format of the message type\n\n### Subscriber\n\n```json\n{\n    \"operation\": \"subscribe\",\n    \"topic\": \"/<topic_name>\",\n    \"type\": \"<message_parent>/<message_type>\",\n}\n```\n\n* type eg: 'std_msgs/String'\n\nNOTE: Subscribed messages will return in this format.\n\n```json\n\n{\n    \"operation\": \"subscribe\",\n    \"topic\": \"/<topic_name>\",\n    \"type\": \"<message_parent>/<message_type>\",\n    \"message\": \"<message>\"\n}\n```\n\n* type eg: 'std_msgs/String'\n* message eg: {\"data\": \"HELLO WORLD !\"}\n\nNOTE: To unsubscribe from a topic send the following message to the server\n\n```json\n{\n    \"operation\": \"subscribe\",\n    \"topic\": \"/<topic_name>\",\n    \"type\": \"<message_parent>/<message_type>\",\n    \"unsubscribe\": true\n}\n```\n\n* type eg: 'std_msgs/String'\n\n### SERVICE CLIENT\n\nFor creating a service client\n\n```json\n{\n    \"operation\": \"srv_client\",\n    \"action\": \"create\",\n    \"srv_name\": \"/<service_name>\",\n    \"srv_type\": \"<service_parent>/<service_type>\"\n}\n```\n\nFor calling a service client\n\n```json\n{\n    \"operation\": \"srv_client\",\n    \"action\": \"call\",\n    \"srv_name\": \"/<service_name>\",\n    \"srv_type\": \"<service_parent>/<service_type>\",\n    \"message\": \"<message>\"\n\n}\n```\n\n* NOTE: the message should be in the format of the service type\n\n### ACTION CLIENT\n\nFor creating an action client\n\n```json\n{\n    \"operation\": \"action_client\",\n    \"action\": \"create\",\n    \"action_name\": \"/<action_name>\",\n    \"action_type\": \"<action_parent>/<action_type>\"\n}\n```\n\nFor calling an action client\n\n```json\n{\n    \"operation\": \"action_client\",\n    \"action\": \"call\",\n    \"action_name\": \"/<action_name>\",\n    \"action_type\": \"<action_parent>/<action_type>\",\n    \"message\": \"<message>\"\n}\n```\n\n* NOTE: the message should be in the format of action type\n\nFeedback from calling an action client\n\n```json\n{\n    \"operation\": \"action_client\",\n    \"action\": \"call\",\n    \"action_response\": \"<action_response>\",\n    \"action_name\": \"/<action_name>\",\n    \"action_type\": \"<action_parent>/<action_type>\",\n    \"message\": \"<message>\"\n\n}\n```\n\n* NOTE: the message should be in the format of action type.\n* NOTE: action_response will be any of 'response', 'feedback', or 'result'.\n\n### QOS PROFILE\n\nI added a QoS profile to the subscription.\nNo validation of QoS is added and no error is sent back to the client.\n\nAvailable QoS settings for subscribers:\n\n* QoSReliabilityPolicy\n* QoSDurabilityPolicy\n* QoSHistoryPolicy\n\nFor creating a Qos Profile add the following in addition to the above request syntax\n\n```json\n\"qos\": {\n    \"durability\": \"<durability>\",\n    \"reliability\": \"<reliability>\",\n    \"history\": \"<history>\",\n}\n```\n\nFor options to provide please refer [to this docs]('https://docs.ros.org/en/rolling/Concepts/About-Quality-of-Service-Settings.html)\n\nA general request will look like\n\n```json\n{\n    \"operation\": \"subscribe\",\n    \"topic\": \"/<topic_name>\",\n    \"type\": \"<message_parent>/<message_type>\",\n    \"qos\": {\n        \"durability\": \"<durability>\",\n        \"reliability\": \"<reliability>\",\n        \"history\": \"<history>\",\n    }\n}\n```\n\n## Testing\n\n----\n\nFor testing using tox, the ROS package is required and I haven't found a way to get around it. So testing within the system.\n\n* MYPY\n* FLAKE8\n* PYTEST\n\n\n",
    "bugtrack_url": null,
    "license": "GNU GENERAL PUBLIC LICENSE Version 3",
    "summary": "A bridge between websocket and DDS of ROS 2",
    "version": "0.2.6",
    "project_urls": {
        "Homepage": "https://github.com/bonnybabukachappilly/ros2bridge"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bd3a54c9c52d1b9ab6206986f7a5498a0b0e01ea699d4d03abd69b1d310f9ca9",
                "md5": "9780181f8b0f07493cb3796c55873b9c",
                "sha256": "b98f07340f2b121c93983045cd160e05eaa7772e54adacb0fc04ed6810785ece"
            },
            "downloads": -1,
            "filename": "ros2bridge-0.2.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9780181f8b0f07493cb3796c55873b9c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 17490,
            "upload_time": "2023-08-05T14:07:54",
            "upload_time_iso_8601": "2023-08-05T14:07:54.858446Z",
            "url": "https://files.pythonhosted.org/packages/bd/3a/54c9c52d1b9ab6206986f7a5498a0b0e01ea699d4d03abd69b1d310f9ca9/ros2bridge-0.2.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bee1dc87435a5d3f0842d12d820692ef142c20f72290e8fb69a8557bbce28df0",
                "md5": "51b7aa76a273009a86e6af36e834f64b",
                "sha256": "24dde0acfe8612f1ab9b4cd74c42a2f1dbbf9dbe4bd14d1d5463e7759b0d26db"
            },
            "downloads": -1,
            "filename": "ros2bridge-0.2.6.tar.gz",
            "has_sig": false,
            "md5_digest": "51b7aa76a273009a86e6af36e834f64b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 37410,
            "upload_time": "2023-08-05T14:07:57",
            "upload_time_iso_8601": "2023-08-05T14:07:57.249920Z",
            "url": "https://files.pythonhosted.org/packages/be/e1/dc87435a5d3f0842d12d820692ef142c20f72290e8fb69a8557bbce28df0/ros2bridge-0.2.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-05 14:07:57",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "bonnybabukachappilly",
    "github_project": "ros2bridge",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "tox": true,
    "lcname": "ros2bridge"
}
        
Elapsed time: 0.15870s