From 774dc5a6fd86be592fdb8e564b5b3bf1ce95a8ff Mon Sep 17 00:00:00 2001
From: Johannes Mey <johannes.mey@tu-dresden.de>
Date: Wed, 22 Dec 2021 17:06:10 +0100
Subject: [PATCH] remove old sync parameters

---
 launch/dummy-cell_ads-table.launch          | 4 +---
 launch/dummy-cell_ceti-table.launch         | 2 --
 launch/dummy-cell_st-table.launch           | 4 +---
 launch/main_controller_virtual-table.launch | 2 +-
 launch/random_selector_automatic.launch     | 2 +-
 launch/random_selector_manual.launch        | 2 +-
 launch/robot-cell_ads-table.launch          | 5 +----
 launch/robot-cell_ceti-table.launch         | 5 +----
 launch/robot-cell_st-table.launch           | 5 +----
 launch/simulated-cell_ads-table.launch      | 5 +----
 launch/simulated-cell_ceti-table.launch     | 5 +----
 launch/simulated-cell_st-table.launch       | 5 +----
 src/dummy_sorting_controller.cpp            | 2 --
 src/main_controller.cpp                     | 2 +-
 src/moveit_sorting_controller.cpp           | 4 ++--
 15 files changed, 14 insertions(+), 40 deletions(-)

diff --git a/launch/dummy-cell_ads-table.launch b/launch/dummy-cell_ads-table.launch
index 09cebe0..d73c4d0 100644
--- a/launch/dummy-cell_ads-table.launch
+++ b/launch/dummy-cell_ads-table.launch
@@ -1,11 +1,9 @@
 <launch>
 
     <arg name="connection_address" default="tcp://*:6576"/>
-    <arg name="client_controllers" default="[]"/>
 
-    <node pkg="ccf_immersive_sorting" type="dummy_sorting_controller" name="ceti-cell" output="screen">
+    <node pkg="ccf_immersive_sorting" type="dummy_sorting_controller" name="ads-cell" output="screen">
         <param name="connection_address" type="string" value="$(arg connection_address)"/>
-        <param name="client_controllers" type="yaml" value="$(arg client_controllers)"/>
         <param name="scene" type="string" value="$(find ccf_immersive_sorting)/config/config_scene_ads-table.json"/>
     </node>
 
diff --git a/launch/dummy-cell_ceti-table.launch b/launch/dummy-cell_ceti-table.launch
index 81a4e20..a53069b 100644
--- a/launch/dummy-cell_ceti-table.launch
+++ b/launch/dummy-cell_ceti-table.launch
@@ -1,11 +1,9 @@
 <launch>
 
     <arg name="connection_address" default="tcp://*:6576"/>
-    <arg name="client_controllers" default="[]"/>
 
     <node pkg="ccf_immersive_sorting" type="dummy_sorting_controller" name="ceti-cell" output="screen">
         <param name="connection_address" type="string" value="$(arg connection_address)"/>
-        <param name="client_controllers" type="yaml" value="$(arg client_controllers)"/>
         <param name="scene" type="string" value="$(find ccf_immersive_sorting)/config/config_scene_ceti-table.json"/>
     </node>
 
diff --git a/launch/dummy-cell_st-table.launch b/launch/dummy-cell_st-table.launch
index 4b52ad0..bf81551 100644
--- a/launch/dummy-cell_st-table.launch
+++ b/launch/dummy-cell_st-table.launch
@@ -1,11 +1,9 @@
 <launch>
 
     <arg name="connection_address" default="tcp://*:6576"/>
-    <arg name="client_controllers" default="[]"/>
 
-    <node pkg="ccf_immersive_sorting" type="dummy_sorting_controller" name="ads-cell" output="screen">
+    <node pkg="ccf_immersive_sorting" type="dummy_sorting_controller" name="st-cell" output="screen">
         <param name="connection_address" type="string" value="$(arg connection_address)"/>
-        <param name="client_controllers" type="yaml" value="$(arg client_controllers)"/>
         <param name="scene" type="string" value="$(find ccf_immersive_sorting)/config/config_scene_st-table.json"/>
     </node>
 
