FogROS2-SGC is a cloud robotics platform for connecting disjoint ROS2 networks across different physical locations, networks, and Data Distribution Services.
Table of Contents
If you want to get a taste of FogROS2 SGC without setting up the environment, just run
docker compose build && docker compose up
with docker (install) and docker compose (install).
It takes some time to build. You will see two docker containers running talker
and listener
are connected securely with FogROS2-SGC.
The following are instructions of setting up FogROS2 SGC.
sudo apt update
sudo apt install build-essential curl pkg-config libssl-dev protobuf-compiler clang
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"
ROS2 Dashing Eloquent Foxy Galactic Humble Rolling should work fine with FogROS2 SGC.
Here we show the instruction of installing ROS2 rolling with Debian packages.
First, install ROS2 from binaries with these instructions.
Setup your environment with these instructions.
Every terminal should be configured with
source /opt/ros/rolling/setup.bash
If you have custom types in a specific ROS colcon directory, source
the setup.bash
in that directory.
Either you run it as a ROS node, or as a standalone process, you need to generate a certificate unique to the task as the globally unique identifier. This set of certificate should be shared by all the robots that you wish to be connected.
The certificates can be generated by
cd sgc_launch/configs
./generate_crypto.sh
Every directory in ./sgc_launch/configs/crypto
contains the cryptographic secrets needed for communication.
Distribute the crypto
directory by from machine A and machine B. This can be done with USB copying, typing or SSH. Here is an example with scp
:
scp -r crypto USER@MACHINE_B_IP_ADDR:/SGC_PATH/sgc_launch/configs/
replace USER
, MACHINE_B_IP_ADDR
, SGC_PATH
with the actual paths.
After the crypto secrets are delivered, go back to project main directory.
cd ~
mkdir -p fog_ws/src
cd ~/fog_ws/src
git clone https://github.com/KeplerC/fogros2-sgc.git
cd ~/fog_ws
colcon build
Please make sure that the repo is cloned directly under the src
directory.
Machine A:
ros2 launch sgc_launch talker.launch.py
Machine B:
ros2 launch sgc_launch listener.launch.py
Note that machine A and machine B do not need to configure any IP address, and they automatically connect.
Please refer to the README for writing the launch file for your application. FogROS2-SGC supports automatic topic discovery, but it is recommended to expose the public interface only if intended.
The repo can be built with
cargo run router
If you want to deploy with production system, use cargo build --release
option for optimization level and removal of debug logs.
To disable the logs and run with high optimization, run with release
option by
cargo run --release router
instead.
Adding and removing topics requires REST API. Example of such is
curl -X POST http://localhost:3000/topic \
-H 'Content-Type: application/json' \
-d '{"api_op":"add","ros_op":"pub", "crypto":"test_cert", "topic_name":"/chatter", "topic_type":"std_msgs/msg/String"}'
The port for the REST interface can be changed via SGC_API_PORT
environment variable.
The configuration is currently coded with a Berkeley's signaling server that facilitates the routing inforamtion exchange. See Making your own signaling server section for creating your own signaling server. The system should also work if you don't specify the configuration file, then it uses automatic mode that constantly checking for new topics. We note that it is only a convenient interface and not FogROS2-SGC is designed for. As long as the talker and listener use the same crypto, the system should work.
In the updated version, we removed all the setup about protocols, ports, ips and gateways. Previous FogROS2-SGC carries a bag of protocols to support heterogenous demands and requirements. In this version, we streamline the routing setup by webrtc instead of building all protocols with raw DTLS sockets. webrtc is generally not compatible with the previous protocol.
Berkeley's public servers are for experimental purposes and do not intend to be used for production system. We do not provide any guarantee on avaialbility. Please use your own signaling server for benchmarking and deployment. The security guarnatees of FogROS2-SGC prevents other users/Berkeley from learning sensitive information, such as your ROS2 topic name and type, and on the actual data payload. What is visible is a random 256 bit name are published and subscribed by other random 256 bit names.
If you don't want to use Berkeley's infrastructure, having one on your own is very easy. This can be done by running
docker compose up -d signal rib
The only requirement is to expose port 8000 and 8002 to other robots/machines.
Signaling server faciliates the communication by exchanging the address information of webrtc. The details about how signaling server works can be found HERE. Then update the config files by replacing the IP address to your server's IP address.
- expiration time for stale keys (this may happen if the subscriber suddenly drops off and does not connect to an existing publisher)
- in some rare cases, the IP address and port provided cannot connect, which blocks the publisher and subscriber. The common root cause is that the firewall bans the ports larger than 50000, which may happen in some enterprise or restrictive settings. If you have one side of the machine (like cloud) that opens the port greater than 50000, it should be able to connect.