About Robonomics ROS 2 Wrapper

In this article, you will learn about the Robonomics ROS 2 Wrapper package, which allows you to use all the features of the Robonomics parachain for any ROS 2 compatible robot.

The idea of ​​the package is to wrapping the Robonomics parachain API provided by robonomics-interface into nodes of ROS 2. The goal is to provide ROS 2 developers with a convenient way to integrate their robots or devices with parachain features. The logic behind the integration of a robotic device is that a unique address is created for it in the Robonomics parachain, which is used to control the device or receive its telemetry.

Available features include:

  • Launch function — launching a device to execute any command with a specified set of parameters passed as a string or a file.
  • Datalog function — publishing device telemetry in a form of hash to parachain.
  • Usage of Robonomics subscription — the ability to send transactions without a fee.
  • Secure file storage — to pack and unpack data, InterPlanetary File System is used, which allows to access files by their unique hash. For convenient usage of IPFS, Pinata support included, which allows to pin IPFS files for fast downloading.
  • File encryption and decryption — protection of files with public key encryption.

Currently, the wrapper is available in Python implementation.

Wrapper Architecture

Architecturally, the wrapper consists of a worker node (with the necessary topics and services) and a basic node class that can be used for your specific robots.

ROS 2 Wrapper Architecture
  • robonomics_ros2_pubsub — a unique node for each robot that serve as an entrance point to Web3. It wraps the services for sending datalogs and receiving launches via Robonomics and allows files to be downloaded/uploaded to IPFS. This node is configured by a special file, which is described below. A node’s affiliation with a specific robot can be specified via the ROS namespace.
  • robonomics_ros2_robot_handler — a robot-specific node based on a basic class basic_robonomics_handler for coordinating pubsub and the robot. It processes launches and decides when to send datalogs for controlling the robot.

Installing the Wrapper

To work with the wrapper you need the following software:

  • Linux OS distribution (usually, Ubuntu)
  • ROS 2 distribution
  • IPFS node
  • Python 3 (for Python implementation of the wrapper)

Please follow the installation guide available here and check needed versions of the software. After downloading the required components, you will need to build the wrapper as a usual ROS 2 package using the colcon utility.

Configuring Connections to Web3 Cloud

Before starting wrapper, you need to set up how exactly your robot will connect to the decentralized Robonomics cloud and supporting Web3 services. To do this, you need to edit the file a configuration file called robonomics_pubsub_params_template.yaml, which must be unique for each launched robot that needs to access Robonomics.

The file contains the following configuration fields:

FieldDescription
account_seedAccount seed of Robonomics parachain
crypto_typeType of your account, ED25519 or SR25519
remote_node_urlRobonomics node url, default is wss://kusama.rpc.robonomics.network, for local node ws://127.0.0.1:9944
rws_owner_addressAn address of Robonomics subscription owner to use RWS module
ipfs_dir_pathA path of directory to contain IPFS files
ipfs_gatewayIPFS gateway to download files, e.g. https://ipfs.io
pinata_api_keyAPI key from Pinata pinning service for IPFS
pinata_api_secret_keySecret API key from Pinata pinning service for IPFS

To create an account on the Robonomics parachain, please use the following guide on our wiki. Please pay attention to the type of account you create, as accounts with SR25519 type cannot use file encryption.


Warning

The seed phrase is sensitive information that allows anyone to use your account. Make sure you don’t upload a config file with it to GitHub or anywhere else.

Pay attention to the remote_node_url field, as it allows you to choose how exactly to connect to the Robonomics parachain, including locally. You can deploy your local Robonomics instance for testing and development. Instructions on how to do this are available in this article on our wiki.

If you have a Robonomics subscription that allows you to send transactions without fees, please insert the address of the subscription owner to the rws_owner_address field. Don’t forget that your account must be added to your subscription. Instructions on how to activate your Robonomics subscription are available in two guides: via Robonomics dapp with user-friendly interface or via Robonomics Substrate portal.

The ipfs_gateway parameter allows you to specify the gateway through which IPFS files will be downloaded. These can be either public gateways or specialized private ones (for example, those obtained on Pinata)

Couldn't complete

Thanks,
we'll keep in touch!

It was hard

Thanks,
we'll keep in touch!

It was ok

Thanks,
we'll keep in touch!

It was easy

Thanks,
we'll keep in touch!
Main contributors: @Fingerling42
Make a contribution

Robonomics wiki is open source. See something that's wrong or unclear? Submit a pull request.

? Ask your question