diff --git a/launch/main_controller_virtual-table.launch b/launch/main_controller_virtual-table.launch
index 22b6985..936bc7c 100644
--- a/launch/main_controller_virtual-table.launch
+++ b/launch/main_controller_virtual-table.launch
@@ -1,7 +1,7 @@
 <launch>
 
     <arg name="connection_address" default="tcp://*:6576"/>
-    <arg name="client_controllers" default="['ads', 'st', 'ceti']"/>
+    <arg name="client_controllers" default="['ads-cell', 'st-cell', 'ceti-cell']"/>
 
 
     <node pkg="ccf_immersive_sorting" type="main_controller" name="main_controller" output="screen">
diff --git a/launch/random_selector_automatic.launch b/launch/random_selector_automatic.launch
index dfa5a5d..1561497 100644
--- a/launch/random_selector_automatic.launch
+++ b/launch/random_selector_automatic.launch
@@ -1,7 +1,7 @@
 <launch>
     <arg name="autoselect" default="true"/>
     <arg name="prefix" default="selector"/>
-    <node pkg="ccf_immersive_sorting" type="dummy_selection_provider" name="my_dummy_selection_provider"
+    <node pkg="ccf_immersive_sorting" type="dummy_selection_provider" name="automatic_random_selector"
           output="screen">
         <param name="autoselect" type="bool" value="$(arg autoselect)"/>
         <param name="prefix" type="string" value="$(arg prefix)"/>
diff --git a/launch/random_selector_manual.launch b/launch/random_selector_manual.launch
index 778ad91..5b38e3e 100644
--- a/launch/random_selector_manual.launch
+++ b/launch/random_selector_manual.launch
@@ -1,7 +1,7 @@
 <launch>
     <arg name="autoselect" default="false"/>
     <arg name="prefix" default="selector"/>
-    <node pkg="ccf_immersive_sorting" type="dummy_selection_provider" name="my_dummy_selection_provider"
+    <node pkg="ccf_immersive_sorting" type="dummy_selection_provider" name="manual_random_selector"
           output="screen">
         <param name="autoselect" type="bool" value="$(arg autoselect)"/>
         <param name="prefix" type="string" value="$(arg prefix)"/>
diff --git a/launch/robot-cell_ads-table.launch b/launch/robot-cell_ads-table.launch
index c2b1167..5065cc7 100644
--- a/launch/robot-cell_ads-table.launch
+++ b/launch/robot-cell_ads-table.launch
@@ -2,17 +2,14 @@
     <arg name="robot_ip" default="172.31.1.13"/>
     <arg name="load_gripper" default="true"/>
     <arg name="connection_address" default="tcp://*:6576"/>
-    <arg name="client_controllers" default="[]"/>
 
     <include file="$(find ccf)/launch/robot_setup.launch">
         <arg name="robot_ip" value="$(arg robot_ip)"/>
         <arg name="load_gripper" value="$(arg load_gripper)"/>
     </include>
 
-    <node pkg="ccf_immersive_sorting" type="moveit_sorting_controller" name="moveit_sorting_controller_instance"
-          output="screen">
+    <node pkg="ccf_immersive_sorting" type="moveit_sorting_controller" name="ads-cell" output="screen">
         <param name="connection_address" type="string" value="$(arg connection_address)"/>
-        <param name="client_controllers" type="yaml" value="$(arg client_controllers)"/>
         <param name="scene" type="string" value="$(find ccf_immersive_sorting)/config/config_scene_ads-table.json"/>
     </node>
 
diff --git a/launch/robot-cell_ceti-table.launch b/launch/robot-cell_ceti-table.launch
index edbcecd..a2eb31c 100644
--- a/launch/robot-cell_ceti-table.launch
+++ b/launch/robot-cell_ceti-table.launch
@@ -2,17 +2,14 @@
     <arg name="robot_ip" default="172.31.1.13"/>
     <arg name="load_gripper" default="true"/>
     <arg name="connection_address" default="tcp://*:6576"/>
