diff --git a/source/RobotAPI/components/InteractiveMemoryEditor/Editor.cpp b/source/RobotAPI/components/InteractiveMemoryEditor/Editor.cpp index 003b5d4560a26f6c427e13687de4263ffec0fcc5..9ad32d663a64a86b41022dbf22b45837979820be 100644 --- a/source/RobotAPI/components/InteractiveMemoryEditor/Editor.cpp +++ b/source/RobotAPI/components/InteractiveMemoryEditor/Editor.cpp @@ -15,22 +15,22 @@ namespace armarx , pushToMemory(std::move(pushToMemory)) , pullFromMemory(std::move(pullFromMemory)) , isCommitRequired(false) - , isPullRequired(true) + , isUpdateRequired(true) , isMemoryVizRequired(true) , isMetaVizRequired(true) { } - void Editor::update() + void Editor::step() { viz::StagedCommit stage = client.stage(); - if (isPullRequired) + if (isUpdateRequired) { - storedPoses = pull(); + storedPoses = update(); - isPullRequired = false; + isUpdateRequired = false; } if (isMemoryVizRequired) @@ -64,12 +64,10 @@ namespace armarx } objpose::ObjectPoseSeq - Editor::pull() + Editor::update() { objpose::ObjectPoseSeq newRequestedPoses = pullFromMemory(); - changes.clear(); - isMemoryVizRequired = true; return newRequestedPoses; @@ -180,6 +178,10 @@ namespace armarx { isCommitRequired = true; }) + .onContextMenu(description.updateIndex, [&] + { + isUpdateRequired = true; + }) .onTransformEnd([&](const Eigen::Matrix4f& transform) { changes.moveObject(objectPose, transform); @@ -254,9 +256,9 @@ namespace armarx if (kind == MOVE) { description.options.emplace_back("Clone"); - description.options.emplace_back("Delete"); - description.cloneIndex = currentIndex++; + + description.options.emplace_back("Delete"); description.deleteIndex = currentIndex++; } @@ -290,6 +292,9 @@ namespace armarx description.options.emplace_back("Commit All Changes"); description.commitIndex = currentIndex++; + description.options.emplace_back("Update Unchanged"); + description.updateIndex = currentIndex; // ++ + return description; } diff --git a/source/RobotAPI/components/InteractiveMemoryEditor/Editor.h b/source/RobotAPI/components/InteractiveMemoryEditor/Editor.h index 6e0fe6d3289afb798ce62f6b73f4feaacfe26745..1ba3dc26431eb590020423fb10e8aea5ce8a8aba 100644 --- a/source/RobotAPI/components/InteractiveMemoryEditor/Editor.h +++ b/source/RobotAPI/components/InteractiveMemoryEditor/Editor.h @@ -17,7 +17,7 @@ namespace armarx explicit Editor(viz::Client& client, std::function<void(objpose::ProvidedObjectPoseSeq&)> pushToMemory, std::function<objpose::ObjectPoseSeq(void)> pullFromMemory); - void update(); + void step(); private: static constexpr const char* memoryLayerName = "Memory"; @@ -47,6 +47,7 @@ namespace armarx size_t deleteIndex = std::numeric_limits<size_t>::max(); size_t resetIndex = std::numeric_limits<size_t>::max(); size_t commitIndex = std::numeric_limits<size_t>::max(); + size_t updateIndex = std::numeric_limits<size_t>::max(); }; class ChangeState @@ -87,7 +88,7 @@ namespace armarx ChangeState changes; bool isCommitRequired; - bool isPullRequired; + bool isUpdateRequired; bool isMemoryVizRequired; bool isMetaVizRequired; @@ -95,7 +96,7 @@ namespace armarx void visualizeMeta(); void commit(); - objpose::ObjectPoseSeq pull(); + objpose::ObjectPoseSeq update(); void visualizeObject(objpose::ObjectPose &objectPose); }; diff --git a/source/RobotAPI/components/InteractiveMemoryEditor/InteractiveMemoryEditor.cpp b/source/RobotAPI/components/InteractiveMemoryEditor/InteractiveMemoryEditor.cpp index cefc8cb552b3fd643618f85f3488df94462e7ed2..db698cfbc3784fe299ffde171667b01137504b06 100644 --- a/source/RobotAPI/components/InteractiveMemoryEditor/InteractiveMemoryEditor.cpp +++ b/source/RobotAPI/components/InteractiveMemoryEditor/InteractiveMemoryEditor.cpp @@ -72,7 +72,7 @@ namespace armarx while (objectVizTask and not objectVizTask->isStopped()) { - editor.update(); + editor.step(); cycle.waitForCycleDuration(); }