This PR introduces metadata for the VectorsCollection, allowing each component of the vector saved by the logger to have a specific label. This enhancement simplifies data analysis, as it enables the display of associated labels in the robot-log-visualizer, as shown in the following image:
To ensure metadata consistency, I've implemented it using the client-server paradigm in YARP. I declared the VectorsCollectionMetadataService in VectorsCollection.thrift. This change enables asynchronous metadata requests for a specific VectorsCollection. This is done thanks to the VectorsCollectionServer and VectorsCollectionClient
In this context, the YarpRobotLoggerDevice functions as a client (VectorsCollectionClient), while the server must be implemented in the application sending the data.
Here's an example of how to use VectorsCollectionServer in your code:
#include <BipedalLocomotion/YarpUtilities/VectorsCollectionServer.h>
class Module
{
BipedalLocomotion::YarpUtilities::VectorsCollectionServer m_vectorsCollectionServer; /**< Logger server. */
public:
// all the other functions you need
}
The m_vectorsCollectionServer helps you to handle the data you want to send and to populate the metadata. To use this functionality, call BipedalLocomotion::YarpUtilities::VectorsCollectionServer::populateMetadata during the configuration phase. Once you have finished populating the metadata you should call BipedalLocomotion::YarpUtilities::VectorsCollectionServer::finalizeMetadata
//This code should go into the configuration phase
auto loggerOption = std::make_shared<BipedalLocomotion::ParametersHandler::YarpImplementation>(rf);
if (!m_vectorsCollectionServer.initialize(loggerOption->getGroup("WALKING_LOGGER")))
{
log()->error("[WalkingModule::configure] Unable to configure the server.");
return false;
}
m_vectorsCollectionServer.populateMetadata("dcm::position::measured", {"x", "y"});
m_vectorsCollectionServer.populateMetadata("dcm::position::desired", {"x", "y"});
m_vectorsCollectionServer.finalizeMetadata();
In the main loop, add the following code to prepare and populate the data:
m_vectorsCollectionServer.clearData(); // optional see the documentation
// DCM
m_vectorsCollectionServer.populateData("dcm::position::measured", <signal>);
m_vectorsCollectionServer.populateData("dcm::position::desired", <signal>);
m_vectorsCollectionServer.sendData();
⚠️ This PR breaks all the code that uses the YarpRobotLoggerDevice for logging exogenous signals (cc @G-Cervettini @isorrentino)
This is an example of updated application that allows you to correctly fill the metadata: https://github.com/robotology/walking-controllers/pull/158
This PR substitutes https://github.com/ami-iit/bipedal-locomotion-framework/pull/732.
This PR introduces metadata for the
VectorsCollection
, allowing each component of the vector saved by the logger to have a specific label. This enhancement simplifies data analysis, as it enables the display of associated labels in the robot-log-visualizer, as shown in the following image:To ensure metadata consistency, I've implemented it using the client-server paradigm in YARP. I declared the
VectorsCollectionMetadataService
inVectorsCollection.thrift
. This change enables asynchronous metadata requests for a specific VectorsCollection. This is done thanks to theVectorsCollectionServer
andVectorsCollectionClient
In this context, the
YarpRobotLoggerDevice
functions as a client (VectorsCollectionClient
), while the server must be implemented in the application sending the data.Here's an example of how to use
VectorsCollectionServer
in your code:The
m_vectorsCollectionServer
helps you to handle the data you want to send and to populate the metadata. To use this functionality, callBipedalLocomotion::YarpUtilities::VectorsCollectionServer::populateMetadata
during the configuration phase. Once you have finished populating the metadata you should callBipedalLocomotion::YarpUtilities::VectorsCollectionServer::finalizeMetadata
In the main loop, add the following code to prepare and populate the data:
⚠️ This PR breaks all the code that uses the YarpRobotLoggerDevice for logging exogenous signals (cc @G-Cervettini @isorrentino) This is an example of updated application that allows you to correctly fill the metadata: https://github.com/robotology/walking-controllers/pull/158