diff --git a/source/RobotAPI/libraries/armem/client/util/SimpleReaderBase.h b/source/RobotAPI/libraries/armem/client/util/SimpleReaderBase.h index a78db401d3f578d7be9f9c86542a37f72326aabc..e567b76b8d36d8cf41c00118a49d3e041d0607bc 100644 --- a/source/RobotAPI/libraries/armem/client/util/SimpleReaderBase.h +++ b/source/RobotAPI/libraries/armem/client/util/SimpleReaderBase.h @@ -44,7 +44,7 @@ namespace armarx::armem::client::util virtual ~SimpleReaderBase() = default; void registerPropertyDefinitions(armarx::PropertyDefinitionsPtr& def); - void connect(); + virtual void connect(); protected: @@ -65,6 +65,8 @@ namespace armarx::armem::client::util const armem::client::Reader& memoryReader() const; + MemoryNameSystem& memoryNameSystem; + private: Properties props; @@ -72,7 +74,6 @@ namespace armarx::armem::client::util armem::client::Reader memoryReaderClient; std::mutex memoryMutex; - MemoryNameSystem& memoryNameSystem; }; } // namespace armarx::armem::client::util diff --git a/source/RobotAPI/libraries/armem/mns/MemoryNameSystem.cpp b/source/RobotAPI/libraries/armem/mns/MemoryNameSystem.cpp index a80a189ff585c7610bebe0978468aec82ebe48b9..a0c606a990fd4635a5fa2cded1c0e5be8f7566a8 100644 --- a/source/RobotAPI/libraries/armem/mns/MemoryNameSystem.cpp +++ b/source/RobotAPI/libraries/armem/mns/MemoryNameSystem.cpp @@ -40,6 +40,14 @@ namespace armarx::armem::mns } } } + + dto::RegisterServerResult MemoryNameSystem::registerServer(const dto::RegisterServerInput& input) + { + const auto result = Registry::registerServer(input); + waitForServer_processOnce(); + + return result; + } armarx::RemoteGui::Client::GridLayout MemoryNameSystem::RemoteGui_buildInfoGrid() @@ -92,4 +100,3 @@ namespace armarx::armem::mns } } - diff --git a/source/RobotAPI/libraries/armem/mns/MemoryNameSystem.h b/source/RobotAPI/libraries/armem/mns/MemoryNameSystem.h index 51e4719f127ee576073e0c9b45cb0635241a185d..e0cf5b88753cb4a96caad2c004a853dcd4d11a34 100644 --- a/source/RobotAPI/libraries/armem/mns/MemoryNameSystem.h +++ b/source/RobotAPI/libraries/armem/mns/MemoryNameSystem.h @@ -31,6 +31,8 @@ namespace armarx::armem::mns void waitForServer_processOnce(); + dto::RegisterServerResult registerServer(const dto::RegisterServerInput& input) override; + /// Builds a RemoteGui grid containing information about registered memories. armarx::RemoteGui::Client::GridLayout RemoteGui_buildInfoGrid(); diff --git a/source/RobotAPI/libraries/armem/mns/Registry.h b/source/RobotAPI/libraries/armem/mns/Registry.h index bf9348d157ee990f6032c4cf115b9fd56c70f716..c1965bdac24fcdf943ad2b7bc945698358dd3f0c 100644 --- a/source/RobotAPI/libraries/armem/mns/Registry.h +++ b/source/RobotAPI/libraries/armem/mns/Registry.h @@ -35,7 +35,7 @@ namespace armarx::armem::mns * Causes threads waiting in `waitForMemory()` to resume if the respective * memory server was added. */ - dto::RegisterServerResult registerServer(const dto::RegisterServerInput& input); + virtual dto::RegisterServerResult registerServer(const dto::RegisterServerInput& input); /** * @brief Remove a server entry. */ diff --git a/source/RobotAPI/libraries/armem_robot_state/client/common/RobotReader.cpp b/source/RobotAPI/libraries/armem_robot_state/client/common/RobotReader.cpp index 764c443a7cc595f7c1f32ca51d4bdde6ee9309a4..a364df3f70d1231c3f0ed8c1b2a1510e4d099679 100644 --- a/source/RobotAPI/libraries/armem_robot_state/client/common/RobotReader.cpp +++ b/source/RobotAPI/libraries/armem_robot_state/client/common/RobotReader.cpp @@ -149,14 +149,14 @@ namespace armarx::armem::robot_state const auto jointMap = queryJointState(description, timestamp); if (not jointMap) { - ARMARX_WARNING << "Failed to query joint state"; + ARMARX_WARNING << "Failed to query joint state for robot " << description.name; return std::nullopt; } const auto globalPose = queryGlobalPose(description, timestamp); if (not globalPose) { - ARMARX_WARNING << "Failed to query global pose"; + ARMARX_WARNING << "Failed to query global pose for robot " << description.name; return std::nullopt; } diff --git a/source/RobotAPI/libraries/armem_robot_state/client/common/VirtualRobotReader.cpp b/source/RobotAPI/libraries/armem_robot_state/client/common/VirtualRobotReader.cpp index 10e13611f3fd8608a5d0b5027fd92b960c3a7754..1c0152a463d5c38abb3b1c81f1014e1f74ef4d77 100644 --- a/source/RobotAPI/libraries/armem_robot_state/client/common/VirtualRobotReader.cpp +++ b/source/RobotAPI/libraries/armem_robot_state/client/common/VirtualRobotReader.cpp @@ -42,7 +42,7 @@ namespace armarx::armem::robot_state const auto robotState = queryState(robotDescription, timestamp); if (not robotState) { - ARMARX_WARNING << "Querying robot state failed!"; + ARMARX_WARNING << "Querying robot state failed for robot `" << robot.getName() << " / " << robot.getType() << "`!"; return false; } @@ -67,7 +67,9 @@ namespace armarx::armem::robot_state const std::string xmlFilename = ArmarXDataPath::resolvePath(description->xml.serialize().path); ARMARX_INFO << "Loading (virtual) robot '" << description->name << "' from XML file '" << xmlFilename << "'"; - return VirtualRobot::RobotIO::loadRobot(xmlFilename, loadMode); + auto robot = VirtualRobot::RobotIO::loadRobot(xmlFilename, loadMode); + robot->setName(name); + return robot; } diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/toplevel/IntEnumClass.cpp b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/toplevel/IntEnumClass.cpp index 0db5f2d68e1de29da18c9327a5b25ee5bd834bc5..5f3c8043a69376538f41f8a55313b53f0c331f80 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/toplevel/IntEnumClass.cpp +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/toplevel/IntEnumClass.cpp @@ -59,7 +59,7 @@ namespace armarx::aron::cppserializer::serializer for (const auto& [key, value] : typenavigator->getAcceptedValueMap()) { std::string enumKeyWithNamespace = std::string(IMPL_ENUM) + "::" + key; - fields.push_back(std::make_shared<CppField>("const static " + std::string(IMPL_ENUM), key + " = " + enumKeyWithNamespace)); + fields.push_back(std::make_shared<CppField>("static constexpr " + std::string(IMPL_ENUM), key + " = " + enumKeyWithNamespace)); enum_to_name << "\t\t{" << enumKeyWithNamespace << ", \"" << key << "\"}," << std::endl; name_to_enum << "\t\t{\"" << key << "\", " << enumKeyWithNamespace << "}," << std::endl; diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/toplevel/IntEnumClass.h b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/toplevel/IntEnumClass.h index bd4a0f8128b19bbe28b388e3fa97faddf8f743b1..4a73767f0f800f03be6c1d77759ba17993cac1a3 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/toplevel/IntEnumClass.h +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/toplevel/IntEnumClass.h @@ -66,6 +66,6 @@ namespace armarx::aron::cppserializer::serializer private: // Members static const std::map<std::string, std::pair<std::string, int>> ACCEPTED_TYPES; - static constexpr const char* IMPL_ENUM = "__ImplEnum"; + static constexpr const char* IMPL_ENUM = "ImplEnum"; }; } diff --git a/source/RobotAPI/libraries/aron/core/test/aronRandomizedTest.cpp b/source/RobotAPI/libraries/aron/core/test/aronRandomizedTest.cpp index 4ff0724c95ca3c0cbc31dd051b6ba3afdff37fe9..b9c54acda1e8d0e1b70477427a2d8c848bbedb15 100644 --- a/source/RobotAPI/libraries/aron/core/test/aronRandomizedTest.cpp +++ b/source/RobotAPI/libraries/aron/core/test/aronRandomizedTest.cpp @@ -384,3 +384,11 @@ BOOST_AUTO_TEST_CASE(test_Optional) OptionalTest pc2; runTestWithInstances<OptionalTest>(pc, pc2); } + + +BOOST_AUTO_TEST_CASE(test_Enum) +{ + BOOST_TEST_MESSAGE("Running Optional test"); + TheIntEnum value = TheIntEnum::INT_ENUM_VALUE_2; + BOOST_CHECK_EQUAL(value.toString(), "INT_ENUM_VALUE_2"); +}