From 7afc034286f434a64c1c5a92a046a6d24b156f92 Mon Sep 17 00:00:00 2001 From: Johannes Mey <johannes.mey@tu-dresden.de> Date: Thu, 24 Jun 2021 17:30:47 +0200 Subject: [PATCH] make topic configurable in place b --- launch/cell-sync/dummy_rag_connector_b_robot_1.launch | 7 +++++++ launch/cell-sync/dummy_rag_connector_b_robot_2.launch | 7 +++++++ src/dummy_rag_controller_b.cpp | 11 +++++++---- 3 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 launch/cell-sync/dummy_rag_connector_b_robot_1.launch create mode 100644 launch/cell-sync/dummy_rag_connector_b_robot_2.launch diff --git a/launch/cell-sync/dummy_rag_connector_b_robot_1.launch b/launch/cell-sync/dummy_rag_connector_b_robot_1.launch new file mode 100644 index 0000000..29671f5 --- /dev/null +++ b/launch/cell-sync/dummy_rag_connector_b_robot_1.launch @@ -0,0 +1,7 @@ +<launch> + + <node pkg="ccf" type="dummy_rag_connector_b" name="dummy_rag_connector_b_1" output="screen"> + <rosparam param="/ccf/place_b_prefix">place-b-1</rosparam> + </node> + +</launch> diff --git a/launch/cell-sync/dummy_rag_connector_b_robot_2.launch b/launch/cell-sync/dummy_rag_connector_b_robot_2.launch new file mode 100644 index 0000000..59bd68c --- /dev/null +++ b/launch/cell-sync/dummy_rag_connector_b_robot_2.launch @@ -0,0 +1,7 @@ +<launch> + + <node pkg="ccf" type="dummy_rag_connector_b" name="dummy_rag_connector_b_2" output="screen"> + <rosparam param="/ccf/place_b_prefix">place-b-2</rosparam> + </node> + +</launch> diff --git a/src/dummy_rag_controller_b.cpp b/src/dummy_rag_controller_b.cpp index 8fe25f5..6a2a6ef 100644 --- a/src/dummy_rag_controller_b.cpp +++ b/src/dummy_rag_controller_b.cpp @@ -38,7 +38,10 @@ int main(int argc, char **argv) { std::string cgv_address = getParameter(n, "cgv_address", "tcp://*:6576"); + std::string cell_prefix = getParameter(n, "place_b_prefix", CELL_NAME); + DummyRobotArmController connector{n, CELL_NAME}; + connector.setSendSceneTopic(cell_prefix + "/scene"); // only for debugging (uncomment when running without the RAG part) // connector.loadScene("/home/jm/work/git/ceti/models2021/src/ccf/config/config_pick_place_scene.json"); @@ -46,8 +49,8 @@ int main(int argc, char **argv) { // add an MQTT connection std::string mqtt_address = getParameter(n, "mqtt/mqtt_address", "tcp://localhost:1883"); std::unique_ptr<MqttConnection> mqtt_connection = std::make_unique<MqttConnection>(mqtt_address, NODE_NAME); - mqtt_connection->addTopic(CELL_NAME + "/scene/init"); - mqtt_connection->addTopic(CELL_NAME + "/command"); + mqtt_connection->addTopic(connector.getInitSceneTopic()); + mqtt_connection->addTopic(connector.getCommandTopic()); connector.addConnection(std::move(mqtt_connection)); ros::Subscriber sub = n.subscribe<std_msgs::Empty>("send_scene", 1000, @@ -104,7 +107,7 @@ int main(int argc, char **argv) { }; connector.reactToPickAndPlaceMessage(pickPlaceLambda); - std::string reachabilityTopicPrefix = CELL_NAME + "/reachability/"; + std::string reachabilityTopicPrefix = cell_prefix + "/reachability/"; auto sceneUpdateLambda = [&reachabilityTopicPrefix, &connector]() { ROS_INFO_STREAM("[" << NODE_NAME << "] Scene was updated, sending new reachability information."); @@ -136,4 +139,4 @@ int main(int argc, char **argv) { ros::spin(); return 0; -} \ No newline at end of file +} -- GitLab