From 5e1ff54b7a476416608a3550dc7145004c9a0aeb Mon Sep 17 00:00:00 2001
From: Raphael Grimm <raphael.grimm@kit.edu>
Date: Mon, 17 May 2021 15:53:57 +0200
Subject: [PATCH] Change ExampleMemoryClient

* commit data every iteration
* add some changing data (set the_double to sin of the current time)
* increase frequency of run
* add comments
---
 .../ExampleMemoryClient/ExampleMemoryClient.cpp    | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/source/RobotAPI/components/armem/client/ExampleMemoryClient/ExampleMemoryClient.cpp b/source/RobotAPI/components/armem/client/ExampleMemoryClient/ExampleMemoryClient.cpp
index 5ed005e7a..5d549351f 100644
--- a/source/RobotAPI/components/armem/client/ExampleMemoryClient/ExampleMemoryClient.cpp
+++ b/source/RobotAPI/components/armem/client/ExampleMemoryClient/ExampleMemoryClient.cpp
@@ -132,11 +132,15 @@ namespace armarx
             queryExampleData();
         }
 
-        CycleUtil c(1000);
+        CycleUtil c(100);
         int i = 0;
-        while (!task->isStopped() && i++ < 100)
+        while (!task->isStopped())
         {
-            commitSingleSnapshot(entityID);
+            commitExampleData();
+            if (i++ < 100)
+            {
+                commitSingleSnapshot(entityID);
+            }
             c.waitForCycleDuration();
         }
     }
@@ -311,6 +315,7 @@ namespace armarx
 
         armem::Time time = armem::Time::now();
         armem::Commit commit;
+        //default
         {
             armem::EntityUpdate& update = commit.updates.emplace_back();
             update.entityID = providerID.withEntityName("default");
@@ -319,6 +324,7 @@ namespace armarx
             armem::example::ExampleData primitive;
             update.instancesData = { primitive.toAron() };
         }
+        //the answer
         {
             armem::EntityUpdate& update = commit.updates.emplace_back();
             update.entityID = providerID.withEntityName("the answer");
@@ -326,7 +332,7 @@ namespace armarx
 
             armem::example::ExampleData data;
             data.the_bool = true;
-            data.the_double = 2 * 42.42;
+            data.the_double = std::sin(time.toSecondsDouble());
             data.the_float = 21.5;
             data.the_int = 42;
             data.the_long = 424242;
-- 
GitLab