GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - rclex/rclex: Rclex: ROS 2 Client Library for Elixir

BranchesTags
Open more actions menu

Latest commit

 

History

1,309 Commits
1,309 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
config
config
 
 
lib
lib
 
 
priv/templates/rclex.gen.msgs
priv/templates/rclex.gen.msgs
 
 
scripts
scripts
 
 
src
src
 
 
test
test
 
 
.formatter.exs
.formatter.exs
 
 
.gitignore
.gitignore
 
 
.tool-versions
.tool-versions
 
 
ARCHITECTURE.md
ARCHITECTURE.md
 
 
CHANGELOG.md
CHANGELOG.md
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
README_ja.md
README_ja.md
 
 
USE_ON_NERVES.md
USE_ON_NERVES.md
 
 
USE_ON_NO_ROS2_LINUX.md
USE_ON_NO_ROS2_LINUX.md
 
 
docker-compose.yml
docker-compose.yml
 
 
mix.exs
mix.exs
 
 
mix.lock
mix.lock
 
 

Repository files navigation

Hex version API docs License ci-latest ci-all_version

日本語のREADME

Rclex

Rclex is a ROS 2 client library for the functional language Elixir.

This library lets you perform basic ROS 2 behaviors by calling out from Elixir code into the RCL (ROS Client Library) API, which uses the ROS 2 common hierarchy.

Additionally, publisher-subscriber (PubSub) communication between nodes and associated callback functions are executed as Erlang lightweight processes. This enables the creation of and communication between a large number of fault-tolerant nodes while suppressing memory load.

What is ROS 2

ROS 2 (Robot Operating System 2) is a state-of-the-art Robot development platform. In ROS 2, each functional unit is exposed as a node, and by combining these nodes you can create different robot applications. Additionally, communication between nodes uses a PubSub model where publishers and subscribers exchange information by specifying a common topic name.

The main benefits of ROS 2 are that the DDS (Data Distribution Service) protocol was adopted for communication, and the library was divided into a hierarchical structure. This allows us to develop ROS 2 client libraries in various languages and, of course, to build robot applications in Elixir.

For details on ROS 2, see the official ROS 2 Documentation.

Recommended environment

Native environment

The basic and recommended environment is where the host (development) and the target (operation) are the same.

Currently, we use the following environment as the main development target:

  • Ubuntu 24.04 LTS (Noble Numbat)
  • ROS 2 Jazzy Jalisco
  • Elixir 1.19.5-otp-28
  • Erlang/OTP 28.5

We highly recommend using Jazzy Jalisco for ROS 2 LTS distribution. We also confirmed the operation of this library with the ROS 2 LTS distribution: Humble Hawksbill on Ubuntu 22.04 LTS, and Lyrical Luth on Ubuntu 26.04 LTS. As for STS which is currently supported, we also confirmed the operation with Kilted Kaiju. However, this STS distribution is not included in the CI tests on GHA.

We do not support ROS 2 Distributions that have already reached EOL in the development of the latest version. The last supported releases are as follows.

  • Foxy Fitzroy: v0.11.3
  • Galactic Geochelone: v0.11.3
  • Iron Irwini: v0.11.3

For other environments used to check the operation of this library, please refer to here.

Docker environment

The pre-built Docker images are available at Docker Hub. You can also try the power of Rclex with it easily. Please check "Docker Environment" section for details.

Nerves device (target)

rclex can be operated onto Nerves. In this case, you do not need to prepare the ROS 2 environment on the host computer to build Nerves project (so awesome!).

Please refer to Use on Nerves section and b5g-ex/rclex_on_nerves example repository for more details!

Linux without ROS 2 installed

rclex can also run on Linux environments where ROS 2 is not installed. In this case, you do not need to install a ROS 2 environment on the host.

Please refer to Use on no ROS 2 Linux section for details.

Features

Currently, the Rclex API allows for the following:

  1. The ability to create a large number of publishers sending to the same topic.
  2. The ability to create large numbers of each combination of publishers, topics, and subscribers.

You can find the API documentation at https://hexdocs.pm/rclex.

Please refer rclex/rclex_examples for the examples of usage along with the sample code.

How to use

This section explains the quickstart for rclex in the native environment where ROS 2 and Elixir have been installed.

Create the project

First of all, create the Mix project as a normal Elixir project.

mix new rclex_usage
cd rclex_usage

Install rclex

rclex is available in Hex.