-    <arg name="client_controllers" default="[]"/>
 
     <include file="$(find ccf)/launch/robot_setup.launch">
         <arg name="robot_ip" value="$(arg robot_ip)"/>
         <arg name="load_gripper" value="$(arg load_gripper)"/>
     </include>
 
-    <node pkg="ccf_immersive_sorting" type="moveit_sorting_controller" name="moveit_sorting_controller_instance"
-          output="screen">
+    <node pkg="ccf_immersive_sorting" type="moveit_sorting_controller" name="ceti-cell" output="screen">
         <param name="connection_address" type="string" value="$(arg connection_address)"/>
-        <param name="client_controllers" type="yaml" value="$(arg client_controllers)"/>
         <param name="scene" type="string" value="$(find ccf_immersive_sorting)/config/config_scene_ceti-table.json"/>
     </node>
 
diff --git a/launch/robot-cell_st-table.launch b/launch/robot-cell_st-table.launch
index 0f58944..b6a9e73 100644
--- a/launch/robot-cell_st-table.launch
+++ b/launch/robot-cell_st-table.launch
@@ -2,17 +2,14 @@
     <arg name="robot_ip" default="172.31.1.13"/>
     <arg name="load_gripper" default="true"/>
     <arg name="connection_address" default="tcp://*:6576"/>
-    <arg name="client_controllers" default="[]"/>
 
     <include file="$(find ccf)/launch/robot_setup.launch">
         <arg name="robot_ip" value="$(arg robot_ip)"/>
         <arg name="load_gripper" value="$(arg load_gripper)"/>
     </include>
 
-    <node pkg="ccf_immersive_sorting" type="moveit_sorting_controller" name="moveit_sorting_controller_instance"
-          output="screen">
+    <node pkg="ccf_immersive_sorting" type="moveit_sorting_controller" name="st-cell" output="screen">
         <param name="connection_address" type="string" value="$(arg connection_address)"/>
-        <param name="client_controllers" type="yaml" value="$(arg client_controllers)"/>
         <param name="scene" type="string" value="$(find ccf_immersive_sorting)/config/config_scene_st-table.json"/>
     </node>
 
diff --git a/launch/simulated-cell_ads-table.launch b/launch/simulated-cell_ads-table.launch
index 003e303..7e34f02 100644
--- a/launch/simulated-cell_ads-table.launch
+++ b/launch/simulated-cell_ads-table.launch
@@ -1,14 +1,11 @@
 <launch>
 
     <arg name="connection_address" default="tcp://*:6576"/>
-    <arg name="client_controllers" default="[]"/>
 
     <include file="$(find ccf)/launch/simulation_setup.launch"/>
 
-    <node pkg="ccf_immersive_sorting" type="moveit_sorting_controller" name="moveit_sorting_controller_instance"
-          output="screen">
+    <node pkg="ccf_immersive_sorting" type="moveit_sorting_controller" name="ads-cell" output="screen">
         <param name="connection_address" type="string" value="$(arg connection_address)"/>
-        <param name="client_controllers" type="yaml" value="$(arg client_controllers)"/>
         <param name="scene" type="string" value="$(find ccf_immersive_sorting)/config/config_scene_ads-table.json"/>
     </node>
 
diff --git a/launch/simulated-cell_ceti-table.launch b/launch/simulated-cell_ceti-table.launch
index 1a3dd3c..ca6b923 100644
--- a/launch/simulated-cell_ceti-table.launch
+++ b/launch/simulated-cell_ceti-table.launch
@@ -1,14 +1,11 @@
 <launch>
 
     <arg name="connection_address" default="tcp://*:6576"/>
-    <arg name="client_controllers" default="[]"/>
 
     <include file="$(find ccf)/launch/simulation_setup.launch"/>
 
-    <node pkg="ccf_immersive_sorting" type="moveit_sorting_controller" name="moveit_sorting_controller_instance"
-          output="screen">
+    <node pkg="ccf_immersive_sorting" type="moveit_sorting_controller" name="ceti-cell" output="screen">
         <param name="connection_address" type="string" value="$(arg connection_address)"/>
