Skip to content
Snippets Groups Projects
Commit 00384aa5 authored by Peter Kaiser's avatar Peter Kaiser
Browse files

HapticObserver: Offer individual components of a haptic matrix

parent 466a5c52
No related branches found
No related tags found
No related merge requests found
......@@ -61,6 +61,7 @@ void HapticObserver::reportSensorValues(const std::string& device, const std::st
float max = eigenMatrix.maxCoeff();
float mean = eigenMatrix.mean();
std::string channelName = name;
Eigen::MatrixXf M = matrix->toEigen();
if (!existsChannel(channelName))
{
......@@ -72,6 +73,17 @@ void HapticObserver::reportSensorValues(const std::string& device, const std::st
offerDataFieldWithDefault(channelName, "mean", Variant(mean), "Mean value");
offerDataFieldWithDefault(channelName, "timestamp", timestampPtr, "Timestamp");
offerDataFieldWithDefault(channelName, "rate", Variant(0.0f), "Sample rate");
for (int i = 0; i < M.rows(); i++)
{
for (int j = 0; j < M.cols(); j++)
{
std::stringstream s;
s << "entry_" << i << "," << j;
offerDataFieldWithDefault(channelName, s.str(), Variant(M(i, j)), "Individual matrix entry");
}
}
ARMARX_INFO << "Offering new channel: " << channelName;
}
else
......@@ -82,6 +94,17 @@ void HapticObserver::reportSensorValues(const std::string& device, const std::st
setDataField(channelName, "max", Variant(max));
setDataField(channelName, "mean", Variant(mean));
setDataField(channelName, "timestamp", timestampPtr);
for (int i = 0; i < M.rows(); i++)
{
for (int j = 0; j < M.cols(); j++)
{
std::stringstream s;
s << "entry_" << i << "," << j;
setDataField(channelName, s.str(), Variant(M(i, j)));
}
}
}
/*if(statistics.count(device) > 0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment