Skip to content

Commit

Permalink
Add the possibility to easily disable/enable the rt logging in YarpRo…
Browse files Browse the repository at this point in the history
…botLoggerDevice (#932)
  • Loading branch information
GiulioRomualdi authored Feb 6, 2025
1 parent f4d03f5 commit 4eed865
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ BSD-3-Clause license. -->
<param name="text_logging_subnames">("ergoCubGazeboV1/yarprobotinterface")</param>
<param name="maximum_admissible_time_step">1.0</param>

<param name="enable_real_time_logging" extern-name="enable_real_time_logging">false</param>
<group name="REAL_TIME_STREAMING">
<param name="remote">"/yarp-robot-logger/rt_logging"</param>
</group>

<group name="Telemetry">
<param name="save_period">600.0</param>
</group>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ BSD-3-Clause license. -->
<param name="text_logging_subnames">("ergoCubGazeboV1/yarprobotinterface")</param>
<param name="maximum_admissible_time_step">1.0</param>

<param name="enable_real_time_logging" extern-name="enable_real_time_logging">false</param>
<group name="REAL_TIME_STREAMING">
<param name="remote">"/yarp-robot-logger/rt_logging"</param>
</group>

<group name="Telemetry">
<param name="save_period">600.0</param>
</group>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ BSD-3-Clause license. -->
<param name="text_logging_subnames">("ergocub-torso/yarprobotinterface")</param>
<param name="code_status_cmd_prefixes">("ssh [email protected]" "ssh [email protected]")</param>

<param name="enable_real_time_logging" extern-name="enable_real_time_logging">false</param>
<group name="REAL_TIME_STREAMING">
<param name="remote">"/yarp-robot-logger/rt_logging"</param>
</group>

<group name="Telemetry">
<param name="save_period">1800.0</param>
</group>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ BSD-3-Clause license. -->
<param name="text_logging_subnames">("ergoCubSN001/yarprobotinterface")</param>
<param name="code_status_cmd_prefixes">("ssh [email protected]" "ssh [email protected]")</param>

<!-- <group name="REAL_TIME_STREAMING">
<param name="remote">"/rtLoggingVectorCollections"</param>
</group> -->

<param name="enable_real_time_logging" extern-name="enable_real_time_logging">false</param>
<group name="REAL_TIME_STREAMING">
<param name="remote">"/yarp-robot-logger/rt_logging"</param>
</group>

<group name="Telemetry">
<param name="save_period">1800.0</param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ BSD-3-Clause license. -->
<param name="text_logging_subnames">("ergocub-torso/yarprobotinterface")</param>
<param name="code_status_cmd_prefixes">("ssh [email protected]" "ssh [email protected]")</param>

<param name="enable_real_time_logging" extern-name="enable_real_time_logging">false</param>
<group name="REAL_TIME_STREAMING">
<param name="remote">"/yarp-robot-logger/rt_logging"</param>
</group>

<group name="Telemetry">
<param name="save_period">1800.0</param>
</group>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ BSD-3-Clause license. -->
<param name="maximum_admissible_time_step">1.0</param>
<param name="log_text">true</param>

<param name="enable_real_time_logging" extern-name="enable_real_time_logging">false</param>
<group name="REAL_TIME_STREAMING">
<param name="remote">"/yarp-robot-logger/rt_logging"</param>
</group>

<group name="Telemetry">
<param name="save_period">600.0</param>
</group>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ BSD-3-Clause license. -->
<param name="text_logging_subnames">("icub-head/yarprobotinterface")</param>
<param name="code_status_cmd_prefixes">("ssh [email protected]" "ssh [email protected]")</param>

<param name="enable_real_time_logging" extern-name="enable_real_time_logging">false</param>
<group name="REAL_TIME_STREAMING">
<param name="remote">"/yarp-robot-logger/rt_logging"</param>
</group>

<group name="Telemetry">
<param name="save_period">600.0</param>
</group>
Expand Down
31 changes: 22 additions & 9 deletions devices/YarpRobotLoggerDevice/src/YarpRobotLoggerDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,20 @@ bool YarpRobotLoggerDevice::open(yarp::os::Searchable& config)

constexpr auto logPrefix = "[YarpRobotLoggerDevice::open]";
auto params = std::make_shared<ParametersHandler::YarpImplementation>(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);
Expand All @@ -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);
}
Expand All @@ -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 "
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -1224,22 +1235,24 @@ 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);
}
}
}

signal.connected = connectionDone;

}
};

Expand Down
5 changes: 5 additions & 0 deletions devices/YarpRobotLoggerDevice/tests/yarp-robot-logger.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ BSD-3-Clause license. -->
<param name="text_logging_subnames">("ergocub-torso/yarprobotinterface")</param>
<param name="maximum_admissible_time_step">1.0</param>

<param name="enable_real_time_logging" extern-name="enable_real_time_logging">false</param>
<group name="REAL_TIME_STREAMING">
<param name="remote">"/yarp-robot-logger/rt_logging"</param>
</group>

<group name="Telemetry">
<param name="save_period">20.0</param>
</group>
Expand Down

0 comments on commit 4eed865

Please sign in to comment.