Skip to content

Commit

Permalink
Turned log data into a lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
nicktrem committed Mar 6, 2024
1 parent a91ee01 commit 0888c96
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,6 @@ class YarpRobotLoggerDevice : public yarp::dev::DeviceDriver,
void lookForExogenousSignals();

bool initMetadata(const std::string& nameKey, const std::vector<std::string>& metadata);
void logData(const std::string& name,
const Eigen::VectorXd& data,
const double time);

bool hasSubstring(const std::string& str, const std::vector<std::string>& substrings) const;
void recordVideo(const std::string& cameraName, VideoWriter& writer);
Expand Down
22 changes: 11 additions & 11 deletions devices/YarpRobotLoggerDevice/src/YarpRobotLoggerDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -639,17 +639,6 @@ bool YarpRobotLoggerDevice::initMetadata(const std::string& nameKey, const std::
return ok;
}

void YarpRobotLoggerDevice::logData(const std::string& name,
const Eigen::VectorXd& data,
const double time)
{
m_bufferManager.push_back(data, time, name);
std::string rtName = robotRtRootName + treeDelim + name;
if (m_sendDataRT)
{
m_vectorCollectionRTDataServer.populateData(rtName, data);
}
}

bool YarpRobotLoggerDevice::attachAll(const yarp::dev::PolyDriverList& poly)
{
Expand Down Expand Up @@ -1354,6 +1343,17 @@ void YarpRobotLoggerDevice::recordVideo(const std::string& cameraName, VideoWrit

void YarpRobotLoggerDevice::run()
{
auto logData = [this](const std::string& name,
const auto& data,
const double time) {
m_bufferManager.push_back(data, time, name);
std::string rtName = robotRtRootName + treeDelim + name;
if (m_sendDataRT)
{
m_vectorCollectionRTDataServer.populateData(rtName, data);
}
};

constexpr auto logPrefix = "[YarpRobotLoggerDevice::run]";
const double time = std::chrono::duration<double>(BipedalLocomotion::clock().now()).count();
std::string signalFullName = "";
Expand Down

0 comments on commit 0888c96

Please sign in to comment.