Setting up pibs software on a Raspberry Pi

pib is controlled through a Raspberry Pi using the following software-stack:

  • Ubuntu Desktop

  • ROS2

  • Rosbridge Server

The software is set up as follows:

Describing the software-setup is part of this ticket:

https://pib-rocks.atlassian.net/browse/PR-72

Ubuntu

The default OS for pib is Ubuntu. The main reason is, that it is suggested to be used when installing ROS2. Since ROS2 will be a central software-component of pib, the OS-decision is derived from that.

There is a good tutorial to install Ubuntu on Raspberries:

https://ubuntu.com/tutorials/how-to-install-ubuntu-on-your-raspberry-pi#1-overview

As long as this tutorial works, there is no need to copy that information to here. As soon as this external tutorial does not work properly any more, we should extend our documentation here.

Notice:

We should choose Ubuntu Desktop 22.04.1 LTS for ROS2:

ROS2

We can follow this YouTube tutorial to install ROS2 Humble:

Intro: Install and Setup ROS2 Humble - ROS2 Tutorial 1 - YouTube

Official installation instruction from ROS which is mentioned in the video:

Ubuntu (Debian) — ROS 2 Documentation: Humble documentation

Notice:

We should install ROS-Base instead of ROS Desktop on Raspberries

Rosbridge Server

Rosbridge server allows us to connect robots with web browsers using WebSockets.

Here is a short tutorial showing us how to install and run a rosbridge server with a simple example:

Using Rosbridge with ROS 2 - Foxglove

Notice:

1. When it comes to creating a listener for /mytopic, you should use ‘new ROSLIB.Topic' instead of 'new ROSLIB.TOPIC’:

const my_topic_listener = new ROSLIB.Topic({ ros, name: "/my_topic", messageType: "std_msgs/String", });

2. When you are following the tutorial, please be aware that the command it uses to launch the Rosbridge WebSocket server may not work. In this case we could instead use:

ros2 launch rosbridge_server rosbridge_websocket_launch.xml

Nginx

1. Install Nginx:

sudo apt update sudo apt install nginx

2. Install npm:

2. Build Angular app in production mode:

3. Move to the folder “dist“, after the build is done:

4. Copy the folder “cerebra2” to the Nginx installtion directory:

4. Ngix Configuration:

Open /etc/nginx/nginx.conf and add the following server configuration under “http” section:

5. Restart Nginx:

Run the following command to restart Nginx:

You can check if there are no errors by running the following command: