From 4eed86528540a7c3f22e82c995ab964a9f6abf6a Mon Sep 17 00:00:00 2001 From: Giulio Romualdi Date: Thu, 6 Feb 2025 10:40:45 +0100 Subject: [PATCH] Add the possibility to easily disable/enable the rt logging in YarpRobotLoggerDevice (#932) --- CHANGELOG.md | 1 + .../ergoCubGazeboV1/yarp-robot-logger.xml | 5 +++ .../ergoCubGazeboV1_1/yarp-robot-logger.xml | 5 +++ .../robots/ergoCubSN000/yarp-robot-logger.xml | 5 +++ .../robots/ergoCubSN001/yarp-robot-logger.xml | 8 ++--- .../robots/ergoCubSN002/yarp-robot-logger.xml | 5 +++ .../robots/iCubGazeboV3/yarp-robot-logger.xml | 5 +++ .../robots/iCubGenova09/yarp-robot-logger.xml | 5 +++ .../src/YarpRobotLoggerDevice.cpp | 31 +++++++++++++------ .../tests/yarp-robot-logger.xml | 5 +++ 10 files changed, 62 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b8dbfd179..c71fb3bea6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to this project are documented in this file. - Add `VariableFeasibleRegionTaskVariableFeasibleRegionTask` in the TSID controller (https://github.com/ami-iit/bipedal-locomotion-framework/pull/922) - Add `setFeetTransform` in the `UnicycleTrajectoryGenerator` (https://github.com/ami-iit/bipedal-locomotion-framework/pull/927) - Add `getCurrentTime` to the `FixedFootDetector` (https://github.com/ami-iit/bipedal-locomotion-framework/pull/928) +- Add the possibility to easily disable/enable the rt logging in `YarpRobotLoggerDevice` (https://github.com/ami-iit/bipedal-locomotion-framework/pull/932) ### Changed - Some improvements on the YarpRobotLoggerDevice (https://github.com/ami-iit/bipedal-locomotion-framework/pull/910) diff --git a/devices/YarpRobotLoggerDevice/app/robots/ergoCubGazeboV1/yarp-robot-logger.xml b/devices/YarpRobotLoggerDevice/app/robots/ergoCubGazeboV1/yarp-robot-logger.xml index 4afea40e6d..7279b15383 100644 --- a/devices/YarpRobotLoggerDevice/app/robots/ergoCubGazeboV1/yarp-robot-logger.xml +++ b/devices/YarpRobotLoggerDevice/app/robots/ergoCubGazeboV1/yarp-robot-logger.xml @@ -13,6 +13,11 @@ BSD-3-Clause license. --> ("ergoCubGazeboV1/yarprobotinterface") 1.0 + false + + "/yarp-robot-logger/rt_logging" + + 600.0 diff --git a/devices/YarpRobotLoggerDevice/app/robots/ergoCubGazeboV1_1/yarp-robot-logger.xml b/devices/YarpRobotLoggerDevice/app/robots/ergoCubGazeboV1_1/yarp-robot-logger.xml index fe1ca8cc8e..75e5907239 100644 --- a/devices/YarpRobotLoggerDevice/app/robots/ergoCubGazeboV1_1/yarp-robot-logger.xml +++ b/devices/YarpRobotLoggerDevice/app/robots/ergoCubGazeboV1_1/yarp-robot-logger.xml @@ -13,6 +13,11 @@ BSD-3-Clause license. --> ("ergoCubGazeboV1/yarprobotinterface") 1.0 + false + + "/yarp-robot-logger/rt_logging" + + 600.0 diff --git a/devices/YarpRobotLoggerDevice/app/robots/ergoCubSN000/yarp-robot-logger.xml b/devices/YarpRobotLoggerDevice/app/robots/ergoCubSN000/yarp-robot-logger.xml index 675b34c01d..b6880c43d0 100644 --- a/devices/YarpRobotLoggerDevice/app/robots/ergoCubSN000/yarp-robot-logger.xml +++ b/devices/YarpRobotLoggerDevice/app/robots/ergoCubSN000/yarp-robot-logger.xml @@ -21,6 +21,11 @@ BSD-3-Clause license. --> ("ergocub-torso/yarprobotinterface") ("ssh ergocub@10.0.2.2" "ssh ergocub@10.0.2.3") + false + + "/yarp-robot-logger/rt_logging" + + 1800.0 diff --git a/devices/YarpRobotLoggerDevice/app/robots/ergoCubSN001/yarp-robot-logger.xml b/devices/YarpRobotLoggerDevice/app/robots/ergoCubSN001/yarp-robot-logger.xml index cea3faba55..dc74da4072 100644 --- a/devices/YarpRobotLoggerDevice/app/robots/ergoCubSN001/yarp-robot-logger.xml +++ b/devices/YarpRobotLoggerDevice/app/robots/ergoCubSN001/yarp-robot-logger.xml @@ -21,10 +21,10 @@ BSD-3-Clause license. --> ("ergoCubSN001/yarprobotinterface") ("ssh ergocub@10.0.2.2" "ssh ergocub@10.0.2.3") - - + false + + "/yarp-robot-logger/rt_logging" + 1800.0 diff --git a/devices/YarpRobotLoggerDevice/app/robots/ergoCubSN002/yarp-robot-logger.xml b/devices/YarpRobotLoggerDevice/app/robots/ergoCubSN002/yarp-robot-logger.xml index 036be2cf78..95df108292 100644 --- a/devices/YarpRobotLoggerDevice/app/robots/ergoCubSN002/yarp-robot-logger.xml +++ b/devices/YarpRobotLoggerDevice/app/robots/ergoCubSN002/yarp-robot-logger.xml @@ -21,6 +21,11 @@ BSD-3-Clause license. --> ("ergocub-torso/yarprobotinterface") ("ssh ergocub@10.0.2.22" "ssh ergocub@10.0.2.23") + false + + "/yarp-robot-logger/rt_logging" + + 1800.0 diff --git a/devices/YarpRobotLoggerDevice/app/robots/iCubGazeboV3/yarp-robot-logger.xml b/devices/YarpRobotLoggerDevice/app/robots/iCubGazeboV3/yarp-robot-logger.xml index 5f9de5786c..296335dfa2 100644 --- a/devices/YarpRobotLoggerDevice/app/robots/iCubGazeboV3/yarp-robot-logger.xml +++ b/devices/YarpRobotLoggerDevice/app/robots/iCubGazeboV3/yarp-robot-logger.xml @@ -10,6 +10,11 @@ BSD-3-Clause license. --> 1.0 true + false + + "/yarp-robot-logger/rt_logging" + + 600.0 diff --git a/devices/YarpRobotLoggerDevice/app/robots/iCubGenova09/yarp-robot-logger.xml b/devices/YarpRobotLoggerDevice/app/robots/iCubGenova09/yarp-robot-logger.xml index 80067ce0e1..bb0c3ef2ed 100644 --- a/devices/YarpRobotLoggerDevice/app/robots/iCubGenova09/yarp-robot-logger.xml +++ b/devices/YarpRobotLoggerDevice/app/robots/iCubGenova09/yarp-robot-logger.xml @@ -13,6 +13,11 @@ BSD-3-Clause license. --> ("icub-head/yarprobotinterface") ("ssh icub@10.0.0.2" "ssh icub@10.0.0.150") + false + + "/yarp-robot-logger/rt_logging" + + 600.0 diff --git a/devices/YarpRobotLoggerDevice/src/YarpRobotLoggerDevice.cpp b/devices/YarpRobotLoggerDevice/src/YarpRobotLoggerDevice.cpp index 9654b51d85..ab70b5e3d3 100644 --- a/devices/YarpRobotLoggerDevice/src/YarpRobotLoggerDevice.cpp +++ b/devices/YarpRobotLoggerDevice/src/YarpRobotLoggerDevice.cpp @@ -129,10 +129,20 @@ bool YarpRobotLoggerDevice::open(yarp::os::Searchable& config) constexpr auto logPrefix = "[YarpRobotLoggerDevice::open]"; auto params = std::make_shared(config); - auto rtParameters = params->getGroup("REAL_TIME_STREAMING").lock(); - m_sendDataRT = rtParameters != nullptr; + + if (!params->getParameter("enable_real_time_logging", m_sendDataRT)) + { + log()->error("{} Unable to get the 'enable_real_time_logging' parameter. The device will " + "not " + "be opened.", + logPrefix); + return false; + } + if (m_sendDataRT) { + auto rtParameters = params->getGroup("REAL_TIME_STREAMING").lock(); + if (!m_vectorCollectionRTDataServer.initialize(rtParameters)) { log()->error("Failed to initalize the vectorsCollectionServer", logPrefix); @@ -154,7 +164,8 @@ bool YarpRobotLoggerDevice::open(yarp::os::Searchable& config) if (!params->getParameter("log_text", m_logText)) { - log()->info("{} Unable to get the 'log_text' parameter for the telemetry. Default value: {}.", + log()->info("{} Unable to get the 'log_text' parameter for the telemetry. Default value: " + "{}.", logPrefix, m_logText); } @@ -169,7 +180,6 @@ bool YarpRobotLoggerDevice::open(yarp::os::Searchable& config) } } - if (!params->getParameter("code_status_cmd_prefixes", m_codeStatusCmdPrefixes)) { log()->info("{} Unable to get the 'code_status_cmd_prefixes' parameter. No prefix will be " @@ -684,7 +694,8 @@ bool YarpRobotLoggerDevice::addChannel(const std::string& nameKey, if (metadataNames.empty() || vectorSize != metadataNames.size()) { log()->warn("The metadata names for channel {} are empty or the size of the metadata names " - "is different from the vector size. The default metadata will be used.", nameKey); + "is different from the vector size. The default metadata will be used.", + nameKey); if (!m_bufferManager.addChannel({nameKey, {vectorSize, 1}})) { log()->error("Failed to add the channel in buffer manager named: {}", nameKey); @@ -1224,14 +1235,17 @@ void YarpRobotLoggerDevice::lookForExogenousSignals() continue; } - log()->info("[YarpRobotLoggerDevice::lookForExogenousSignals] Attempt to get the " + log()->info("[YarpRobotLoggerDevice::lookForExogenousSignals] Attempt to get " + "the " "metadata for the vectors collection signal named: {}", name); if (!signal.client.getMetadata(signal.metadata)) { - log()->warn("[YarpRobotLoggerDevice::lookForExogenousSignals] Unable to get " - "the metadata for the signal named: {}. The exogenous signal will " + log()->warn("[YarpRobotLoggerDevice::lookForExogenousSignals] Unable to " + "get " + "the metadata for the signal named: {}. The exogenous signal " + "will " "not contain the metadata.", name); } @@ -1239,7 +1253,6 @@ void YarpRobotLoggerDevice::lookForExogenousSignals() } signal.connected = connectionDone; - } }; diff --git a/devices/YarpRobotLoggerDevice/tests/yarp-robot-logger.xml b/devices/YarpRobotLoggerDevice/tests/yarp-robot-logger.xml index 2ce61560d2..efc216b8e1 100644 --- a/devices/YarpRobotLoggerDevice/tests/yarp-robot-logger.xml +++ b/devices/YarpRobotLoggerDevice/tests/yarp-robot-logger.xml @@ -11,6 +11,11 @@ BSD-3-Clause license. --> ("ergocub-torso/yarprobotinterface") 1.0 + false + + "/yarp-robot-logger/rt_logging" + + 20.0