example:
Request String «A-B A-C B-E E-C E-D E-H D-F D-G G-H»
Response String «A-C C-E E-B E-H E-D D-F D-G»
In order to find the MST for a given graph we have used Kruskal’s Minimum Spanning Tree algorithm and we used C++ for coding. for more details about the algorithm you can check this Link
1- pull offical docker container for ros2 foxy
$ docker pull osrf/ros:foxy-desktop
2- download my worksapce
$ git clone https://github.com/SibaIssa/ROS2-service-for-MST.git
3- enter docker
$ sudo docker run -it -v <dir_to_cloned_repo>/ROS2-service-for-MST/task_ws:/home/usr/Task --name mydocker osrf/ros:foxy-desktop
4- go to folder
$ cd home/usr/Task
5- build work space
$ colcon build --packages-up-to mst_srvcli
6- source for our terminal and other terminals
$ source /home/usr/Task/install/setup.bash && source /opt/ros/foxy/setup.bash
$ echo "source /home/usr/Task/install/setup.bash" >> ~/.bashrc && echo "source /opt/ros/foxy/setup.bash" >> ~/.bashrc
7- open another terminals
$ sudo docker exec -ti mydocker bash
- In case of source permission denied use the following
$ source home/usr/Task/install/setup.bash
8- Terminal 1
$ ros2 run mst_srvcli server
9- Terminal 2
$ ros2 run mst_srvcli client
- Enter the graph
A-B A-C B-E E-C E-D E-H D-F D-G G-H #your graph
note: for any inconvenience you can close the docker by using the following statement, then do the steps again:
sudo docker rm -f mydocker