You can install this package into your project by adding rclex to your list of dependencies in mix.exs:

  defp deps do
    [
      ...
      {:rclex, "~> 0.13.2"},
      ...
    ]
  end

After that, execute mix deps.get into the project repository.

mix deps.get

Setup the ROS 2 environment

source /opt/ros/jazzy/setup.bash

Configure ROS 2 message types you want to use

Rclex provides pub/sub-based topic communication using the message type defined in ROS 2. Please refer here for more details about message types in ROS 2.

The message types you want to use in your project can be specified in ros2_message_types in config/config.exs. Multiple message types can be specified separated by comma ,.

The following config/config.exs example wants to use String type.

import Config

config :rclex, ros2_message_types: ["std_msgs/msg/String"]

Then, execute the following Mix task to generate required definitions and files for message types.

mix rclex.gen.msgs

When editing config/config.exs to change the message types, do mix rclex.gen.msgs again.

Write Rclex code

Now, you can acquire the environment for Rclex API! Of course, you can execute APIs on IEx directly.

Here is the simplest implementation example lib/rclex_usage.ex that will publish the string to /chatter topic.

defmodule RclexUsage do
  alias Rclex.Pkgs.StdMsgs

  def publish_message do
    Rclex.start_node("talker")
    Rclex.start_publisher(StdMsgs.Msg.String, "/chatter", "talker")

    data = "Hello World from Rclex!"
    msg = struct(StdMsgs.Msg.String, %{data: data})

    IO.puts("Rclex: Publishing: #{data}")
    Rclex.publish(msg, "/chatter", "talker")
  end
end

Please also check the examples for Rclex.

  • rclex/rclex_examples

Build and Execute

Build your application as follows.

mix compile
iex -S mix

Operate the following command on IEx.

iex()> RclexUsage.publish_message
Rclex: Publishing: Hello World from Rclex!
:ok

You can confirm the above operation by subscribing with ros2 topic echo from the other terminal.

$ source /opt/ros/jazzy/setup.bash
$ ros2 topic echo /chatter std_msgs/msg/String
data: Hello World from Rclex!
---

Enhance devepoment experience

This section describes the information mainly for developers.

Docker environment

This repository provides a docker compose environment for library development with Docker.

As mentioned above, pre-built Docker images are available at Docker Hub, which can be used to easily try out Rclex. You can set the environment variable $RCLEX_DOCKER_TAG to the version of the target environment. Please refer to here for the available environments.

# optional: set to the target environment (default `latest`)
export RCLEX_DOCKER_TAG=latest
# create and start the container
docker compose up -d
# execute the container (with the workdir where this repository is mounted)
docker compose exec -w /root/rclex rclex_docker /bin/bash
# stop the container
docker compose down

In GitHub Actions, we perform CI on multiple tool versions at Pull Requests by using these Docker environments. However, we cannot guarantee operation in all of these environments.

Automatic execution of mix test, etc.

mix test.watch is introduced to automatically run unit test mix test and code formatting mix format every time the source code was edited.

$ mix test.watch
# or, run on docker by following
$ docker compose run --rm -w /root/rclex rclex_docker mix test.watch

Confirmation of communication operation

To check the operation, especially for communication features of this library, we prepare rclex/rclex_connection_tests to test the communication with the nodes implemented with Rclcpp.

cd /path/to/yours
git clone https://github.com/rclex/rclex
git clone https://github.com/rclex/rclex_connection_tests
cd /path/to/yours/rclex_connection_tests
./run-all.sh

Presentations

  • Rclex on Nerves: a bare minimum runtime platform for ROS 2 nodes in Elixir
    • ROSCon 2023
    • Video | SpeakerDeck
  • On the way to achieve autonomous node communication in the Elixir ecosystem
    • Code BEAM America 2022 at 2022/11/03
    • Video | SpeakerDeck
  • Rclex: A Library for Robotics meet Elixir
    • Code BEAM America 2021 at 2021/11/05
    • Video | SlideShare

Maintainers and developers (including past)

  • @takasehideki
  • @s-hosoai
  • @pojiro
  • @HiroiImanishi
  • @kebus426
  • @shiroro466

About

Rclex: ROS 2 Client Library for Elixir

hexdocs.pm/rclex

Topics

elixiriotpubsubrosros2

Resources

Readme
Apache-2.0 license
Activity
Custom properties

Stars

154 stars

Watchers

11 watching

Forks

14 forks
Report repository

Releases

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.