Repository Summary

Checkout URI https://github.com/42dot/foros.git
VCS Type git
VCS Version humble
Last Updated 2023-01-04
Dev Status MAINTAINED
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Packages

Name Version
foros 0.4.1
foros_examples 0.4.1
foros_inspector 0.4.1
foros_msgs 0.4.1

README

FOROS : Failover ROS framework

License Build Status Coverity Scan Build Status

Purpose

FOROS is a ROS2 framework that provides the ability to construct a active-standby cluster based on the RAFT consensus algorithm.

Key Features

| Feature | Description | | —————– | ———————————————————————— | | Node Redundancy | Maintain a cluster of nodes runing in parallel to acheive a common goal. | | State Replication | Replicate a state of nodes for implementing a fault-tolerant service. |

Goals

This framework can tolerate fail-stop failures equal to the cluster size minus the quorum. | Cluster size (N) | Quorum (Q = N / 2 + 1) | Number of fault tolerant nodes (N - Q) | | :————–: | :——————–: | :————————————: | | 1 | 1 | 0 | | 2 | 2 | 0 | | 3 | 2 | 1 | | 4 | 3 | 1 | | 5 | 3 | 2 |

Prerequisites (Ubuntu)

Install ROS2

Supported distributions | OS | Distribution | Foros branch | | ———— | ——————————————— | ———— | | Ubuntu 20.04 | galactic | galactic | | Ubuntu 22.04 | humble | humble |

Install Foros

Option 1. Install Official Packages

for galactic

sudo apt install ros-galactic-foros ros-galactic-foros-examples ros-galactic-foros-inspector

for humble

sudo apt install ros-humble-foros ros-humble-foros-examples ros-humble-foros-inspector

Option 2. Build From Source

Install dependencies

sudo apt install libleveldb-dev libncurses-dev

Build

If you want to install to existing ROS2 workspace, please clone this source in the workspace in advance.

. /opt/ros/galactic/setup.bash
colcon build

Getting Started

In this section, we will create a cluster of 3 nodes that publishes a node ID every second. Lets’ assume that, | Cluster Name | Cluster Size | Node IDs in the Cluster | Topic Name | | :————-: | :———-: | :———————: | :————-: | | “hello_cluster” | 3 | 0, 1, 2 | “hello_cluster” |

1) Setup Environment

. /opt/ros/galactic/setup.bash
# If foros is installed in the custom workspace,
. {custom workspace}/install/setup.bash

2) Create ROS2 package

Let’s create the hello_cluster package that depends on foros, rclcpp, and std_msgs.

ros2 pkg create hello_cluster --description "Hello Cluster" --build-type ament_cmake --dependencies foros rclcpp std_msgs

3) Create “src/hello_cluster.cpp”

Most of the code is the same as the general ros2 code, except that the akit::failover::foros::ClusterNode class is used instead of rclcpp::Node when creating a node. Unlike rclcpp::Node that receives a node name as an argument, akit::failover::foros::ClusterNode receives a cluster name, node ID, and IDs of all nodes in the cluster as arguments. In fact, the node name of a cluster node is internally created by combining the cluster name and node ID.

For instance, if cluster name is “hello_cluster” and node id is 0, node name is created as “hello_cluster0”

```cpp // hello-cluster.cpp #include #include <rclcpp/rclcpp.hpp> #include <std_msgs/msg/string.hpp> #include #include

#include “akit/failover/foros/cluster_node.hpp”

using namespace std::chrono_literals;

File truncated at 100 lines see the full file

Repo symbol

foros repository

Repo symbol

foros repository

Repo symbol

foros repository

Repo symbol

foros repository

Repo symbol

foros repository

Repo symbol

foros repository

Repo symbol

foros repository

Repo symbol

foros repository

Repository Summary

Checkout URI https://github.com/42dot/foros.git
VCS Type git
VCS Version galactic
Last Updated 2023-01-04
Dev Status MAINTAINED
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Packages

Name Version
foros 0.4.1
foros_examples 0.4.1
foros_inspector 0.4.1
foros_msgs 0.4.1

README

FOROS : Failover ROS framework

License Build Status Coverity Scan Build Status

Purpose

FOROS is a ROS2 framework that provides the ability to construct a active-standby cluster based on the RAFT consensus algorithm.

Key Features

| Feature | Description | | —————– | ———————————————————————— | | Node Redundancy | Maintain a cluster of nodes runing in parallel to acheive a common goal. | | State Replication | Replicate a state of nodes for implementing a fault-tolerant service. |

Goals

This framework can tolerate fail-stop failures equal to the cluster size minus the quorum. | Cluster size (N) | Quorum (Q = N / 2 + 1) | Number of fault tolerant nodes (N - Q) | | :————–: | :——————–: | :————————————: | | 1 | 1 | 0 | | 2 | 2 | 0 | | 3 | 2 | 1 | | 4 | 3 | 1 | | 5 | 3 | 2 |

Prerequisites (Ubuntu)

Install ROS2

Supported distributions | OS | Distribution | Foros branch | | ———— | ——————————————— | ———— | | Ubuntu 20.04 | galactic | galactic | | Ubuntu 22.04 | humble | humble |

Install Foros

Option 1. Install Official Packages

for galactic

sudo apt install ros-galactic-foros ros-galactic-foros-examples ros-galactic-foros-inspector

for humble

sudo apt install ros-humble-foros ros-humble-foros-examples ros-humble-foros-inspector

Option 2. Build From Source

Install dependencies

sudo apt install libleveldb-dev libncurses-dev

Build

If you want to install to existing ROS2 workspace, please clone this source in the workspace in advance.

. /opt/ros/galactic/setup.bash
colcon build

Getting Started

In this section, we will create a cluster of 3 nodes that publishes a node ID every second. Lets’ assume that, | Cluster Name | Cluster Size | Node IDs in the Cluster | Topic Name | | :————-: | :———-: | :———————: | :————-: | | “hello_cluster” | 3 | 0, 1, 2 | “hello_cluster” |

1) Setup Environment

. /opt/ros/galactic/setup.bash
# If foros is installed in the custom workspace,
. {custom workspace}/install/setup.bash

2) Create ROS2 package

Let’s create the hello_cluster package that depends on foros, rclcpp, and std_msgs.

ros2 pkg create hello_cluster --description "Hello Cluster" --build-type ament_cmake --dependencies foros rclcpp std_msgs

3) Create “src/hello_cluster.cpp”

Most of the code is the same as the general ros2 code, except that the akit::failover::foros::ClusterNode class is used instead of rclcpp::Node when creating a node. Unlike rclcpp::Node that receives a node name as an argument, akit::failover::foros::ClusterNode receives a cluster name, node ID, and IDs of all nodes in the cluster as arguments. In fact, the node name of a cluster node is internally created by combining the cluster name and node ID.

For instance, if cluster name is “hello_cluster” and node id is 0, node name is created as “hello_cluster0”

```cpp // hello-cluster.cpp #include #include <rclcpp/rclcpp.hpp> #include <std_msgs/msg/string.hpp> #include #include

#include “akit/failover/foros/cluster_node.hpp”

using namespace std::chrono_literals;

File truncated at 100 lines see the full file

Repo symbol

foros repository

Repo symbol

foros repository

Repo symbol

foros repository

Repo symbol

foros repository

Repo symbol

foros repository

Repo symbol

foros repository

Repo symbol

foros repository

Repo symbol

foros repository

Repo symbol

foros repository