-        <param name="client_controllers" type="yaml" value="$(arg client_controllers)"/>
         <param name="scene" type="string" value="$(find ccf_immersive_sorting)/config/config_scene_ceti-table.json"/>
     </node>
 
diff --git a/launch/simulated-cell_st-table.launch b/launch/simulated-cell_st-table.launch
index 70f4a22..25563d7 100644
--- a/launch/simulated-cell_st-table.launch
+++ b/launch/simulated-cell_st-table.launch
@@ -1,14 +1,11 @@
 <launch>
 
     <arg name="connection_address" default="tcp://*:6576"/>
-    <arg name="client_controllers" default="[]"/>
 
     <include file="$(find ccf)/launch/simulation_setup.launch"/>
 
-    <node pkg="ccf_immersive_sorting" type="moveit_sorting_controller" name="moveit_sorting_controller_instance"
-          output="screen">
+    <node pkg="ccf_immersive_sorting" type="moveit_sorting_controller" name="st-cell" output="screen">
         <param name="connection_address" type="string" value="$(arg connection_address)"/>
-        <param name="client_controllers" type="yaml" value="$(arg client_controllers)"/>
         <param name="scene" type="string" value="$(find ccf_immersive_sorting)/config/config_scene_st-table.json"/>
     </node>
 
diff --git a/src/dummy_sorting_controller.cpp b/src/dummy_sorting_controller.cpp
index fcf5a5f..52b4147 100644
--- a/src/dummy_sorting_controller.cpp
+++ b/src/dummy_sorting_controller.cpp
@@ -42,8 +42,6 @@ int main(int argc, char **argv) {
     connection->setSendTopic(getParameter(n, "topics/scene", NODE_NAME + "/scene/update"));
     connector.addConnection(std::move(connection));
 
-    auto clientControllers = getPrivateParameter<std::vector<std::string>>("client_controllers");
-
     auto mqttServer = getPrivateParameter<std::string>("mqtt_server", "localhost:1883");
     std::unique_ptr<MqttConnection> mqtt_connection = std::make_unique<MqttConnection>(mqttServer, ros::this_node::getName());
     mqtt_connection->listen(getParameter<std::string>(n, "topics/selection", "selection"));
diff --git a/src/main_controller.cpp b/src/main_controller.cpp
index c38d0f8..37a30db 100644
--- a/src/main_controller.cpp
+++ b/src/main_controller.cpp
@@ -18,7 +18,7 @@
 #include "ccf/connection/MqttConnection.h"
 #include "ccf/util/NodeUtil.h"
 
-std::string NODE_NAME = "dummy_sorting_controller";
+std::string NODE_NAME = "main_controller";
 
 using CetiRosToolbox::getParameter;
 using CetiRosToolbox::getPrivateParameter;
diff --git a/src/moveit_sorting_controller.cpp b/src/moveit_sorting_controller.cpp
index 5da3500..d6c538d 100644
--- a/src/moveit_sorting_controller.cpp
+++ b/src/moveit_sorting_controller.cpp
@@ -42,10 +42,10 @@ int main(int argc, char **argv) {
     connection->setSendTopic(getParameter(n, "topics/scene", NODE_NAME + "/scene/update"));
     connector.addConnection(std::move(connection));
 
-    auto clientControllers = getPrivateParameter<std::vector<std::string>>("client_controllers");
-
     auto mqttServer = getPrivateParameter<std::string>("mqtt_server", "localhost:1883");
     std::unique_ptr<MqttConnection> mqtt_connection = std::make_unique<MqttConnection>(mqttServer, ros::this_node::getName());
+    mqtt_connection->listen(getParameter<std::string>(n, "topics/selection", "selection"));
+    connector.addConnection(std::move(mqtt_connection));
 
     ros::WallDuration(5).sleep(); // wait 5 secs to init scene (to give moveit time to load)
 
-- 
GitLab