ROSCon 2023
2023/10/19

ona bare minimum runtime platform for
ROS 2 nodes in Elixir
Hideki Takase, Shintaro Hosoai (The Univ. of Tokyo),
Ryota Kinukawa (Tombo Works), Shunsuke Kikuchi (SAKURA internet, Inc.)

A part of this work is supported by JST CREST JPMJCR21D2 andthe commissioned research (04001) by National Institute ofInformation and Communications Technology (NICT) , Japan.

Affiliation

Hobby@takasehideki

MissionRecent R&D

Topic: Rclex on Nerves
Functional
Language

Client Libraryfor Elixir

bare minimumand resilientruntime platform3

is awesome!!
node.cpp

node.pynode.rs

rclcpp

rclpy

rclrs

RCL (ROS Client Library)
RMW (ROS MiddleWare)
DDS A

DDS B
General Purpose OS……

• common functions for ROS 2• implemented by C
• any client library can be
implemented by calling it• Abstraction layer for DDS• Able to select preferred DDS(and Zenoh??)

Zenoh??
DDS (Data Distribution Service)• OMG standard specification• Pub/Sub communication functions• Automatic search of nodes by RTPS

4

ROS 2 Client Library for,,,node.cpp

node.pynode.rs

node.exrclcpp

rclpy

rclrs

Rclex

RCL (ROS Client Library)
RMW (ROS MiddleWare)DDS A

DDS BZenoh??

General Purpose OS5

We love Elixir!!
Functional language (appeared in 2012)
Operated on Erlang VM (BEAM)• lightweight processes with robustness• highly concurrency/parallelism• soft real-time feature• easy to realize distributed and fault tolerance system• Similar to Actor Model−Actors (processes) send and receive messages−"Let it Crash”: The problematic process should be
promptly crashed and restored immediately−We can spawn a massive number of processes!!

* The copyrights of these logosbelong to their respective creators

6

We love Elixir!!
Functional language (appeared in 2012)
Language Design based on Ruby
• easy to learn! familiar grammar and notation• very highly productive despite functional• high communication performance suitable for IoT
example Elixir code

Programming should be
about transforming data
 Data flow and parallel processing
can be described intuitively with
Enum Flow |>* The copyrights of these logos
belong to their respective creators

7

We love Elixir!!
• Awesome ecosystem!

* The copyrights of these logos
belong to their respective creators

8• Actors on BEAM send and receive messages−(I believe) Actor Model is suitable for robot systems

9

Simple Publisher by Rclex
create node byname and index
setting node info.
with pipe operator

numberof nodes
create topic:single-> one topic:multi-> multiple

set callback func
and timer interval

processing a data
message with Enumcreate list ofmessages foreach node

publish message

10

Rclex on Ubuntu

default ROS 2 env

Example of Rclex on Native Ubuntu

11

Developed by Nerves Project!
• Dedicated IoT Platform for Elixir−fully compatible with Elixir−useful libraries for IoT systems• bare-minimum!!

−too small (one linked fw, ~>30 MB)−portable and easy to configure• resilient!!

−of course, robust thanks to Erlang VM!!
−file system is duplicated and read-only for reliability

Master Boot Recordboot ALinux kernelboot B
Linux kernel
file system A
Erlang VM
libraries
file system B
Erlang VM
libraries
Application Data

on

Supported Targets
ROS_DISTRO
Foxy

arm64v8

arm32v713

onHow to try it out?

• Only 7 steps, just in 5 min (I hope,,,:D1.

create & prepare project for target$ mix nerves.new rclex_on_nerves --target rpi40

2.

Install Rclex into Nerves projectadd {:rclex, "~> 0.9.2"}, into mix.exs and $ mix deps.get0

3.

rootfsrootfsprepare ros2 resources to Nerves filesystem

4.

generate resources for msg types of topic comm.
$ mix rclex.gen.msgs0

5.
6.
7.

set LIBRARY_PATH into Nerves firmware
enjoy writing Rclex code!!
finally, build firmware, and burn to microSD

copy$ mix rclex.prep.ros2 --arch arm64v80…
/opt/ros/humble/*…
arm64v8/ros:
humble-ros-core/opt/ros/humble/include/opt/ros/humble/lib//opt/ros/humble/share

14

onBenefit!!

• For ROS developers−will acquire performance, especially in communication−will want to employ Elixir/Erlang ecosystem−will get a bare minimum and resilient environment!!

• For Elixir developers−will get autonomous communication−will utilize OSS packages published for ROS!!

MAY THE BEAM
BE WITHYOUR ROBOT!!

[pic]https://aliexpress.com/item/32604221183.html

15

論よりRUN!! The RUN is mightier than the word"ron yori run"Momo (WebRTC NativeClient) by Shiguredo

sensors

https://github.com/pojiro/rpi4_mouse/cmd_vel/sensors

control motors
Raspberry Pi Mouse V3by RT Corporation

16

論よりRUN!! The RUN is mightier than the word"ron yori run"

Actual behavior ofRPi Mouse
Phoenix Web Page on Nerves
for Sensor Values on RPi Mouse

Camera image
on RPi Mouse
sent by Momo

NervesConsoleOne More Thing??

Rclex on Nerves with Zenoh−Eloquent, Scalable, and Fast network protocol−The most promising candidate for a new Tier-1 RMW??
• Our Trial−Rclex msgs on Nerves go
beyond the Pacific Ocean!!
Code BEAM America 2023
[Slide] [YouTube] [demo(on X)]−(WiP) Zenohex [GitHub]

18

Wrapping Up• Rclex: Robotics meets Elixir!
−ROS will acquire Elixir’s performance−Elixir will utilize ROS packages
https://github.com/rclex/rclex• Ongoing/upcoming works−Service, Action and Parameter−actively integration with Zenoh−documentation, academic paper,,,STAR our repo! try it out!!
and, Give your contributions!!!
https://hex.pm/packages/rclex

19