Skip to content
Snippets Groups Projects
Commit 2192e170 authored by Rainer Kartmann's avatar Rainer Kartmann
Browse files

Update ExampleMemoryClient

parent f199b716
No related branches found
No related tags found
No related merge requests found
......@@ -118,12 +118,12 @@ ArmarX.ArMemExampleClient.tpc.sub.MemoryListener = MemoryUpdates
# ArmarX.ExampleMemoryClient.RemoteGuiName = RemoteGuiProvider
# ArmarX.ExampleMemoryClient.mem.MemoryName: Name of the memory to use.
# ArmarX.ExampleMemoryClient.mem.UsedMemoryName: Name of the memory to use.
# Attributes:
# - Default: Example
# - Case sensitivity: yes
# - Required: no
# ArmarX.ExampleMemoryClient.mem.MemoryName = Example
# ArmarX.ExampleMemoryClient.mem.UsedMemoryName = Example
# ArmarX.ExampleMemoryClient.mns.MemoryNameSystemEnabled: Whether to use (and depend on) the Memory Name System (MNS).
......
......@@ -32,6 +32,7 @@
#include <RobotAPI/libraries/armem/server/MemoryRemoteGui.h>
#include <RobotAPI/libraries/armem/client/query/Builder.h>
#include <RobotAPI/libraries/armem/client/query/query_fns.h>
#include <RobotAPI/libraries/armem/core/error.h>
#include <RobotAPI/libraries/armem/core/workingmemory/ice_conversions.h>
#include <RobotAPI/components/armem/server/ExampleMemory/aron/ExampleData.aron.generated.h>
......@@ -50,7 +51,7 @@ namespace armarx
defs->topic(debugObserver);
defs->optional(memoryName, "mem.MemoryName", "Name of the memory to use.");
defs->optional(p.usedMemoryName, "mem.UsedMemoryName", "Name of the memory to use.");
return defs;
}
......@@ -72,11 +73,15 @@ namespace armarx
RemoteGui_startRunningTask();
// Wait for the memory to become available and add it as dependency.
ARMARX_IMPORTANT << "Waiting for memory '" << memoryName << "' ...";
auto result = useMemory(memoryName);
if (!result.success)
ARMARX_IMPORTANT << "Waiting for memory '" << p.usedMemoryName << "' ...";
try
{
ARMARX_ERROR << result.errorMessage;
armem::client::ComponentPluginUser::setMemoryServer(memoryNameSystem.useServer(p.usedMemoryName));
}
catch (const armem::error::CouldNotResolveMemoryServer& e)
{
ARMARX_ERROR << e.what();
return;
}
// Add a provider segment to commit to.
......@@ -179,7 +184,7 @@ namespace armarx
auto cos = std::make_shared<aron::datanavigator::FloatNavigator>(std::cos(diff));
auto sqrt = std::make_shared<aron::datanavigator::DoubleNavigator>(std::sqrt(diff));
auto lin = std::make_shared<aron::datanavigator::LongNavigator>((long)(diff * 1000));
auto lin = std::make_shared<aron::datanavigator::LongNavigator>(static_cast<long>(diff * 1000));
auto rand = std::make_shared<aron::datanavigator::IntNavigator>(std::rand());
dict1->addElement("sin", sin);
......
......@@ -112,16 +112,22 @@ namespace armarx
void commitExampleData();
void queryExampleData();
private:
struct Properties
{
std::string usedMemoryName = "Example";
};
Properties p;
IceUtil::Time run_started;
armarx::RunningTask<ExampleMemoryClient>::pointer_type task;
armarx::DebugObserverInterfacePrx debugObserver;
std::string memoryName = "Example";
struct RemoteGuiTab : RemoteGui::Client::Tab
{
std::atomic_bool rebuild = false;
......
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