Skip to content
Snippets Groups Projects
Commit 16631cc1 authored by Fabian Reister's avatar Fabian Reister
Browse files

robot reader: reusing memory reader

parent 040ec7fe
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,7 @@
#include <ArmarXCore/core/exceptions/local/ExpressionException.h>
#include <ArmarXCore/core/logging/Logging.h>
#include <ArmarXCore/core/time/Clock.h>
#include <ArmarXCore/core/time/Duration.h>
#include "RobotAPI/libraries/armem_robot_state/client/common/constants.h"
#include "RobotAPI/libraries/armem_robot_state/common/localization/types.h"
......@@ -49,11 +50,14 @@ namespace armarx::armem::robot_state
{
transformReader.connect(memoryNameSystem);
armarx::Clock::WaitFor(armarx::Duration::MilliSeconds(200));
// Wait for the memory to become available and add it as dependency.
ARMARX_INFO << "RobotReader: Waiting for memory '" << constants::memoryName << "' ...";
try
{
memoryReader = memoryNameSystem.useReader(constants::memoryName);
// memoryReader = memoryNameSystem.useReader(constants::memoryName);
memoryReader = transformReader.getMemoryReader();
ARMARX_INFO << "RobotReader: Connected to memory '" << constants::memoryName << "'";
}
catch (const armem::error::CouldNotResolveMemoryServer& e)
......
......@@ -58,6 +58,8 @@ namespace armarx::armem::robot_state::client::localization
void registerPropertyDefinitions(::armarx::PropertyDefinitionsPtr& def) override;
armem::client::Reader getMemoryReader(){return memoryReader;}
private:
armem::client::Reader memoryReader;
mutable std::mutex memoryReaderMutex;
......
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