Gabriel Aguiar Noury
on 5 June 2024
Welcome to this blog series which explores innovative uses of Ubuntu Core. Throughout this series, Canonical’s Engineers will show what you can build with this Core 24 release, highlighting the features and tools available to you.
In this fourth blog, Mirko Ferrati, engineering manager from our Robotics team, will show you how to deploy an observability and telemetry server with the corresponding clients in a robot. This observability system fine-tuned for robotics allows startups to quick-start remote supervision of their robot fleet, while mature companies will find the model easy to extend and adaptable to their needs. When combined with Ubuntu Core, this system offers roboticists an end-to-end infrastructure for managing a secure, modular deployment of their observability stack.
Scaling with robotics telemetry
If your project or your company has deployed some robots in different customer sites you may want to look at their behaviour and their metrics. The simplest solution is to connect to the device over some kind of virtual network and use ssh or a remote desktop viewer if you need a graphical interface.
There are more advanced and complete open-source solutions, and you will see how easy it is to set up both the server and the applications needed to run inside the robot. Here are the tools we selected to build our observability system.
Grafana is a complete framework for collecting and recording system statistics such as CPU and RAM usage in a database. It also has a web front end with a complete set of visualisation tools.
Foxglove is the standard for streaming and visualising data from your robot into a webpage. It also has basic support for teleoperating the robot from the browser itself.
Rosbags are the default solution for recording historical data from the ROS ecosystem. When coupled to an uploader script and a file webserver you get access to the robot’s past data in the same web browser as the other tools!
Architecture of the robotics telemetry and observability system
The three tools above are based on a similar set of concepts:
- One client application runs in the robot, collecting data and sending it to a remote server over an encrypted connection.
- A remote database that can store the data.
- A web server that serves the data in a nice UI to any client connecting to it.
The concepts are shown in the picture below.
Deploying a full observability suite with Juju and Ubuntu Core
Now let’s take a look at the steps required to deploy the observability stack for your fleet of Ubuntu Core robots. We’ll start from the setup of the server side, and then take a look at how to configure your robot to communicate with it.
The server side relies on Juju and Microk8s. Juju is an open source orchestration engine for software operators that enables the deployment, integration and lifecycle management of applications at any scale, on any infrastructure using charms. Microk8s provides a lightweight and easy-to-install Kubernetes cluster. Juju can leverage Microk8s as a cloud environment for deploying Kubernetes-based applications simplifying the deployment process. With Juju you can deploy the portfolio of applications mentioned in the section before in a server with just one command.
The robot side relies on Snaps for the installation of the agents required to interface and communicate with the telemetry server. An overview of the available snaps and their description is provided.
Now let’s dive into it!
Deploy the observability for robotics bundle in the server
To begin, you will need a computer that will act as a server, with either Ubuntu Desktop or Ubuntu Server installed. Once your server is ready, let’s make sure to set it up with Juju and K8s, you can get more details here. For this to work correctly, the dns
, hostpath-storage
and metallb
add-ons will have to be enabled.
Once Juju is installed, we can proceed by creating a Juju model that will contain all of our observability applications and their integration. Let’s create a dedicated model for the bundle with the following:
juju add-model my-juju-model
juju switch my-juju-model
Juju applications can be deployed by means of bundles, which are a collection of integrated charms. The robotics overlay is a Juju overlay that extends the COS lite bundle with applications and integrations tailored for Robotics. Let’s now download the robotics overlay and deploy it:
curl -L https://raw.githubusercontent.com/ubuntu-robotics/rob-cos-overlay/main/robotics-overlay.yaml -O
juju deploy cos-lite --trust --overlay ./robotics-overlay.yaml
Now the server applications are good to go. You can register devices to it and begin the monitoring!
Deploy the observability for robotics snaps in the robot
The best way to enjoy Ubuntu Core is by creating your own image as described in here. Once your robot is set up with Ubuntu, make sure to install the necessary snaps:
- cos-registration-agent: responsible for registering the robot on the cos-registration-server as well as uploading robot-specific data to the server (dashboard, Foxglove layouts, UID, etc).
- ros2-exporter-agent: responsible for recording data on the robot and syncing them to the Ros2BagFileserver.
- grafana-agent: responsible for sending metrics, logs, and trace data to the Grafana charm.
- foxglove-bridge: a bridge to visualise live ROS data via the Foxglove WebSocket connection.
- rob-cos-data-sharing: a data sharing snap for on-device robotics observability snaps.
You will also need some configuration snap. For more information, see this demo rob-cos-demo-configuration which contains an example configuration for a mobile robot.
Once the snaps are installed, they will register to the server and start sending historical data for storing into databases. They will also live stream data to the Foxglove UI if a client opens it.
Open the web GUI on your laptop
You can open the browser and reach the server’s main page by pointing your browser to the IP address of the Juju model. Find the IP address by using the following command in your server:
juju run traefik/0 show-proxied-endpoints | grep catalogue
That’s it.
Now you can focus on your development and not worry about the infrastructure to remotely teleoperate and observe robots on the field.
What’s next?
Since the entire system is open-source and extendable, you could charm your own observability tools and integrate them into the Juju model above, just open the repository and fork our yaml configuration overlay for robotics! If you want to get the most out of the setup, you can follow our snap tutorials to integrate the clients’ apps on your robot in the snap ecosystem.
Why don’t you try packaging your entire ROS applications using snaps? Through this method, you can use the infrastructure to manage and deploy software at the edge. Additionally, you can use Ubuntu Core to build your production image with your snaps and targeted hardware. This will allow you to easily flash devices in production lines. Plus in your image, you can define what applications you want and add a full ready-to-use observability and telemetry stack as standalone snaps!