Skip to content
Snippets Groups Projects
Commit 0d8e3677 authored by Raphael Grimm's avatar Raphael Grimm
Browse files

Modernize code and add comments

parent 45657994
No related branches found
No related tags found
No related merge requests found
...@@ -335,18 +335,19 @@ namespace armarx ...@@ -335,18 +335,19 @@ namespace armarx
} }
//sens //sens
{ {
//sensors
for (std::size_t idxDev = 0; idxDev < data.sensors.size(); ++ idxDev) for (std::size_t idxDev = 0; idxDev < data.sensors.size(); ++ idxDev)
{ {
const SensorValueBase* val = data.sensors.at(idxDev); const SensorValueBase* val = data.sensors.at(idxDev);
//dimensions of sensor value (e.g. vel, tor, f_x, f_y, ...)
for (std::size_t idxField = 0; idxField < val->getNumberOfDataFields(); ++ idxField) for (std::size_t idxField = 0; idxField < val->getNumberOfDataFields(); ++ idxField)
{ {
const auto str = val->getDataFieldAsString(idxField); const auto str = val->getDataFieldAsString(idxField);
for (auto& pair : rtLoggingEntries) for (auto& [_, entry] : rtLoggingEntries)
{ {
CSVLoggingEntry& e = *pair.second; if (entry->loggedSensorDeviceValues.at(idxDev).at(idxField))
if (e.loggedSensorDeviceValues.at(idxDev).at(idxField))
{ {
pair.second->stream << ";" << str; entry->stream << ";" << str;
} }
} }
} }
...@@ -354,21 +355,23 @@ namespace armarx ...@@ -354,21 +355,23 @@ namespace armarx
} }
//ctrl //ctrl
{ {
//joint controllers
for (std::size_t idxDev = 0; idxDev < data.control.size(); ++ idxDev) for (std::size_t idxDev = 0; idxDev < data.control.size(); ++ idxDev)
{ {
const auto& vals = data.control.at(idxDev); const auto& vals = data.control.at(idxDev);
//control value (e.g. v_platform)
for (std::size_t idxVal = 0; idxVal < vals.size(); ++idxVal) for (std::size_t idxVal = 0; idxVal < vals.size(); ++idxVal)
{ {
const ControlTargetBase* val = vals.at(idxVal); const ControlTargetBase* val = vals.at(idxVal);
//dimensions of control value (e.g. v_platform_x, v_platform_y, v_platform_rotate)
for (std::size_t idxField = 0; idxField < val->getNumberOfDataFields(); ++ idxField) for (std::size_t idxField = 0; idxField < val->getNumberOfDataFields(); ++ idxField)
{ {
const auto str = val->getDataFieldAsString(idxField); const auto str = val->getDataFieldAsString(idxField);
for (auto& pair : rtLoggingEntries) for (auto& [_, entry] : rtLoggingEntries)
{ {
CSVLoggingEntry& e = *pair.second; if (entry->loggedControlDeviceValues.at(idxDev).at(idxVal).at(idxField))
if (e.loggedControlDeviceValues.at(idxDev).at(idxVal).at(idxField))
{ {
pair.second->stream << ";" << str; entry->stream << ";" << str;
} }
} }
} }
......
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