Skip to content
Snippets Groups Projects

Add class and component MemoryToDebugObserver

Merged Rainer Kartmann requested to merge memory-plotter into master
4 files
+ 138
50
Compare changes
  • Side-by-side
  • Inline
Files
4
@@ -22,6 +22,8 @@
#include "Component.h"
#include <SimoxUtility/json.h>
#include <ArmarXCore/core/time/Frequency.h>
#include <ArmarXCore/core/time/Metronome.h>
@@ -34,6 +36,39 @@ namespace armarx::memory_to_debug_observer
armarx::PropertyDefinitionsPtr defs =
new ComponentPropertyDefinitions(getConfigIdentifier());
{
armem::MemoryID robotEntityId{"RobotState", "Proprioception", "Armar7", "Armar7"};
std::vector<std::string> jointNames{
"Neck_1_Yaw",
"Neck_2_Hemisphere_A",
"Neck_3_Hemisphere_B",
};
for (const std::string& jointName : jointNames)
{
std::vector<std::string> attributes{
"position",
"velocity",
};
for (const std::string& attribute : attributes)
{
properties.memoryToDebugObserver.plottedValues.push_back({
.entityID = robotEntityId,
.aronPath = {{"joints", attribute, jointName}},
});
}
}
simox::json::json j = properties.memoryToDebugObserver;
properties.memoryToDebugObserverJson = j.dump();
}
defs->optional(properties.memoryToDebugObserverJson,
"p.memoryToDebugObserverJson",
"Configuration of MemoryToDebugObserver in JSON format.");
defs->optional(properties.pollFrequencyHz, "p.pollFrequencyHz");
return defs;
}
@@ -52,27 +87,9 @@ namespace armarx::memory_to_debug_observer
{
DebugObserverComponentPluginUser::setDebugObserverBatchModeEnabled(true);
armem::MemoryID robotEntityId{"RobotState", "Proprioception", "Armar7", "Armar7"};
std::vector<std::string> jointNames{
"Neck_1_Yaw",
"Neck_2_Hemisphere_A",
"Neck_3_Hemisphere_B",
};
for (const std::string& jointName : jointNames)
{
std::vector<std::string> attributes{
"position",
"velocity",
};
for (const std::string& attribute : attributes)
{
properties.memoryToDebugObserver.plottedValues.push_back({
.entityID = robotEntityId,
.aronPath = {{"joints", attribute, jointName}},
});
}
simox::json::json j = simox::json::json::parse(properties.memoryToDebugObserverJson);
j.get_to(properties.memoryToDebugObserver);
}
}
@@ -108,7 +125,7 @@ namespace armarx::memory_to_debug_observer
armem::client::util::MemoryToDebugObserver memoryToDebugObserver{
properties.memoryToDebugObserver, services};
Frequency frequency = Frequency::Hertz(30);
Frequency frequency = Frequency::Hertz(properties.pollFrequencyHz);
Metronome metronome(frequency);
while (task and not task->isStopped())
{
@@ -122,11 +139,10 @@ namespace armarx::memory_to_debug_observer
{
using namespace armarx::RemoteGui::Client;
if (tab.queryResult)
{
}
tab.group = GroupBox();
tab.group.setLabel("Todo ...");
VBoxLayout root = {tab.queryResultGroup, VSpacer()};
VBoxLayout root = {tab.group, VSpacer()};
RemoteGui_createTab(getName(), root, &tab);
}
Loading