diff --git a/src/devices/frameTransformClient/CMakeLists.txt b/src/devices/frameTransformClient/CMakeLists.txt index 6b34adfb633..538556d9bda 100644 --- a/src/devices/frameTransformClient/CMakeLists.txt +++ b/src/devices/frameTransformClient/CMakeLists.txt @@ -4,6 +4,22 @@ # This software may be modified and distributed under the terms of the # BSD-3-Clause license. See the accompanying LICENSE file for details. +include(CMakeRC) + +cmrc_add_resource_library(frameTransformRC + NAMESPACE frameTransformRC + WHENCE robotinterface_xml + PREFIX config_xml + robotinterface_xml/ftc_full_ros.xml + robotinterface_xml/ftc_pub_ros.xml + robotinterface_xml/ftc_ros.xml + robotinterface_xml/ftc_sub_ros.xml + robotinterface_xml/ftc_pub_yarp_only.xml + robotinterface_xml/ftc_sub_yarp_only.xml + robotinterface_xml/ftc_yarp_only.xml + robotinterface_xml/ftc_yarp_only_single_client.xml + robotinterface_xml/ftc_local_only.xml) + yarp_prepare_plugin(frameTransformClient CATEGORY device TYPE FrameTransformClient @@ -25,6 +41,8 @@ if(NOT SKIP_frameTransformClient) YARP::YARP_dev YARP::YARP_math YARP::YARP_robotinterface) + target_sources(yarp_frameTransformClient PRIVATE $) + target_include_directories(yarp_frameTransformClient PRIVATE $) list(APPEND YARP_${YARP_PLUGIN_MASTER}_PRIVATE_DEPS YARP_os YARP_sig YARP_dev diff --git a/src/devices/frameTransformClient/frameTransformClient.cpp b/src/devices/frameTransformClient/frameTransformClient.cpp index 39362ca2c61..5877c40cb03 100644 --- a/src/devices/frameTransformClient/frameTransformClient.cpp +++ b/src/devices/frameTransformClient/frameTransformClient.cpp @@ -23,6 +23,9 @@ #include #include +#include +CMRC_DECLARE(frameTransformRC); + /*! \file FrameTransformClient.cpp */ //example: yarpdev --device frameTransformClient --local /transformClient --remote /transformServer @@ -232,15 +235,22 @@ bool FrameTransformClient::open(yarp::os::Searchable &config) cfg.fromString(config.toString()); string configuration_to_open; - if(cfg.check("filexml_option")) { configuration_to_open=cfg.find("filexml_option").toString();} + string innerFilePath="config_xml/ftc_local_only.xml"; + auto fs = cmrc::frameTransformRC::get_filesystem(); + if(cfg.check("filexml_option")) { innerFilePath="config_xml/"+cfg.find("filexml_option").toString();} cfg.unput("filexml_option"); + auto xmlFile = fs.open(innerFilePath); + for(const auto& lemma : xmlFile) + { + configuration_to_open += lemma; + } string m_local_rpcUser = "/ftClient/rpc"; if (cfg.check("local_rpc")) { m_local_rpcUser=cfg.find("local_rpc").toString();} cfg.unput("local_rpc"); yarp::robotinterface::experimental::XMLReader reader; - yarp::robotinterface::experimental::XMLReaderResult result = reader.getRobotFromFile(configuration_to_open, cfg); + yarp::robotinterface::experimental::XMLReaderResult result = reader.getRobotFromString(configuration_to_open, cfg); yCAssert(FRAMETRANSFORMCLIENT, result.parsingIsSuccessful); m_robot = std::move(result.robot); // FIXME std::move non serve diff --git a/src/devices/frameTransformClient/robotinterface_xml/ftc_full_ros.xml b/src/devices/frameTransformClient/robotinterface_xml/ftc_full_ros.xml new file mode 100644 index 00000000000..dae15c33b7f --- /dev/null +++ b/src/devices/frameTransformClient/robotinterface_xml/ftc_full_ros.xml @@ -0,0 +1,69 @@ + + + + + + + + /frameTransformSet/clientRPC + /frameTransformSet/serverRPC + + + /frameTransformGet/clientRPC + /frameTransformGet/serverRPC + + + + + 0.01 + 0.1 + 1 + + + /tf + /tf_static + /tfNodeSet + + + + + 0.01 + 0.1 + + + /tf + /tf_static + /tfNodeGet + + + + + + + ftc_mpxGet + + + + + + + + + ftc_storage + ftSet_nwc_yarp + ftSet_nwc_ros + + + + + + + + ftGet_nwc_yarp + ftGet_nwc_ros + + + + + + diff --git a/src/devices/frameTransformClient/robotinterface_xml/ftc_local_only.xml b/src/devices/frameTransformClient/robotinterface_xml/ftc_local_only.xml new file mode 100644 index 00000000000..eb8ce19b5b6 --- /dev/null +++ b/src/devices/frameTransformClient/robotinterface_xml/ftc_local_only.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/devices/frameTransformClient/robotinterface_xml/ftc_pub_ros.xml b/src/devices/frameTransformClient/robotinterface_xml/ftc_pub_ros.xml new file mode 100644 index 00000000000..230cea8ee59 --- /dev/null +++ b/src/devices/frameTransformClient/robotinterface_xml/ftc_pub_ros.xml @@ -0,0 +1,23 @@ + + + + + + + + + 0.01 + 0.1 + 1 + + + /tf + /tf_static + /tfNodeSet + + + + + + + diff --git a/src/devices/frameTransformClient/robotinterface_xml/ftc_pub_yarp_only.xml b/src/devices/frameTransformClient/robotinterface_xml/ftc_pub_yarp_only.xml new file mode 100644 index 00000000000..d22171070fa --- /dev/null +++ b/src/devices/frameTransformClient/robotinterface_xml/ftc_pub_yarp_only.xml @@ -0,0 +1,15 @@ + + + + + + + + /frameTransformSet/clientRPC + /frameTransformSet/serverRPC + + + + + + diff --git a/src/devices/frameTransformClient/robotinterface_xml/ftc_ros.xml b/src/devices/frameTransformClient/robotinterface_xml/ftc_ros.xml new file mode 100644 index 00000000000..25dbf8dc595 --- /dev/null +++ b/src/devices/frameTransformClient/robotinterface_xml/ftc_ros.xml @@ -0,0 +1,50 @@ + + + + + + + + + 0.01 + 0.1 + 1 + + + /tf + /tf_static + /tfNodeSet + + + + + 0.01 + 0.1 + + + /tf + /tf_static + /tfNodeGet + + + + + + + ftGet_nwc_ros + + + + + + + + + ftc_storage + ftSet_nwc_ros + + + + + + diff --git a/src/devices/frameTransformClient/robotinterface_xml/ftc_sub_ros.xml b/src/devices/frameTransformClient/robotinterface_xml/ftc_sub_ros.xml new file mode 100644 index 00000000000..66d03b2714e --- /dev/null +++ b/src/devices/frameTransformClient/robotinterface_xml/ftc_sub_ros.xml @@ -0,0 +1,28 @@ + + + + + + + + + 0.01 + 0.1 + + + /tf + /tf_static + /tfNodeGet + + + + + + + ftGet_nwc_ros + + + + + + diff --git a/src/devices/frameTransformClient/robotinterface_xml/ftc_sub_yarp_only.xml b/src/devices/frameTransformClient/robotinterface_xml/ftc_sub_yarp_only.xml new file mode 100644 index 00000000000..d284c981ba6 --- /dev/null +++ b/src/devices/frameTransformClient/robotinterface_xml/ftc_sub_yarp_only.xml @@ -0,0 +1,21 @@ + + + + + + + + /frameTransformGet/clientRPC + /frameTransformGet/serverRPC + + + + + + ftGet_nwc_yarp + + + + + + diff --git a/src/devices/frameTransformClient/robotinterface_xml/ftc_yarp_only.xml b/src/devices/frameTransformClient/robotinterface_xml/ftc_yarp_only.xml new file mode 100644 index 00000000000..9f62ce5b64b --- /dev/null +++ b/src/devices/frameTransformClient/robotinterface_xml/ftc_yarp_only.xml @@ -0,0 +1,35 @@ + + + + + + + + /frameTransformSet/clientRPC + /frameTransformSet/serverRPC + + + /frameTransformGet/clientRPC + /frameTransformGet/serverRPC + + + + + + ftGet_nwc_yarp + + + + + + + + + ftc_storage + ftSet_nwc_yarp + + + + + + diff --git a/src/devices/frameTransformClient/robotinterface_xml/ftc_yarp_only_single_client.xml b/src/devices/frameTransformClient/robotinterface_xml/ftc_yarp_only_single_client.xml new file mode 100644 index 00000000000..04abd15d331 --- /dev/null +++ b/src/devices/frameTransformClient/robotinterface_xml/ftc_yarp_only_single_client.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + /frameTransformSet/rpc + + + + ftc_storage + + + + + +