# FKIE Multimaster
## Get Started
* **[https://github.com/fkie/multimaster_fkie/tree/noetic-v1.2.4](https://github.com/fkie/multimaster_fkie/tree/noetic-v1.2.4)**
* **[http://wiki.ros.org/multimaster_fkie](http://wiki.ros.org/multimaster_fkie)**
* **[https://digital.csic.es/bitstream/10261/133333/1/ROS-systems.pdf](https://digital.csic.es/bitstream/10261/133333/1/ROS-systems.pdf)**
* [http://www.huyaoyu.com/technical/2018/08/27/multimaster-ros-configuration-and-multimaster-fkie.html](http://www.huyaoyu.com/technical/2018/08/27/multimaster-ros-configuration-and-multimaster-fkie.html)
* [http://wiki.ros.org/master_discovery_fkie?distro=melodic](http://wiki.ros.org/master_discovery_fkie?distro=melodic)
* [http://wiki.ros.org/node_manager_fkie?distro=melodic](http://wiki.ros.org/node_manager_fkie?distro=melodic)
## Setup
#### Install the fkie_multimaster.
```bash=
#Use same ros dist in robot and control station.
#noetic
sudo apt-get install ros-noetic-fkie-multimaster
#melodic
sudo apt-get install ros-melodic-multimaster-fkie ### check this
```
#### Enable multicast
* For all computers on a local ROS network, and for all ROS networks, first check if the multicast feature is enabled using the following command. It should return 0.
```bash=
cat /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
```
* Else, edit the /etc/sysctl.conf file and add the following line.
```bash=
sudo gedit /etc/sysctl.conf
#add/uncomment the below line
net.ipv4.icmp_echo_ignore_broadcasts=0
#restart the service
sudo service procps restart
```
#### Enable IP forwarding
* Enable ip foewarding on both systems. Check if the below command returns 1.
```bash=
cat /proc/sys/net/ipv4/ip_forward
```
* Else,edit the /etc/sysctl.conf file and add the following line, or uncomment it if it already exists, and change its default value.
```bash=
sudo gedit /etc/sysctl.conf
#add/uncomment the below line
net.ipv4.ip_forward=1
#restart the service
sudo service procps restart
```
#### Host name and IP address binding
* For all computers on a local ROS network, and for all ROS networks, add these line to the /etc/hosts file.
```bash=
sudo gedit /etc/hosts
# add ip addresses and host names of robots and control station to the file
Eg:
10.223.240.0 octo
10.223.240.1 octo-1
```
#### Change the ROS_MASTER_URI variable
* Export ROS_MASTER_URI of respective systems to their bash scripts.
```bash=
sudo gedit ~/.bashrc
export ROS_MASTER_URI=http://<hostname or IP address>:11311
```
## Usage
* After setup, run these commands on xavier (indivdual terminals).
```bash=
roscore
rosrun master_discovery_fkie master_discovery
```
* Run these commands on control station (indivdual terminals).
```bash=
roscore
rosrun master_discovery_fkie master_discovery
node_manager
```
* Back to normal system
```bash=
revert the above changes as soon as possible
sudo gedit /etc/hosts
#on xavier(dry)
10.223.240.0 octobotics
10.223.240.1 dry
#on gnd station
10.223.240.0 octobotics
10.223.240.1 dry
# remote.bash
export ROS_MASTER_URI=http://10.223.240.1:11311
export ROS_IP=10.223.240.0
export ROS_HOSTNAME=dry
```