Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • sw/armarx/robot-api
  • uwkce_singer/robot-api
  • untcg_hofmann/robot-api
  • ulqba_korosakov/RobotAPI
4 results
Show changes
Commits on Source (61)
Showing
with 224 additions and 131 deletions
...@@ -60,152 +60,200 @@ ...@@ -60,152 +60,200 @@
# ArmarX.ComponentConfigTest.RemoteGuiName = RemoteGuiProvider # ArmarX.ComponentConfigTest.RemoteGuiName = RemoteGuiProvider
# ArmarX.ComponentConfigTest.boolMember: # ArmarX.ComponentConfigTest.TestConfig.boolMember:
# Attributes: # Attributes:
# - Default: true # - Default: true
# - Case sensitivity: yes # - Case sensitivity: yes
# - Required: no # - Required: no
# - Possible values: {0, 1, false, no, true, yes} # - Possible values: {0, 1, false, no, true, yes}
# ArmarX.ComponentConfigTest.boolMember = true # ArmarX.ComponentConfigTest.TestConfig.boolMember = true
# ArmarX.ComponentConfigTest.floatMember: # ArmarX.ComponentConfigTest.TestConfig.floatMember:
# Attributes: # Attributes:
# - Default: 100 # - Default: 100
# - Case sensitivity: yes # - Case sensitivity: yes
# - Required: no # - Required: no
# ArmarX.ComponentConfigTest.floatMember = 100 # ArmarX.ComponentConfigTest.TestConfig.floatMember = 100
# ArmarX.ComponentConfigTest.intMember: # ArmarX.ComponentConfigTest.TestConfig.intMember:
# Attributes: # Attributes:
# - Default: 1000 # - Default: 1000
# - Case sensitivity: yes # - Case sensitivity: yes
# - Required: no # - Required: no
# ArmarX.ComponentConfigTest.intMember = 1000 # ArmarX.ComponentConfigTest.TestConfig.intMember = 1000
# ArmarX.ComponentConfigTest.stringMember: # ArmarX.ComponentConfigTest.TestConfig.orientation.header.agent:
# Attributes:
# - Default: ""
# - Case sensitivity: yes
# - Required: no
# ArmarX.ComponentConfigTest.TestConfig.orientation.header.agent = ""
# ArmarX.ComponentConfigTest.TestConfig.orientation.header.frame:
# Attributes:
# - Default: ""
# - Case sensitivity: yes
# - Required: no
# ArmarX.ComponentConfigTest.TestConfig.orientation.header.frame = ""
# ArmarX.ComponentConfigTest.TestConfig.pose.header.agent:
# Attributes:
# - Default: ""
# - Case sensitivity: yes
# - Required: no
# ArmarX.ComponentConfigTest.TestConfig.pose.header.agent = ""
# ArmarX.ComponentConfigTest.TestConfig.pose.header.frame:
# Attributes:
# - Default: ""
# - Case sensitivity: yes
# - Required: no
# ArmarX.ComponentConfigTest.TestConfig.pose.header.frame = ""
# ArmarX.ComponentConfigTest.TestConfig.position.header.agent:
# Attributes:
# - Default: ""
# - Case sensitivity: yes
# - Required: no
# ArmarX.ComponentConfigTest.TestConfig.position.header.agent = ""
# ArmarX.ComponentConfigTest.TestConfig.position.header.frame:
# Attributes:
# - Default: ""
# - Case sensitivity: yes
# - Required: no
# ArmarX.ComponentConfigTest.TestConfig.position.header.frame = ""
# ArmarX.ComponentConfigTest.TestConfig.stringMember:
# Attributes: # Attributes:
# - Default: initial # - Default: initial
# - Case sensitivity: yes # - Case sensitivity: yes
# - Required: no # - Required: no
# ArmarX.ComponentConfigTest.stringMember = initial # ArmarX.ComponentConfigTest.TestConfig.stringMember = initial
# ArmarX.ComponentConfigTest.subMember.boolMember: # ArmarX.ComponentConfigTest.TestConfig.subMember.boolMember:
# Attributes: # Attributes:
# - Default: false # - Default: false
# - Case sensitivity: yes # - Case sensitivity: yes
# - Required: no # - Required: no
# - Possible values: {0, 1, false, no, true, yes} # - Possible values: {0, 1, false, no, true, yes}
# ArmarX.ComponentConfigTest.subMember.boolMember = false # ArmarX.ComponentConfigTest.TestConfig.subMember.boolMember = false
# ArmarX.ComponentConfigTest.subMember.doubleMember: # ArmarX.ComponentConfigTest.TestConfig.subMember.doubleMember:
# Attributes: # Attributes:
# - Default: 0 # - Default: 0
# - Case sensitivity: yes # - Case sensitivity: yes
# - Required: no # - Required: no
# ArmarX.ComponentConfigTest.subMember.doubleMember = 0 # ArmarX.ComponentConfigTest.TestConfig.subMember.doubleMember = 0
# ArmarX.ComponentConfigTest.subMember.floatMember: # ArmarX.ComponentConfigTest.TestConfig.subMember.floatMember:
# Attributes: # Attributes:
# - Default: 0 # - Default: 0
# - Case sensitivity: yes # - Case sensitivity: yes
# - Required: no # - Required: no
# ArmarX.ComponentConfigTest.subMember.floatMember = 0 # ArmarX.ComponentConfigTest.TestConfig.subMember.floatMember = 0
# ArmarX.ComponentConfigTest.subMember.intMember: # ArmarX.ComponentConfigTest.TestConfig.subMember.intMember:
# Attributes: # Attributes:
# - Default: 0 # - Default: 0
# - Case sensitivity: yes # - Case sensitivity: yes
# - Required: no # - Required: no
# ArmarX.ComponentConfigTest.subMember.intMember = 0 # ArmarX.ComponentConfigTest.TestConfig.subMember.intMember = 0
# ArmarX.ComponentConfigTest.subMember.stringMember: # ArmarX.ComponentConfigTest.TestConfig.subMember.stringMember:
# Attributes: # Attributes:
# - Default: "" # - Default: ""
# - Case sensitivity: yes # - Case sensitivity: yes
# - Required: no # - Required: no
# ArmarX.ComponentConfigTest.subMember.stringMember = "" # ArmarX.ComponentConfigTest.TestConfig.subMember.stringMember = ""
# ArmarX.ComponentConfigTest.subMember.subsubMember.boolMember: # ArmarX.ComponentConfigTest.TestConfig.subMember.subsubMember.boolMember:
# Attributes: # Attributes:
# - Default: false # - Default: false
# - Case sensitivity: yes # - Case sensitivity: yes
# - Required: no # - Required: no
# - Possible values: {0, 1, false, no, true, yes} # - Possible values: {0, 1, false, no, true, yes}
# ArmarX.ComponentConfigTest.subMember.subsubMember.boolMember = false # ArmarX.ComponentConfigTest.TestConfig.subMember.subsubMember.boolMember = false
# ArmarX.ComponentConfigTest.subMember.subsubMember.enumMember: # ArmarX.ComponentConfigTest.TestConfig.subMember.subsubMember.enumMember:
# Attributes: # Attributes:
# - Default: 1 # - Default: 1
# - Case sensitivity: yes # - Case sensitivity: yes
# - Required: no # - Required: no
# - Possible values: {Bar, Baz, Foo, Qux} # - Possible values: {Bar, Baz, Foo, Qux}
# ArmarX.ComponentConfigTest.subMember.subsubMember.enumMember = 1 # ArmarX.ComponentConfigTest.TestConfig.subMember.subsubMember.enumMember = 1
# ArmarX.ComponentConfigTest.subMember.subsubMember.floatMember: # ArmarX.ComponentConfigTest.TestConfig.subMember.subsubMember.floatMember:
# Attributes: # Attributes:
# - Default: 0 # - Default: 0
# - Case sensitivity: yes # - Case sensitivity: yes
# - Required: no # - Required: no
# ArmarX.ComponentConfigTest.subMember.subsubMember.floatMember = 0 # ArmarX.ComponentConfigTest.TestConfig.subMember.subsubMember.floatMember = 0
# ArmarX.ComponentConfigTest.subMember.subsubMember.intDictMember: # ArmarX.ComponentConfigTest.TestConfig.subMember.subsubMember.intDictMember:
# Attributes: # Attributes:
# - Default: int1:1,int2:2 # - Default: int1:1,int2:2
# - Case sensitivity: yes # - Case sensitivity: yes
# - Required: no # - Required: no
ArmarX.ComponentConfigTest.subMember.subsubMember.intDictMember = int1:1,int2:2,int3:3,int5:4 # ArmarX.ComponentConfigTest.TestConfig.subMember.subsubMember.intDictMember = int1:1,int2:2
# ArmarX.ComponentConfigTest.subMember.subsubMember.intListMember: # ArmarX.ComponentConfigTest.TestConfig.subMember.subsubMember.intListMember:
# Attributes: # Attributes:
# - Default: 1, 2, 3, 4, 5, 6 # - Default: 1, 2, 3, 4, 5, 6
# - Case sensitivity: yes # - Case sensitivity: yes
# - Required: no # - Required: no
# ArmarX.ComponentConfigTest.subMember.subsubMember.intListMember = 1, 2, 3, 4, 5, 6 # ArmarX.ComponentConfigTest.TestConfig.subMember.subsubMember.intListMember = 1, 2, 3, 4, 5, 6
# ArmarX.ComponentConfigTest.subMember.subsubMember.intMember: # ArmarX.ComponentConfigTest.TestConfig.subMember.subsubMember.intMember:
# Attributes: # Attributes:
# - Default: 0 # - Default: 0
# - Case sensitivity: yes # - Case sensitivity: yes
# - Required: no # - Required: no
# ArmarX.ComponentConfigTest.subMember.subsubMember.intMember = 0 # ArmarX.ComponentConfigTest.TestConfig.subMember.subsubMember.intMember = 0
# ArmarX.ComponentConfigTest.subMember.subsubMember.stringDictMember: # ArmarX.ComponentConfigTest.TestConfig.subMember.subsubMember.stringDictMember:
# Attributes: # Attributes:
# - Default: string1:blub,string2:duh # - Default: string1:blub,string2:duh
# - Case sensitivity: yes # - Case sensitivity: yes
# - Required: no # - Required: no
# ArmarX.ComponentConfigTest.subMember.subsubMember.stringDictMember = string1:blub,string2:duh # ArmarX.ComponentConfigTest.TestConfig.subMember.subsubMember.stringDictMember = string1:blub,string2:duh
# ArmarX.ComponentConfigTest.subMember.subsubMember.stringListMember: # ArmarX.ComponentConfigTest.TestConfig.subMember.subsubMember.stringListMember:
# Attributes: # Attributes:
# - Default: a, b, c, d, e # - Default: a, b, c, d, e
# - Case sensitivity: yes # - Case sensitivity: yes
# - Required: no # - Required: no
# ArmarX.ComponentConfigTest.subMember.subsubMember.stringListMember = a, b, c, d, e # ArmarX.ComponentConfigTest.TestConfig.subMember.subsubMember.stringListMember = a, b, c, d, e
# ArmarX.ComponentConfigTest.subMember.subsubMember.stringMember: # ArmarX.ComponentConfigTest.TestConfig.subMember.subsubMember.stringMember:
# Attributes: # Attributes:
# - Default: "" # - Default: ""
# - Case sensitivity: yes # - Case sensitivity: yes
# - Required: no # - Required: no
# ArmarX.ComponentConfigTest.subMember.subsubMember.stringMember = "" # ArmarX.ComponentConfigTest.TestConfig.subMember.subsubMember.stringMember = ""
# ArmarX.Config: Comma-separated list of configuration files # ArmarX.Config: Comma-separated list of configuration files
......
...@@ -177,7 +177,39 @@ int main(int argc, char* argv[]) ...@@ -177,7 +177,39 @@ int main(int argc, char* argv[])
} }
} }
auto w = CppWriterPtr(new CppWriter()); std::time_t current_time = std::time(0);
std::tm* now = std::localtime(&current_time);
std::string current_year = std::to_string(now->tm_year + 1900);
std::string fileDoc = std::string("* This file is part of ArmarX. \n") +
"* \n" +
"* Copyright (C) 2012-" + current_year + ", High Performance Humanoid Technologies (H2T), \n" +
"* Karlsruhe Institute of Technology (KIT), all rights reserved. \n" +
"* \n" +
"* ArmarX is free software; you can redistribute it and/or modify \n" +
"* it under the terms of the GNU General Public License version 2 as \n" +
"* published by the Free Software Foundation. \n" +
"* \n" +
"* ArmarX is distributed in the hope that it will be useful, but \n" +
"* WITHOUT ANY WARRANTY; without even the implied warranty of \n" +
"* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the \n" +
"* GNU General Public License for more details. \n" +
"* \n" +
"* You should have received a copy of the GNU General Public License \n" +
"* along with this program. If not, see <http://www.gnu.org/licenses/>. \n" +
"* \n" +
"* @copyright http://www.gnu.org/licenses/gpl-2.0.txt \n" +
"* GNU General Public License \n" +
"* *********************************************************************** \n" +
"* WARNING: This file is autogenerated. \n" +
"* Original file: " + filename + " \n" +
"* Please do not edit since your changes may be overwritten on the next generation \n" +
"* If you have any questions please contact: Fabian Peller-Konrad (fabian dot peller-konrad at kit dot edu) \n" +
"* ***********************************************************************";
auto w = CppWriterPtr(new CppWriter(true, fileDoc));
w->header.line();
w->header.line();
// Generate enums at top of generated header file // Generate enums at top of generated header file
std::vector<MetaEnumPtr> enums = writer.getTypeEnums(); std::vector<MetaEnumPtr> enums = writer.getTypeEnums();
...@@ -186,7 +218,12 @@ int main(int argc, char* argv[]) ...@@ -186,7 +218,12 @@ int main(int argc, char* argv[])
std::cout << "Now exporting enums..." << std::endl; std::cout << "Now exporting enums..." << std::endl;
} }
w->body.line("/*************************************************************************");
w->body.line(" * ALL GENERATED ENUMS ***************************************************");
w->body.line(" ************************************************************************/");
MetaEnum::Write(enums, w); MetaEnum::Write(enums, w);
w->body.line();
w->body.line();
std::string enum_file_generation_content = w->getString(); std::string enum_file_generation_content = w->getString();
...@@ -208,7 +245,12 @@ int main(int argc, char* argv[]) ...@@ -208,7 +245,12 @@ int main(int argc, char* argv[])
std::cout << "Now exporting classes..." << std::endl; std::cout << "Now exporting classes..." << std::endl;
} }
w->body.line("/* ************************************************************************");
w->body.line(" * ALL GENERATED CLASSES *************************************************");
w->body.line(" * ***********************************************************************/");
CppClass::Write(classes, w); CppClass::Write(classes, w);
w->body.line();
w->body.line();
std::string class_file_generation_content = simox::alg::remove_prefix(w->getString(), enum_file_generation_content); std::string class_file_generation_content = simox::alg::remove_prefix(w->getString(), enum_file_generation_content);
...@@ -223,39 +265,7 @@ int main(int argc, char* argv[]) ...@@ -223,39 +265,7 @@ int main(int argc, char* argv[])
exit(1); exit(1);
} }
std::time_t current_time = std::time(0); std::string new_file_full_content = w->getString();
std::tm* now = std::localtime(&current_time);
std::string current_year = std::to_string(now->tm_year + 1900);
std::string new_file_header = "\
/* \n\
* This file is part of ArmarX. \n\
* \n\
* Copyright (C) 2012-" + current_year + ", High Performance Humanoid Technologies (H2T), \n\
* Karlsruhe Institute of Technology (KIT), all rights reserved. \n\
* \n\
* ArmarX is free software; you can redistribute it and/or modify \n\
* it under the terms of the GNU General Public License version 2 as \n\
* published by the Free Software Foundation. \n\
* \n\
* ArmarX is distributed in the hope that it will be useful, but \n\
* WITHOUT ANY WARRANTY; without even the implied warranty of \n\
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the \n\
* GNU General Public License for more details. \n\
* \n\
* You should have received a copy of the GNU General Public License \n\
* along with this program. If not, see <http://www.gnu.org/licenses/>. \n\
* \n\
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt \n\
* GNU General Public License \n\
************************************************************************* \n\
* WARNING: This file is autogenerated. \n\
* Original file: " + filename + " \n\
* Please do not edit since your changes may be overwritten on the next generation \n\
* If you have any questions please contact: Fabian Peller-Konrad (fabian dot peller-konrad at kit dot edu) \n\
************************************************************************* \n\
*/\n\n\n";
std::string new_file_full_content = new_file_header + w->getString();
std::string new_name_with_extension = input_file.filename().replace_extension("").string(); std::string new_name_with_extension = input_file.filename().replace_extension("").string();
new_name_with_extension += ".aron.generated.h"; new_name_with_extension += ".aron.generated.h";
......
...@@ -96,7 +96,7 @@ namespace armarx::armem ...@@ -96,7 +96,7 @@ namespace armarx::armem
armem::EntityUpdate entityUpdate; armem::EntityUpdate entityUpdate;
entityUpdate.entityID = propEntityID; entityUpdate.entityID = propEntityID;
entityUpdate.timeCreated = Time(Duration::MicroSeconds(_timestampUpdateFirstModifiedInUs)); // we take the oldest timestamp entityUpdate.referencedTime = Time(Duration::MicroSeconds(_timestampUpdateFirstModifiedInUs)); // we take the oldest timestamp
entityUpdate.instancesData = entityUpdate.instancesData =
{ {
...@@ -128,7 +128,7 @@ namespace armarx::armem ...@@ -128,7 +128,7 @@ namespace armarx::armem
armem::EntityUpdate locUpdate; armem::EntityUpdate locUpdate;
locUpdate.entityID = locEntityID; locUpdate.entityID = locEntityID;
locUpdate.timeCreated = Time(Duration::MicroSeconds(_timestampUpdateFirstModifiedInUs)); locUpdate.referencedTime = Time(Duration::MicroSeconds(_timestampUpdateFirstModifiedInUs));
locUpdate.instancesData = locUpdate.instancesData =
{ {
transform.toAron() transform.toAron()
...@@ -282,7 +282,7 @@ namespace armarx::armem ...@@ -282,7 +282,7 @@ namespace armarx::armem
entityUpdate.entityID.entityName = "Armar3"; entityUpdate.entityID.entityName = "Armar3";
entityUpdate.instancesData = { desc.toAron() }; entityUpdate.instancesData = { desc.toAron() };
entityUpdate.timeCreated = armem::Time::Now(); entityUpdate.referencedTime = armem::Time::Now();
auto res = memoryWriter.commit(c); auto res = memoryWriter.commit(c);
if (!res.allSuccess()) if (!res.allSuccess())
{ {
......
...@@ -218,9 +218,9 @@ namespace armarx ...@@ -218,9 +218,9 @@ namespace armarx
// Prepare the update with some empty instances. // Prepare the update with some empty instances.
armem::EntityUpdate update; armem::EntityUpdate update;
update.entityID = entityID; update.entityID = entityID;
update.timeCreated = armem::Time::Now(); update.referencedTime = armem::Time::Now();
double diff = (update.timeCreated - runStarted).toMilliSecondsDouble() / 1000; double diff = (update.referencedTime - runStarted).toMilliSecondsDouble() / 1000;
auto dict1 = std::make_shared<aron::data::Dict>(); auto dict1 = std::make_shared<aron::data::Dict>();
auto dict2 = std::make_shared<aron::data::Dict>(); auto dict2 = std::make_shared<aron::data::Dict>();
...@@ -265,7 +265,7 @@ namespace armarx ...@@ -265,7 +265,7 @@ namespace armarx
{ {
armem::EntityUpdate& update = commit.add(); armem::EntityUpdate& update = commit.add();
update.entityID = entityID; update.entityID = entityID;
update.timeCreated = armem::Time::Now() + armem::Duration::Seconds(i); update.referencedTime = armem::Time::Now() + armem::Duration::Seconds(i);
for (int j = 0; j < i; ++j) for (int j = 0; j < i; ++j)
{ {
update.instancesData.push_back(std::make_shared<aron::data::Dict>()); update.instancesData.push_back(std::make_shared<aron::data::Dict>());
...@@ -387,7 +387,7 @@ namespace armarx ...@@ -387,7 +387,7 @@ namespace armarx
{ {
armem::EntityUpdate& update = commit.add(); armem::EntityUpdate& update = commit.add();
update.entityID = exampleDataProviderID.withEntityName("default"); update.entityID = exampleDataProviderID.withEntityName("default");
update.timeCreated = time; update.referencedTime = time;
armem::example::ExampleData data; armem::example::ExampleData data;
toAron(data.memoryID, armem::MemoryID()); toAron(data.memoryID, armem::MemoryID());
...@@ -401,7 +401,7 @@ namespace armarx ...@@ -401,7 +401,7 @@ namespace armarx
{ {
armem::EntityUpdate& update = commit.add(); armem::EntityUpdate& update = commit.add();
update.entityID = exampleDataProviderID.withEntityName("the answer"); update.entityID = exampleDataProviderID.withEntityName("the answer");
update.timeCreated = time; update.referencedTime = time;
armem::example::ExampleData data; armem::example::ExampleData data;
data.the_bool = true; data.the_bool = true;
...@@ -488,7 +488,7 @@ namespace armarx ...@@ -488,7 +488,7 @@ namespace armarx
{ {
armem::EntityUpdate& update = commit.add(); armem::EntityUpdate& update = commit.add();
update.entityID = linkedDataProviderID.withEntityName("yet_more_data"); update.entityID = linkedDataProviderID.withEntityName("yet_more_data");
update.timeCreated = time; update.referencedTime = time;
armem::example::LinkedData data; armem::example::LinkedData data;
data.yet_another_int = 42; data.yet_another_int = 42;
...@@ -545,7 +545,7 @@ namespace armarx ...@@ -545,7 +545,7 @@ namespace armarx
{ {
armem::EntityUpdate& update = commit.add(); armem::EntityUpdate& update = commit.add();
update.entityID = exampleDataProviderID.withEntityName("id to the_answer"); update.entityID = exampleDataProviderID.withEntityName("id to the_answer");
update.timeCreated = time; update.referencedTime = time;
armem::example::ExampleData data; armem::example::ExampleData data;
armem::toAron(data.memoryID, theAnswerSnapshotID); armem::toAron(data.memoryID, theAnswerSnapshotID);
...@@ -556,7 +556,7 @@ namespace armarx ...@@ -556,7 +556,7 @@ namespace armarx
{ {
armem::EntityUpdate& update = commit.add(); armem::EntityUpdate& update = commit.add();
update.entityID = exampleDataProviderID.withEntityName("id to self"); update.entityID = exampleDataProviderID.withEntityName("id to self");
update.timeCreated = time; update.referencedTime = time;
armem::example::ExampleData data; armem::example::ExampleData data;
armem::toAron(data.memoryID, update.entityID.withTimestamp(time)); armem::toAron(data.memoryID, update.entityID.withTimestamp(time));
...@@ -568,7 +568,7 @@ namespace armarx ...@@ -568,7 +568,7 @@ namespace armarx
{ {
armem::EntityUpdate& update = commit.add(); armem::EntityUpdate& update = commit.add();
update.entityID = exampleDataProviderID.withEntityName("id to previous snapshot"); update.entityID = exampleDataProviderID.withEntityName("id to previous snapshot");
update.timeCreated = time - armem::Duration::Seconds(1); // 1 sec in the past update.referencedTime = time - armem::Duration::Seconds(1); // 1 sec in the past
armem::example::ExampleData data; armem::example::ExampleData data;
armem::toAron(data.memoryID, armem::MemoryID()); // First entry - invalid link armem::toAron(data.memoryID, armem::MemoryID()); // First entry - invalid link
...@@ -579,7 +579,7 @@ namespace armarx ...@@ -579,7 +579,7 @@ namespace armarx
{ {
armem::EntityUpdate& update = commit.add(); armem::EntityUpdate& update = commit.add();
update.entityID = exampleDataProviderID.withEntityName("id to previous snapshot"); update.entityID = exampleDataProviderID.withEntityName("id to previous snapshot");
update.timeCreated = time; update.referencedTime = time;
armem::example::ExampleData data; armem::example::ExampleData data;
armem::toAron(data.memoryID, update.entityID.withTimestamp(time - armem::Duration::Seconds(1))); armem::toAron(data.memoryID, update.entityID.withTimestamp(time - armem::Duration::Seconds(1)));
...@@ -634,7 +634,7 @@ namespace armarx ...@@ -634,7 +634,7 @@ namespace armarx
{ {
armem::EntityUpdate& update = commit.add(); armem::EntityUpdate& update = commit.add();
update.entityID = exampleDataProviderID.withEntityName("link to yet_more_data"); update.entityID = exampleDataProviderID.withEntityName("link to yet_more_data");
update.timeCreated = time; update.referencedTime = time;
armem::example::ExampleData data; armem::example::ExampleData data;
armem::toAron(data.memoryID, armem::MemoryID()); armem::toAron(data.memoryID, armem::MemoryID());
...@@ -686,7 +686,7 @@ namespace armarx ...@@ -686,7 +686,7 @@ namespace armarx
{ {
armem::EntityUpdate& update = commit.add(); armem::EntityUpdate& update = commit.add();
update.entityID = exampleDataProviderID.withEntityName("some_new_fancy_entity_id"); update.entityID = exampleDataProviderID.withEntityName("some_new_fancy_entity_id");
update.timeCreated = time; update.referencedTime = time;
auto currentFolder = std::filesystem::current_path(); auto currentFolder = std::filesystem::current_path();
auto opencv_img = cv::imread((currentFolder / "images" / (std::to_string(imageCounter + 1) + ".jpg")).string()); auto opencv_img = cv::imread((currentFolder / "images" / (std::to_string(imageCounter + 1) + ".jpg")).string());
...@@ -708,7 +708,7 @@ namespace armarx ...@@ -708,7 +708,7 @@ namespace armarx
{ {
armem::EntityUpdate& update = commit.add(); armem::EntityUpdate& update = commit.add();
update.entityID = exampleDataProviderID.withEntityName("unexpected_data"); update.entityID = exampleDataProviderID.withEntityName("unexpected_data");
update.timeCreated = time; update.referencedTime = time;
armem::example::ExampleData data; armem::example::ExampleData data;
toAron(data.memoryID, armem::MemoryID()); // ////1/1 toAron(data.memoryID, armem::MemoryID()); // ////1/1
......
...@@ -196,7 +196,7 @@ namespace armarx ...@@ -196,7 +196,7 @@ namespace armarx
armem::EntityUpdate& update = commit.add(); armem::EntityUpdate& update = commit.add();
update.entityID = provSegID.withEntityName(instance.id().str()); update.entityID = provSegID.withEntityName(instance.id().str());
update.timeCreated = instance.id().timestamp; update.referencedTime = instance.id().timestamp;
update.instancesData = { spatial.toAron() }; update.instancesData = { spatial.toAron() };
return true; return true;
......
...@@ -75,7 +75,7 @@ namespace armarx::armem::objects ...@@ -75,7 +75,7 @@ namespace armarx::armem::objects
armem::EntityUpdate& update = commit.add(); armem::EntityUpdate& update = commit.add();
update.entityID = indexSpatialProviderSegmentID.withEntityName( update.entityID = indexSpatialProviderSegmentID.withEntityName(
objectInstanceID.getEntityID().str()); objectInstanceID.getEntityID().str());
update.timeCreated = objectPose.timestamp; update.referencedTime = objectPose.timestamp;
update.instancesData = {spatial.toAron()}; update.instancesData = {spatial.toAron()};
} }
...@@ -114,7 +114,7 @@ namespace armarx::armem::objects ...@@ -114,7 +114,7 @@ namespace armarx::armem::objects
armem::EntityUpdate& update = commit.add(); armem::EntityUpdate& update = commit.add();
update.entityID = indexNamedProviderSegmentID.withEntityName( update.entityID = indexNamedProviderSegmentID.withEntityName(
objectInstanceID.getEntityID().str()); objectInstanceID.getEntityID().str());
update.timeCreated = objectPose.timestamp; update.referencedTime = objectPose.timestamp;
update.instancesData = {named.toAron()}; update.instancesData = {named.toAron()};
} }
} }
......
...@@ -163,7 +163,7 @@ namespace armarx::armem::robot_state ...@@ -163,7 +163,7 @@ namespace armarx::armem::robot_state
{ {
armem::EntityUpdate update; armem::EntityUpdate update;
update.entityID = entityID; update.entityID = entityID;
update.timeCreated = predictedTime; update.referencedTime = predictedTime;
update.instancesData = {result.prediction}; update.instancesData = {result.prediction};
coreSegment->update(update); coreSegment->update(update);
} }
......
...@@ -197,7 +197,7 @@ namespace armarx ...@@ -197,7 +197,7 @@ namespace armarx
.withProviderSegmentName(memoryID.providerSegmentName) .withProviderSegmentName(memoryID.providerSegmentName)
.withEntityName(memoryID.entityName); .withEntityName(memoryID.entityName);
update.entityID = newID; update.entityID = newID;
update.timeCreated = armem::Time::Now(); update.referencedTime = armem::Time::Now();
update.instancesData = { instance->data() }; update.instancesData = { instance->data() };
armem::Commit newCommit; armem::Commit newCommit;
......
...@@ -34,7 +34,7 @@ module armarx ...@@ -34,7 +34,7 @@ module armarx
{ {
armem::data::MemoryID entityID; armem::data::MemoryID entityID;
aron::data::dto::AronDictSeq instancesData; aron::data::dto::AronDictSeq instancesData;
armarx::core::time::dto::DateTime timeCreated; armarx::core::time::dto::DateTime referencedTime;
float confidence = 1.0; float confidence = 1.0;
armarx::core::time::dto::DateTime timeSent; armarx::core::time::dto::DateTime timeSent;
......
...@@ -38,9 +38,11 @@ module armarx ...@@ -38,9 +38,11 @@ module armarx
/// Ice Twin of `armarx::armem::EntityInstanceMetadata`. /// Ice Twin of `armarx::armem::EntityInstanceMetadata`.
class EntityInstanceMetadata class EntityInstanceMetadata
{ {
armarx::core::time::dto::DateTime timeCreated; armarx::core::time::dto::DateTime referencedTime;
armarx::core::time::dto::DateTime timeSent; armarx::core::time::dto::DateTime sentTime;
armarx::core::time::dto::DateTime timeArrived; armarx::core::time::dto::DateTime arrivedTime;
armarx::core::time::dto::DateTime lastAccessedTime;
long accessed = 0;
float confidence = 1.0; float confidence = 1.0;
}; };
......
...@@ -170,7 +170,7 @@ namespace armarx::armem ...@@ -170,7 +170,7 @@ namespace armarx::armem
armem::EntityUpdate update; armem::EntityUpdate update;
update.entityID = entityID; update.entityID = entityID;
update.instancesData = instances; update.instancesData = instances;
update.timeCreated = timestamp; update.referencedTime = timestamp;
ARMARX_DEBUG << "Committing " << update << " at time " << timestamp; ARMARX_DEBUG << "Committing " << update << " at time " << timestamp;
armem::EntityUpdateResult updateResult = memoryWriter.commit(update); armem::EntityUpdateResult updateResult = memoryWriter.commit(update);
......
...@@ -84,12 +84,12 @@ namespace armarx::armem::client ...@@ -84,12 +84,12 @@ namespace armarx::armem::client
EntityUpdateResult Writer::commit( EntityUpdateResult Writer::commit(
const MemoryID& entityID, const MemoryID& entityID,
const std::vector<aron::data::DictPtr>& instancesData, const std::vector<aron::data::DictPtr>& instancesData,
Time timeCreated) Time referencedTime)
{ {
EntityUpdate update; EntityUpdate update;
update.entityID = entityID; update.entityID = entityID;
update.instancesData = instancesData; update.instancesData = instancesData;
update.timeCreated = timeCreated; update.referencedTime = referencedTime;
return commit(update); return commit(update);
} }
......
...@@ -49,7 +49,7 @@ namespace armarx::armem::client ...@@ -49,7 +49,7 @@ namespace armarx::armem::client
EntityUpdateResult commit( EntityUpdateResult commit(
const MemoryID& entityID, const MemoryID& entityID,
const std::vector<aron::data::DictPtr>& instancesData, const std::vector<aron::data::DictPtr>& instancesData,
Time timeCreated); Time referencedTime);
// with bare-ice types // with bare-ice types
data::CommitResult commit(const data::Commit& commit); data::CommitResult commit(const data::Commit& commit);
......
...@@ -14,7 +14,7 @@ namespace armarx::armem ...@@ -14,7 +14,7 @@ namespace armarx::armem
{ {
return os << "Entity update: " return os << "Entity update: "
<< "\n- success: \t" << rhs.entityID << "\n- success: \t" << rhs.entityID
<< "\n- timestamp: \t" << toDateTimeMilliSeconds(rhs.timeCreated) << "\n- timestamp: \t" << toDateTimeMilliSeconds(rhs.referencedTime)
<< "\n- #instances: \t" << rhs.instancesData.size() << "\n- #instances: \t" << rhs.instancesData.size()
<< "\n" << "\n"
; ;
...@@ -25,7 +25,7 @@ namespace armarx::armem ...@@ -25,7 +25,7 @@ namespace armarx::armem
return os << "Entity update result: " return os << "Entity update result: "
<< "\n- success: \t" << (rhs.success ? "true" : "false") << "\n- success: \t" << (rhs.success ? "true" : "false")
<< "\n- snapshotID: \t" << rhs.snapshotID << "\n- snapshotID: \t" << rhs.snapshotID
<< "\n- time arrived: \t" << toDateTimeMilliSeconds(rhs.timeArrived) << "\n- time arrived: \t" << toDateTimeMilliSeconds(rhs.arrivedTime)
<< "\n- error message: \t" << rhs.errorMessage << "\n- error message: \t" << rhs.errorMessage
<< "\n" << "\n"
; ;
......
...@@ -36,7 +36,7 @@ namespace armarx::armem ...@@ -36,7 +36,7 @@ namespace armarx::armem
* @brief Time when this entity update was created (e.g. time of image recording). * @brief Time when this entity update was created (e.g. time of image recording).
* This is the key of the entity's history. * This is the key of the entity's history.
*/ */
Time timeCreated = Time::Invalid(); Time referencedTime = Time::Invalid();
// OPTIONAL // OPTIONAL
...@@ -52,14 +52,14 @@ namespace armarx::armem ...@@ -52,14 +52,14 @@ namespace armarx::armem
* *
* Set automatically when sending the commit. * Set automatically when sending the commit.
*/ */
Time timeSent = Time::Invalid(); Time sentTime = Time::Invalid();
/** /**
* @brief Time when this update arrived at the memory server. * @brief Time when this update arrived at the memory server.
* *
* Set by memory server on arrival. * Set by memory server on arrival.
*/ */
Time timeArrived = Time::Invalid(); Time arrivedTime = Time::Invalid();
friend std::ostream& operator<<(std::ostream& os, const EntityUpdate& rhs); friend std::ostream& operator<<(std::ostream& os, const EntityUpdate& rhs);
...@@ -74,7 +74,7 @@ namespace armarx::armem ...@@ -74,7 +74,7 @@ namespace armarx::armem
bool success = false; bool success = false;
MemoryID snapshotID; MemoryID snapshotID;
Time timeArrived = Time::Invalid(); Time arrivedTime = Time::Invalid();
std::string errorMessage; std::string errorMessage;
......
...@@ -552,11 +552,11 @@ namespace armarx::armem::base ...@@ -552,11 +552,11 @@ namespace armarx::armem::base
EntitySnapshotT* snapshot; EntitySnapshotT* snapshot;
auto it = this->_container.find(update.timeCreated); auto it = this->_container.find(update.referencedTime);
if (it == this->_container.end()) if (it == this->_container.end())
{ {
// Insert into history. // Insert into history.
snapshot = &addSnapshot(update.timeCreated); snapshot = &addSnapshot(update.referencedTime);
// ret.removedSnapshots = this->truncate(); // ret.removedSnapshots = this->truncate();
ret.entityUpdateType = UpdateType::InsertedNew; ret.entityUpdateType = UpdateType::InsertedNew;
} }
......
...@@ -3,11 +3,17 @@ ...@@ -3,11 +3,17 @@
namespace armarx::armem::base namespace armarx::armem::base
{ {
void EntityInstanceMetadata::access() const
{
numAccessed++;
lastAccessedTime = armarx::core::time::DateTime::Now();
}
bool EntityInstanceMetadata::operator==(const EntityInstanceMetadata& other) const bool EntityInstanceMetadata::operator==(const EntityInstanceMetadata& other) const
{ {
return timeCreated == other.timeCreated return referencedTime == other.referencedTime
&& timeSent == other.timeSent && sentTime == other.sentTime
&& timeArrived == other.timeArrived && arrivedTime == other.arrivedTime
&& std::abs(confidence - other.confidence) < 1e-6f; && std::abs(confidence - other.confidence) < 1e-6f;
} }
} }
...@@ -16,10 +22,11 @@ namespace armarx::armem::base ...@@ -16,10 +22,11 @@ namespace armarx::armem::base
std::ostream& armarx::armem::base::operator<<(std::ostream& os, const EntityInstanceMetadata& d) std::ostream& armarx::armem::base::operator<<(std::ostream& os, const EntityInstanceMetadata& d)
{ {
os << "EntityInstanceMetadata: " os << "EntityInstanceMetadata: "
<< "\n- t_create = \t" << armem::toStringMicroSeconds(d.timeCreated) << " us" << "\n - t_referenced = \t" << armem::toStringMicroSeconds(d.referencedTime) << " us"
<< "\n- t_sent = \t" << armem::toStringMicroSeconds(d.timeSent) << " us" << "\n - t_sent = \t" << armem::toStringMicroSeconds(d.sentTime) << " us"
<< "\n- t_arrived = \t" << armem::toStringMicroSeconds(d.timeArrived) << " us" << "\n - t_arrived = \t" << armem::toStringMicroSeconds(d.arrivedTime) << " us"
<< "\n- confidence = \t" << d.confidence << " us" << "\n - t_accessed = \t" << armem::toStringMicroSeconds(d.lastAccessedTime) << " us (" << d.numAccessed << ")"
<< "\n - confidence = \t" << d.confidence << " us"
; ;
return os; return os;
} }
...@@ -14,6 +14,16 @@ namespace armarx::armem::base ...@@ -14,6 +14,16 @@ namespace armarx::armem::base
*/ */
struct NoData struct NoData
{ {
virtual ~NoData() = default;
bool operator==(const NoData& other)
{
return true;
}
bool operator!=(const NoData& other)
{
return false;
}
}; };
...@@ -22,22 +32,34 @@ namespace armarx::armem::base ...@@ -22,22 +32,34 @@ namespace armarx::armem::base
*/ */
struct EntityInstanceMetadata struct EntityInstanceMetadata
{ {
/// Time when this value was created.
Time timeCreated; virtual ~EntityInstanceMetadata() = default;
/**
* @brief Time this instance refers to.
*
* For example, the physical time point when an image was captured.
* If the image is processed, the result should have the same
* referencedTime as the image.
*/
Time referencedTime = Time::Invalid();
/// Time when this value was sent to the memory. /// Time when this value was sent to the memory.
Time timeSent; Time sentTime = Time::Invalid();
/// Time when this value has arrived at the memory. /// Time when this value has arrived at the memory.
Time timeArrived; Time arrivedTime = Time::Invalid();
/// An optional confidence, may be used for things like decay. /// An optional confidence, may be used for things like decay.
float confidence = 1.0; float confidence = 1.0;
/// An optional value indicating the last access /// An optional value indicating the time of last access.
Time lastAccessed = Time::Invalid(); mutable Time lastAccessedTime = Time::Invalid();
/// A counter how often the instance has been accessed /// A counter how often the instance has been accessed.
unsigned long accessed = 0; mutable unsigned long numAccessed = 0;
/// Called whenever the entity instance this metadata belongs to is accessed (e.g. queried).
void access() const;
bool operator==(const EntityInstanceMetadata& other) const; bool operator==(const EntityInstanceMetadata& other) const;
inline bool operator!=(const EntityInstanceMetadata& other) const inline bool operator!=(const EntityInstanceMetadata& other) const
...@@ -91,11 +113,11 @@ namespace armarx::armem::base ...@@ -91,11 +113,11 @@ namespace armarx::armem::base
// Data // Data
EntityInstanceMetadata& metadata() MetadataT& metadata()
{ {
return _metadata; return _metadata;
} }
const EntityInstanceMetadata& metadata() const const MetadataT& metadata() const
{ {
return _metadata; return _metadata;
} }
......
...@@ -223,7 +223,7 @@ namespace armarx::armem::base ...@@ -223,7 +223,7 @@ namespace armarx::armem::base
void update(const EntityUpdate& update) void update(const EntityUpdate& update)
{ {
detail::throwIfNotEqual(time(), update.timeCreated); detail::throwIfNotEqual(time(), update.referencedTime);
this->_container.clear(); this->_container.clear();
for (int index = 0; index < int(update.instancesData.size()); ++index) for (int index = 0; index < int(update.instancesData.size()); ++index)
......
...@@ -56,16 +56,20 @@ namespace armarx::armem ...@@ -56,16 +56,20 @@ namespace armarx::armem
void base::toIce(data::EntityInstanceMetadata& ice, const EntityInstanceMetadata& metadata) void base::toIce(data::EntityInstanceMetadata& ice, const EntityInstanceMetadata& metadata)
{ {
ice.confidence = metadata.confidence; ice.confidence = metadata.confidence;
toIce(ice.timeArrived, metadata.timeArrived); toIce(ice.arrivedTime, metadata.arrivedTime);
toIce(ice.timeCreated, metadata.timeCreated); toIce(ice.referencedTime, metadata.referencedTime);
toIce(ice.timeSent, metadata.timeSent); toIce(ice.sentTime, metadata.sentTime);
toIce(ice.lastAccessedTime, metadata.lastAccessedTime);
ice.accessed = metadata.numAccessed;
} }
void base::fromIce(const data::EntityInstanceMetadata& ice, EntityInstanceMetadata& metadata) void base::fromIce(const data::EntityInstanceMetadata& ice, EntityInstanceMetadata& metadata)
{ {
metadata.confidence = ice.confidence; metadata.confidence = ice.confidence;
fromIce(ice.timeArrived, metadata.timeArrived); fromIce(ice.arrivedTime, metadata.arrivedTime);
fromIce(ice.timeCreated, metadata.timeCreated); fromIce(ice.referencedTime, metadata.referencedTime);
fromIce(ice.timeSent, metadata.timeSent); fromIce(ice.sentTime, metadata.sentTime);
fromIce(ice.lastAccessedTime, metadata.lastAccessedTime);
metadata.numAccessed = ice.accessed;
} }
......