Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMakeRC integration first test #2624

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/devices/frameTransformClient/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -25,6 +41,8 @@ if(NOT SKIP_frameTransformClient)
YARP::YARP_dev
YARP::YARP_math
YARP::YARP_robotinterface)
target_sources(yarp_frameTransformClient PRIVATE $<TARGET_OBJECTS:frameTransformRC>)
target_include_directories(yarp_frameTransformClient PRIVATE $<TARGET_PROPERTY:frameTransformRC,INTERFACE_INCLUDE_DIRECTORIES>)
list(APPEND YARP_${YARP_PLUGIN_MASTER}_PRIVATE_DEPS YARP_os
YARP_sig
YARP_dev
Expand Down
14 changes: 12 additions & 2 deletions src/devices/frameTransformClient/frameTransformClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
#include <yarp/math/Math.h>
#include <mutex>

#include <cmrc/cmrc.hpp>
CMRC_DECLARE(frameTransformRC);

/*! \file FrameTransformClient.cpp */

//example: yarpdev --device frameTransformClient --local /transformClient --remote /transformServer
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE robot PUBLIC "-//YARP//DTD yarprobotinterface 3.0//EN" "http://www.yarp.it/DTD/yarprobotinterfaceV3.0.dtd">

<robot name="frameTransformClient" build="2" portprefix="frameTransformClient" xmlns:xi="http://www.w3.org/2001/XInclude">
<devices>
<!-- **************** YARP NWC **************** -->
<device name="ftSet_nwc_yarp" type="frameTransformSet_nwc_yarp">
<param extern-name="ftSet_client_port" name="rpc_port_client"> /frameTransformSet/clientRPC </param>
<param extern-name="ftSet_server_port" name="rpc_port_server"> /frameTransformSet/serverRPC </param>
</device>
<device name="ftGet_nwc_yarp" type="frameTransformGet_nwc_yarp">
<param extern-name="ftGet_client_port" name="rpc_port_client"> /frameTransformGet/clientRPC </param>
<param extern-name="ftGet_server_port" name="rpc_port_server"> /frameTransformGet/serverRPC </param>
</device>
<!-- **************** ROS NWC **************** -->
<device name="ftSet_nwc_ros" type="frameTransformSet_nwc_ros">
<group name="GENERAL">
<param extern-name="ftSet_period" name="period"> 0.01 </param>
<param extern-name="ftSet_refInt" name="refresh_interval"> 0.1 </param>
<param extern-name="ftSet_asyncPub" name="asynch_pub"> 1 </param>
</group>
<group name="ROS">
<param extern-name="ftSet_ftTopic" name="ft_topic"> /tf </param>
<param extern-name="ftSet_ftTopicStatic" name="ft_topic_static"> /tf_static </param>
<param extern-name="ftSet_ftNode" name="ft_node"> /tfNodeSet </param>
</group>
</device>
<device name="ftGet_nwc_ros" type="frameTransformGet_nwc_ros">
<group name="GENERAL">
<param extern-name="ftGet_period" name="period"> 0.01 </param>
<param extern-name="ftGet_refInt" name="refresh_interval"> 0.1 </param>
</group>
<group name="ROS">
<param extern-name="ftGet_ftTopic" name="ft_topic"> /tf </param>
<param extern-name="ftGet_ftTopicStatic" name="ft_topic_static"> /tf_static </param>
<param extern-name="ftGet_ftNode" name="ft_node"> /tfNodeGet </param>
</group>
</device>
<!-- **************** STORAGE **************** -->
<device name="ftc_storage" type="frameTransformStorage">
<action phase="startup" level="5" type="attach">
<paramlist name="networks">
<elem name="subdevicegetmpx"> ftc_mpxGet </elem>
</paramlist>
</action>
<action phase="shutdown" level="5" type="detach" />
</device>
<!-- **************** MULTIPLEXER **************** -->
<device name="ftc_mpxSet" type="frameTransformSetMultiplexer">
<action phase="startup" level="5" type="attach">
<paramlist name="networks">
<elem name="subdevicestorage"> ftc_storage </elem>
<elem name="subdevicesetyarp"> ftSet_nwc_yarp </elem>
<elem name="subdevicesetros"> ftSet_nwc_ros </elem>
</paramlist>
</action>
<action phase="shutdown" level="5" type="detach" />
</device>
<device name="ftc_mpxGet" type="frameTransformGetMultiplexer">
<action phase="startup" level="5" type="attach">
<paramlist name="networks">
<elem name="subdevicegetyarp"> ftGet_nwc_yarp </elem>
<elem name="subdevicegetros"> ftGet_nwc_ros </elem>
</paramlist>
</action>
<action phase="shutdown" level="5" type="detach" />
</device>
</devices>
</robot>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE robot PUBLIC "-//YARP//DTD yarprobotinterface 3.0//EN" "http://www.yarp.it/DTD/yarprobotinterfaceV3.0.dtd">

<robot name="ftc_local_only" build="2" portprefix="test" xmlns:xi="http://www.w3.org/2001/XInclude">
<devices>
<device name="ftc_storage" type="frameTransformStorage">
</device>
</devices>
</robot>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE robot PUBLIC "-//YARP//DTD yarprobotinterface 3.0//EN" "http://www.yarp.it/DTD/yarprobotinterfaceV3.0.dtd">

<robot name="frameTransformClient" build="2" portprefix="frameTransformClient" xmlns:xi="http://www.w3.org/2001/XInclude">
<devices>
<!-- **************** ROS NWC **************** -->
<device name="ftSet_nwc_ros" type="frameTransformSet_nwc_ros">
<group name="GENERAL">
<param extern-name="ftSet_period" name="period"> 0.01 </param>
<param extern-name="ftSet_refInt" name="refresh_interval"> 0.1 </param>
<param extern-name="ftSet_asyncPub" name="asynch_pub"> 1 </param>
</group>
<group name="ROS">
<param extern-name="ftSet_ftTopic" name="ft_topic"> /tf </param>
<param extern-name="ftSet_ftTopicStatic" name="ft_topic_static"> /tf_static </param>
<param extern-name="ftSet_ftNode" name="ft_node"> /tfNodeSet </param>
</group>
</device>
<!-- **************** STORAGE **************** -->
<device name="ftc_storage" type="frameTransformStorage">
</device>
</devices>
</robot>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE robot PUBLIC "-//YARP//DTD yarprobotinterface 3.0//EN" "http://www.yarp.it/DTD/yarprobotinterfaceV3.0.dtd">

<robot name="frameTransformClient" build="2" portprefix="frameTransformClient" xmlns:xi="http://www.w3.org/2001/XInclude">
<devices>
<!-- **************** YARP NWC **************** -->
<device name="ftSet_nwc_yarp" type="frameTransformSet_nwc_yarp">
<param extern-name="ftSet_client_port" name="rpc_port_client"> /frameTransformSet/clientRPC </param>
<param extern-name="ftSet_server_port" name="rpc_port_server"> /frameTransformSet/serverRPC </param>
</device>
<!-- **************** STORAGE **************** -->
<device name="ftc_storage" type="frameTransformStorage">
</device>
</devices>
</robot>
50 changes: 50 additions & 0 deletions src/devices/frameTransformClient/robotinterface_xml/ftc_ros.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE robot PUBLIC "-//YARP//DTD yarprobotinterface 3.0//EN" "http://www.yarp.it/DTD/yarprobotinterfaceV3.0.dtd">

<robot name="frameTransformClient" build="2" portprefix="frameTransformClient" xmlns:xi="http://www.w3.org/2001/XInclude">
<devices>
<!-- **************** ROS NWC **************** -->
<device name="ftSet_nwc_ros" type="frameTransformSet_nwc_ros">
<group name="GENERAL">
<param extern-name="ftSet_period" name="period"> 0.01 </param>
<param extern-name="ftSet_refInt" name="refresh_interval"> 0.1 </param>
<param extern-name="ftSet_asyncPub" name="asynch_pub"> 1 </param>
</group>
<group name="ROS">
<param extern-name="ftSet_ftTopic" name="ft_topic"> /tf </param>
<param extern-name="ftSet_ftTopicStatic" name="ft_topic_static"> /tf_static </param>
<param extern-name="ftSet_ftNode" name="ft_node"> /tfNodeSet </param>
</group>
</device>
<device name="ftGet_nwc_ros" type="frameTransformGet_nwc_ros">
<group name="GENERAL">
<param extern-name="ftGet_period" name="period"> 0.01 </param>
<param extern-name="ftGet_refInt" name="refresh_interval"> 0.1 </param>
</group>
<group name="ROS">
<param extern-name="ftGet_ftTopic" name="ft_topic"> /tf </param>
<param extern-name="ftGet_ftTopicStatic" name="ft_topic_static"> /tf_static </param>
<param extern-name="ftGet_ftNode" name="ft_node"> /tfNodeGet </param>
</group>
</device>
<!-- **************** STORAGE **************** -->
<device name="ftc_storage" type="frameTransformStorage">
<action phase="startup" level="5" type="attach">
<paramlist name="networks">
<elem name="subdevicegetros"> ftGet_nwc_ros </elem>
</paramlist>
</action>
<action phase="shutdown" level="5" type="detach" />
</device>
<!-- **************** MULTIPLEXER **************** -->
<device name="ftc_mpxSet" type="frameTransformSetMultiplexer">
<action phase="startup" level="5" type="attach">
<paramlist name="networks">
<elem name="subdevicestorage"> ftc_storage </elem>
<elem name="subdevicesetros"> ftSet_nwc_ros </elem>
</paramlist>
</action>
<action phase="shutdown" level="5" type="detach" />
</device>
</devices>
</robot>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE robot PUBLIC "-//YARP//DTD yarprobotinterface 3.0//EN" "http://www.yarp.it/DTD/yarprobotinterfaceV3.0.dtd">

<robot name="frameTransformClient" build="2" portprefix="frameTransformClient" xmlns:xi="http://www.w3.org/2001/XInclude">
<devices>
<!-- **************** ROS NWC **************** -->
<device name="ftGet_nwc_ros" type="frameTransformGet_nwc_ros">
<group name="GENERAL">
<param extern-name="ftGet_period" name="period"> 0.01 </param>
<param extern-name="ftGet_refInt" name="refresh_interval"> 0.1 </param>
</group>
<group name="ROS">
<param extern-name="ftGet_ftTopic" name="ft_topic"> /tf </param>
<param extern-name="ftGet_ftTopicStatic" name="ft_topic_static"> /tf_static </param>
<param extern-name="ftGet_ftNode" name="ft_node"> /tfNodeGet </param>
</group>
</device>
<!-- **************** STORAGE **************** -->
<device name="ftc_storage" type="frameTransformStorage">
<action phase="startup" level="5" type="attach">
<paramlist name="networks">
<elem name="subdevicegetros"> ftGet_nwc_ros </elem>
</paramlist>
</action>
<action phase="shutdown" level="5" type="detach" />
</device>
</devices>
</robot>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE robot PUBLIC "-//YARP//DTD yarprobotinterface 3.0//EN" "http://www.yarp.it/DTD/yarprobotinterfaceV3.0.dtd">

<robot name="frameTransformClient" build="2" portprefix="frameTransformClient" xmlns:xi="http://www.w3.org/2001/XInclude">
<devices>
<!-- **************** YARP NWC **************** -->
<device name="ftGet_nwc_yarp" type="frameTransformGet_nwc_yarp">
<param extern-name="ftGet_client_port" name="rpc_port_client"> /frameTransformGet/clientRPC </param>
<param extern-name="ftGet_server_port" name="rpc_port_server"> /frameTransformGet/serverRPC </param>
</device>
<!-- **************** STORAGE **************** -->
<device name="ftc_storage" type="frameTransformStorage">
<action phase="startup" level="5" type="attach">
<paramlist name="networks">
<elem name="subdevicegetyarp"> ftGet_nwc_yarp </elem>
</paramlist>
</action>
<action phase="shutdown" level="5" type="detach" />
</device>
</devices>
</robot>
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE robot PUBLIC "-//YARP//DTD yarprobotinterface 3.0//EN" "http://www.yarp.it/DTD/yarprobotinterfaceV3.0.dtd">

<robot name="frameTransformClient" build="2" portprefix="frameTransformClient" xmlns:xi="http://www.w3.org/2001/XInclude">
<devices>
<!-- **************** YARP NWC **************** -->
<device name="ftSet_nwc_yarp" type="frameTransformSet_nwc_yarp">
<param extern-name="ftSet_client_port" name="rpc_port_client"> /frameTransformSet/clientRPC </param>
<param extern-name="ftSet_server_port" name="rpc_port_server"> /frameTransformSet/serverRPC </param>
</device>
<device name="ftGet_nwc_yarp" type="frameTransformGet_nwc_yarp">
<param extern-name="ftGet_client_port" name="rpc_port_client"> /frameTransformGet/clientRPC </param>
<param extern-name="ftGet_server_port" name="rpc_port_server"> /frameTransformGet/serverRPC </param>
</device>
<!-- **************** STORAGE **************** -->
<device name="ftc_storage" type="frameTransformStorage">
<action phase="startup" level="5" type="attach">
<paramlist name="networks">
<elem name="subdevicegetyarp"> ftGet_nwc_yarp </elem>
</paramlist>
</action>
<action phase="shutdown" level="5" type="detach" />
</device>
<!-- **************** MULTIPLEXER **************** -->
<device name="ftc_mpxSet" type="frameTransformSetMultiplexer">
<action phase="startup" level="5" type="attach">
<paramlist name="networks">
<elem name="subdevicestorage"> ftc_storage </elem>
<elem name="subdevicesetyarp"> ftSet_nwc_yarp </elem>
</paramlist>
</action>
<action phase="shutdown" level="5" type="detach" />
</device>
</devices>
</robot>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE robot PUBLIC "-//YARP//DTD yarprobotinterface 3.0//EN" "http://www.yarp.it/DTD/yarprobotinterfaceV3.0.dtd">

<robot name="frameTransformClient" build="2" portprefix="frameTransformClient" xmlns:xi="http://www.w3.org/2001/XInclude">
<devices>
<!-- **************** STORAGE **************** -->
<device name="ftc_storage" type="frameTransformStorage">
</device>
<!-- **************** YARP NWS **************** -->
<device name="ftSet_nws_yarp" type="frameTransformSet_nws_yarp">
<group name="GENERAL">
<param extern-name="ftSet_rpc_port" name="rpc_port"> /frameTransformSet/rpc </param>
</group>
<action phase="startup" level="5" type="attach">
<paramlist name="networks">
<elem name="subdevicestorage"> ftc_storage </elem>
</paramlist>
</action>
<action phase="shutdown" level="5" type="detach" />
</device>
</devices>
</robot>