From 5b028e60dd1e222289cd3a5c2a3e475e247de965 Mon Sep 17 00:00:00 2001 From: Rainer Kartmann <rainer.kartmann@kit.edu> Date: Tue, 12 Jan 2021 11:54:57 +0100 Subject: [PATCH] Tweak example --- .../ArMemExampleClient/ArMemExampleClient.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/source/RobotAPI/components/armem/ArMemExampleClient/ArMemExampleClient.cpp b/source/RobotAPI/components/armem/ArMemExampleClient/ArMemExampleClient.cpp index c964031dd..f2e8c9683 100644 --- a/source/RobotAPI/components/armem/ArMemExampleClient/ArMemExampleClient.cpp +++ b/source/RobotAPI/components/armem/ArMemExampleClient/ArMemExampleClient.cpp @@ -79,9 +79,12 @@ namespace armarx entityID = providerID.withEntityName("example_entity"); // Subscribe to example_entity updates - memoryReader.subscribe(entityID, [&](const armem::MemoryID & sid, const std::vector<armem::MemoryID>& sids) + memoryReader.subscribe(entityID, [&]( + const armem::MemoryID & entityID, + const std::vector<armem::MemoryID>& snapshotIDs) { - example_entityUpdated(sid); + (void) snapshotIDs; + example_entityUpdated(entityID); }); task = new RunningTask<ArMemExampleClient>(this, &ArMemExampleClient::run); @@ -123,6 +126,13 @@ namespace armarx commitPrimitives(writer); queryPrimitives(reader); } + + CycleUtil c(500); + while (!task->isStopped()) + { + commitSingleSnapshot(writer, entityID); + c.waitForCycleDuration(); + } } @@ -232,7 +242,7 @@ namespace armarx void ArMemExampleClient::example_entityUpdated(const armem::MemoryID& id) { - ARMARX_IMPORTANT << "example_entity got updated: " << id; + ARMARX_IMPORTANT << "############### example_entity got updated: " << id << " ##################"; // Fetch new data of example_entity and do something with it. } -- GitLab