Skip to main content

Python ROS Bridge library allows to use Python and IronPython to interact with ROS, the open-source robotic middleware. It uses WebSockets to connect to rosbridge 2.0 and provides publishing, subscribing, service calls, actionlib, TF, and other essential ROS functionality.

Unlike the rospy library, this does not require a local ROS environment, allowing usage from platforms other than Linux.

The API of roslibpy is modeled to closely match that of roslibjs.

Main features

  • Topic publishing and subscribing.

  • Service calls (client).

  • Service advertisement (server).

  • ROS parameter management (get/set/delete).

  • ROS API services for getting ROS meta-information.

  • Actionlib support for interfacing with preemptable tasks.

  • TF Client via the tf2_web_republisher.

Roslibpy runs on Python 3.x and IronPython 2.7.

Installation

To install roslibpy, simply use pip:

pip install roslibpy

For IronPython, the pip command is slightly different:

ipy -X:Frames -m pip install --user roslibpy

Remember that you will need a working ROS setup including the rosbridge server and TF2 web republisher accessible within your network.

Documentation

The full documentation, including examples and API reference is available on readthedocs.

Contributing

Make sure you setup your local development environment correctly:

  • Clone the roslibpy repository.

  • Create a virtual environment.

  • Install development dependencies:

pip install -r requirements-dev.txt

You’re ready to start coding!

During development, use pyinvoke tasks on the command prompt to ease recurring operations:

  • invoke clean: Clean all generated artifacts.

  • invoke check: Run various code and documentation style checks.

  • invoke docs: Generate documentation.

  • invoke test: Run all tests and checks in one swift command.

  • invoke: Show available tasks.

For more details, check the Contributor’s Guide available as part of the documentation.

The default branch was recently renamed to main. If you’ve already cloned this repository, you’ll need to update your local repository structure with the following lines:

git branch -m master main
git fetch origin
git branch -u origin/main main

Releasing this project

Ready to release a new version roslibpy? Here’s how to do it:

  • We use semver, i.e. we bump versions as follows:

    • patch: bugfixes.

    • minor: backwards-compatible features added.

    • major: backwards-incompatible changes.

  • Update the CHANGELOG.rst with all novelty!

  • Ready? Release everything in one command:

invoke release [patch|minor|major]
  • Profit!

Credits

This library is based on roslibjs and to a large extent, it is a line-by-line port to Python, changing only where a more idiomatic form makes sense, so a huge part of the credit goes to the roslibjs authors.

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

1.2.0

Changed

  • Changed behavior: Advertising services automatically reconnect when websockets is reconnected.

  • References to ROS master change to ROS.

Added

  • Added Header and Time data types.

  • Added ROS API method to retrieve current ROS time: ros.get_time.

1.1.0

Added

  • Added set_initial_delay, set_max_delay and set_max_retries to RosBridgeClientFactory to control reconnection parameters.

  • Added closing event to Ros class that gets triggered right before closing the connection.

1.0.0

Changed

  • Changed behavior: Topics automatically reconnect when websockets is reconnected

Added

  • Added blocking behavior to more ROS API methods: ros.get_nodes and ros.get_node_details.

  • Added reconnection support to IronPython implementation of websockets

  • Added automatic topic reconnection support for both subscribers and publishers

Fixed

  • Fixed reconnection issues on the Twisted/Autobahn-based implementation of websockets

0.7.1

Fixed

  • Fixed blocking service calls for Mac OS

0.7.0

Changed

  • The non-blocking event loop runner run() now defaults to 10 seconds timeout before raising an exception.

Added

  • Added blocking behavior to ROS API methods, e.g. ros.get_topics.

  • Added command-line mode to ROS API, e.g. roslibpy topic list.

  • Added blocking behavior to the Param class.

  • Added parameter manipulation methods to Ros class: get_param, set_param, delete_param.

0.6.0

Changed

  • For consistency, timeout parameter of Goal.send() is now expressed in seconds, instead of milliseconds.

Deprecated

  • The timeout parameter of ActionClient() is ignored in favor of blocking until the connection is established.

Fixed

  • Raise exceptions when timeouts expire on ROS connection or service calls.

Added

  • Support for calling a function in a thread from the Ros client.

  • Added implementation of a Simple Action Server.

0.5.0

Changed

  • The non-blocking event loop runner now waits for the connection to be established in order to minimize the need for on_ready handlers.

Added

  • Support blocking and non-blocking service calls.

Fixed

  • Fixed an internal unsubscribing issue.

0.4.1

Fixed

  • Resolve reconnection issues.

0.4.0

Added

  • Add a non-blocking event loop runner

0.3.0

Changed

  • Unsubscribing from a listener no longer requires the original callback to be passed.

0.2.1

Fixed

  • Fix JSON serialization error on TF Client (on Python 3.x)

0.2.0

Added

  • Add support for IronPython 2.7

Changed

  • Handler on_ready now defaults to run the callback in thread

Deprecated

  • Rename run_event_loop to the more fitting run_forever

0.1.1

Fixed

  • Minimal documentation fixes

0.1.0

Added

  • Initial version

Release files for roslibpy 1.2.0

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

Source distribution (sdist)

Source distribution for roslibpy 1.2.0
File Size Uploaded
roslibpy-1.2.0.tar.gz 136.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for roslibpy 1.2.0
File Interpreter ABI Platform
roslibpy-1.2.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 173.2 kB

Release files / roslibpy-1.2.0.tar.gz

Download URL roslibpy-1.2.0.tar.gz
Size 136.0 kB
Tags Source
SHA-256 checksum
How to use checksums
abc767e00f8e0a045b143fd829977ac4cd2a56175f2849a7dfd5140b3c6ce60b
BLAKE2b-256 checksum
How to use checksums
a98d20a7f30ae0e2c50498d753adf678001f04f674d8f58a5f42e9885d840bfe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1

Release files / roslibpy-1.2.0-py2.py3-none-any.whl

Download URL roslibpy-1.2.0-py2.py3-none-any.whl
Size 37.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
41b352d679a930a976163f962713697ad3cc531c588e7d00e99fbb14596002da
BLAKE2b-256 checksum
How to use checksums
468bddaecbab568e0f9fe92ac80653eaf07f96c545e6fff2664e5214d85012b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1

Release history Release notifications | RSS feed

2.1.0

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.8.1

2 release files

1.8.0

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.1

2 release files

This release

1.2.0 This release

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

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