diff --git a/Gems/ROS2/Code/CMakeLists.txt b/Gems/ROS2/Code/CMakeLists.txt index fe0f8f2b99..617b7c95e7 100644 --- a/Gems/ROS2/Code/CMakeLists.txt +++ b/Gems/ROS2/Code/CMakeLists.txt @@ -185,7 +185,6 @@ if(PAL_TRAIT_BUILD_HOST_TOOLS) Gem::Atom_Feature_Common.Public ) - # By default, we will specify that the above target ROS2 would be used by # Tool and Builder type targets when this gem is enabled. If you don't want it # active in Tools or Builders by default, delete one or both of the following lines: diff --git a/Gems/ROS2/Code/Include/ROS2/Clock/ROS2Clock.h b/Gems/ROS2/Code/Include/ROS2/Clock/ROS2Clock.h index bab1099d22..a4725e9d60 100644 --- a/Gems/ROS2/Code/Include/ROS2/Clock/ROS2Clock.h +++ b/Gems/ROS2/Code/Include/ROS2/Clock/ROS2Clock.h @@ -8,12 +8,12 @@ #pragma once #include "ITimeSource.h" +#include #include #include +#include #include #include -#include -#include namespace ROS2 { @@ -23,7 +23,6 @@ namespace ROS2 //! the /use_sim_time parameter set to true. class ROS2Clock { - public: ROS2Clock(); ROS2Clock(AZStd::unique_ptr timeSource, bool publishClock); @@ -37,7 +36,7 @@ namespace ROS2 //! Sets the time source to the given time. //! @param time The time to set the time source to. //! @return An outcome indicating success or failure. - AZ::Outcome AdjustTime(const builtin_interfaces::msg::Time & time) const; + AZ::Outcome AdjustTime(const builtin_interfaces::msg::Time& time) const; //! Update time in the ROS 2 ecosystem. //! This will publish current time to the ROS 2 `/clock` topic, if Clock is configured to do it. diff --git a/Gems/SimulationInterfaces/Code/CMakeLists.txt b/Gems/SimulationInterfaces/Code/CMakeLists.txt index e243943ba0..fdf8b33a5d 100644 --- a/Gems/SimulationInterfaces/Code/CMakeLists.txt +++ b/Gems/SimulationInterfaces/Code/CMakeLists.txt @@ -261,26 +261,26 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED) ) ly_add_target( - NAME ${gem_name}.TestApp ${PAL_TRAIT_TEST_TARGET_TYPE} - NAMESPACE Gem - FILES_CMAKE + NAME ${gem_name}.TestApp ${PAL_TRAIT_TEST_TARGET_TYPE} + NAMESPACE Gem + FILES_CMAKE simulationinterfaces_editor_app_test.cmake - INCLUDE_DIRECTORIES + INCLUDE_DIRECTORIES PRIVATE - Tests - Source - Include - BUILD_DEPENDENCIES + Tests + Source + Include + BUILD_DEPENDENCIES PRIVATE - AZ::AzTest - AZ::AzTestShared - AZ::AzToolsFramework - Legacy::CryCommon - Legacy::EditorCommon - Legacy::Editor.Headers - AZ::AzManipulatorTestFramework.Static - Gem::${gem_name}.API - Gem::${gem_name}.Editor.Private.Object + AZ::AzTest + AZ::AzTestShared + AZ::AzToolsFramework + Legacy::CryCommon + Legacy::EditorCommon + Legacy::Editor.Headers + AZ::AzManipulatorTestFramework.Static + Gem::${gem_name}.API + Gem::${gem_name}.Editor.Private.Object ) # Add ${gem_name}.Editor.Tests to googletest @@ -289,29 +289,29 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED) ) ly_add_target( - NAME ${gem_name}.ROS2Tests ${PAL_TRAIT_TEST_TARGET_TYPE} - NAMESPACE Gem - FILES_CMAKE + NAME ${gem_name}.ROS2Tests ${PAL_TRAIT_TEST_TARGET_TYPE} + NAMESPACE Gem + FILES_CMAKE ros2_simulationinterfaces_tests_files.cmake - INCLUDE_DIRECTORIES + INCLUDE_DIRECTORIES PRIVATE - Tests - Source - Include - BUILD_DEPENDENCIES + Tests + Source + Include + BUILD_DEPENDENCIES PRIVATE - AZ::AzTest - AZ::AzTestShared - AZ::AzToolsFramework - Legacy::CryCommon - Legacy::EditorCommon - Legacy::Editor.Headers - AZ::AzManipulatorTestFramework.Static - Gem::${gem_name}.API - Gem::${gem_name}.Editor.Private.Object - Gem::SimulationInterfaces.API - Gem::ROS2.Static - Gem::${gem_name}.Editor.Private.Object + AZ::AzTest + AZ::AzTestShared + AZ::AzToolsFramework + Legacy::CryCommon + Legacy::EditorCommon + Legacy::Editor.Headers + AZ::AzManipulatorTestFramework.Static + Gem::${gem_name}.API + Gem::${gem_name}.Editor.Private.Object + Gem::SimulationInterfaces.API + Gem::ROS2.Static + Gem::${gem_name}.Editor.Private.Object ) # Add ${gem_name}.Editor.Tests to googletest diff --git a/Gems/SimulationInterfaces/Code/Include/SimulationInterfaces/ROS2SimulationInterfacesTypeIds.h b/Gems/SimulationInterfaces/Code/Include/SimulationInterfaces/ROS2SimulationInterfacesTypeIds.h index 34d94abd81..93240dde4c 100644 --- a/Gems/SimulationInterfaces/Code/Include/SimulationInterfaces/ROS2SimulationInterfacesTypeIds.h +++ b/Gems/SimulationInterfaces/Code/Include/SimulationInterfaces/ROS2SimulationInterfacesTypeIds.h @@ -22,5 +22,5 @@ namespace ROS2SimulationInterfaces inline constexpr const char* ROS2SimulationInterfacesEditorModuleTypeId = ROS2SimulationInterfacesModuleTypeId; // API TypeIds - inline constexpr const char* ROS2SimulationInterfacesRequestBusTypeId = "{00d08870-e329-4bd7-bb8c-f67fe369de92}"; + inline constexpr const char* ROS2SimulationInterfacesRequestBusTypeId = "{00D08870-E329-4BD7-BB8C-F67FE369DE92}"; } // namespace ROS2SimulationInterfaces diff --git a/Gems/SimulationInterfaces/Code/Include/SimulationInterfaces/Result.h b/Gems/SimulationInterfaces/Code/Include/SimulationInterfaces/Result.h index 6fc90a64a3..b95a70d6c1 100644 --- a/Gems/SimulationInterfaces/Code/Include/SimulationInterfaces/Result.h +++ b/Gems/SimulationInterfaces/Code/Include/SimulationInterfaces/Result.h @@ -13,7 +13,7 @@ namespace SimulationInterfaces { //! Result codes to be used in the Result message - //! @see Result.msg + //! @see Result.msg using ErrorCodeType = simulation_interfaces::msg::Result::_result_type; //! A message type to represent the result of a failed operation diff --git a/Gems/SimulationInterfaces/Code/Include/SimulationInterfaces/SimulationEntityManagerRequestBus.h b/Gems/SimulationInterfaces/Code/Include/SimulationInterfaces/SimulationEntityManagerRequestBus.h index bf2bca2feb..fb02ad1612 100644 --- a/Gems/SimulationInterfaces/Code/Include/SimulationInterfaces/SimulationEntityManagerRequestBus.h +++ b/Gems/SimulationInterfaces/Code/Include/SimulationInterfaces/SimulationEntityManagerRequestBus.h @@ -33,7 +33,7 @@ namespace SimulationInterfaces AZ::Transform m_boundsPose{ AZ::Transform::CreateIdentity() }; }; - //! @see EntityState.msg + //! @see EntityState.msg struct EntityState { AZ::Transform m_pose; //! The pose of the entity @@ -41,6 +41,7 @@ namespace SimulationInterfaces AZ::Vector3 m_twistAngular; //! The angular velocity of the entity (in the entity frame) }; + //! @see Spawnable.msg struct Spawnable { AZStd::string m_uri; @@ -64,16 +65,15 @@ namespace SimulationInterfaces //! Supported filters: //! - name : a posix regular expression to match against entity names //! - bounds : a shape to use for filtering entities, null means no bounds filtering - //! @see GetEntities.srv + //! @see GetEntities.srv virtual AZ::Outcome GetEntities(const EntityFilters& filter) = 0; //! Get the state of an entity. - //! @see GetEntityState.srv + //! @see GetEntityState.srv virtual AZ::Outcome GetEntityState(const AZStd::string& name) = 0; //! Get the state of all entities that match the filter. - //! @see GetEntitiesStates.srv + //! @see GetEntitiesStates.srv virtual AZ::Outcome GetEntitiesStates(const EntityFilters& filter) = 0; //! Set the state of an entity. @@ -92,7 +92,7 @@ namespace SimulationInterfaces virtual AZ::Outcome GetSpawnables() = 0; //! Callback for when an entity has been spawned and registered. The string is the name of the entity in the simulation interface. - //! Note : The names is empty, if the entity could not be registered (e.g. prefab has no simulated entities) + //! Note: The names are empty, if the entity could not be registered (e.g. prefab has no simulated entities) virtual void SpawnEntity( const AZStd::string& name, const AZStd::string& uri, diff --git a/Gems/SimulationInterfaces/Code/Include/SimulationInterfaces/SimulationInterfacesTypeIds.h b/Gems/SimulationInterfaces/Code/Include/SimulationInterfaces/SimulationInterfacesTypeIds.h index bea5048d6c..9ab1568ef0 100644 --- a/Gems/SimulationInterfaces/Code/Include/SimulationInterfaces/SimulationInterfacesTypeIds.h +++ b/Gems/SimulationInterfaces/Code/Include/SimulationInterfaces/SimulationInterfacesTypeIds.h @@ -18,7 +18,7 @@ namespace SimulationInterfaces inline constexpr const char* SimulationManagerEditorTypeId = "{2CC8D67B-CFD3-4E89-AAF0-8935640B51C1}"; inline constexpr const char* SimulationFeaturesAggregatorTypeId = "{5c5ae765-1776-4ba0-8e32-b66c8f4edafe}"; - inline constexpr const char* SimulationFeaturesAggregatorEditorTypeId = "{504a86ef-df0a-45ec-b69d-315ff4ec8121}"; + inline constexpr const char* SimulationFeaturesAggregatorEditorTypeId = "{504A86EF-DF0A-45EC-B69D-315FF4EC8121}"; // Module derived classes TypeIds inline constexpr const char* SimulationInterfacesModuleInterfaceTypeId = "{675797BF-E5D5-438A-BF86-4B4554F09CEF}"; @@ -30,7 +30,7 @@ namespace SimulationInterfaces // Interface TypeIds inline constexpr const char* SimulationInterfacesRequestsTypeId = "{6818E5E3-BBF5-41BD-96BB-7AF57CCC7528}"; inline constexpr const char* SimulationManagerRequestsTypeId = "{056477BA-8153-4901-9401-0146A5E3E9ED}"; - inline constexpr const char* SimulationFeaturesAggregatorRequestsTypeId = "{099fd08b-b0e2-4705-9c35-cc09c8e45076}"; - inline constexpr const char* SimulationManagerNotificationsTypeId = "{0201067b-9d52-4ab7-9a45-284287f53b00}"; + inline constexpr const char* SimulationFeaturesAggregatorRequestsTypeId = "{099FD08B-B0E2-4705-9C35-CC09C8E45076}"; + inline constexpr const char* SimulationManagerNotificationsTypeId = "{0201067B-9D52-4AB7-9A45-284287F53B00}"; } // namespace SimulationInterfaces diff --git a/Gems/SimulationInterfaces/Code/Include/SimulationInterfaces/TagFilter.h b/Gems/SimulationInterfaces/Code/Include/SimulationInterfaces/TagFilter.h index 1a1bb0e0bf..f9aa2c40ac 100644 --- a/Gems/SimulationInterfaces/Code/Include/SimulationInterfaces/TagFilter.h +++ b/Gems/SimulationInterfaces/Code/Include/SimulationInterfaces/TagFilter.h @@ -14,7 +14,7 @@ namespace SimulationInterfaces { //! Structure to design a filter for tags - //! @see TagsFilter.msg + //! @see TagsFilter.msg using TagFilterMode = uint8_t; struct TagFilter diff --git a/Gems/SimulationInterfaces/Code/Source/Actions/SimulateStepsActionServerHandler.cpp b/Gems/SimulationInterfaces/Code/Source/Actions/SimulateStepsActionServerHandler.cpp index fca2f0b48e..56caf70182 100644 --- a/Gems/SimulationInterfaces/Code/Source/Actions/SimulateStepsActionServerHandler.cpp +++ b/Gems/SimulationInterfaces/Code/Source/Actions/SimulateStepsActionServerHandler.cpp @@ -57,7 +57,7 @@ namespace ROS2SimulationInterfaces { SimulationInterfaces::SimulationManagerRequestBus::Broadcast( &SimulationInterfaces::SimulationManagerRequests::CancelStepSimulation); - m_isCancelled = true; + m_cancelAction = true; return rclcpp_action::CancelResponse::ACCEPT; } @@ -80,7 +80,7 @@ namespace ROS2SimulationInterfaces m_goalHandle.reset(); return; } - m_isCancelled = false; + m_cancelAction = false; AZ::TickBus::Handler::BusConnect(); SimulationInterfaces::SimulationManagerRequestBus::Broadcast( &SimulationInterfaces::SimulationManagerRequests::StepSimulation, m_goalSteps); @@ -88,7 +88,7 @@ namespace ROS2SimulationInterfaces void SimulateStepsActionServerHandler::OnTick([[maybe_unused]] float deltaTime, [[maybe_unused]] AZ::ScriptTimePoint time) { - if (m_isCancelled) + if (m_cancelAction) { auto result = std::make_shared(); result->result.error_message = "Action has been cancelled."; diff --git a/Gems/SimulationInterfaces/Code/Source/Actions/SimulateStepsActionServerHandler.h b/Gems/SimulationInterfaces/Code/Source/Actions/SimulateStepsActionServerHandler.h index 0bd6d9d4c9..af075c7e4b 100644 --- a/Gems/SimulationInterfaces/Code/Source/Actions/SimulateStepsActionServerHandler.h +++ b/Gems/SimulationInterfaces/Code/Source/Actions/SimulateStepsActionServerHandler.h @@ -44,7 +44,7 @@ namespace ROS2SimulationInterfaces private: AZ::u64 m_goalSteps{ 0 }; - bool m_isCancelled{ false }; + bool m_cancelAction{ false }; }; } // namespace ROS2SimulationInterfaces diff --git a/Gems/SimulationInterfaces/Code/Source/Clients/ROS2SimulationInterfacesSystemComponent.cpp b/Gems/SimulationInterfaces/Code/Source/Clients/ROS2SimulationInterfacesSystemComponent.cpp index 78f3930d87..18cd236a36 100644 --- a/Gems/SimulationInterfaces/Code/Source/Clients/ROS2SimulationInterfacesSystemComponent.cpp +++ b/Gems/SimulationInterfaces/Code/Source/Clients/ROS2SimulationInterfacesSystemComponent.cpp @@ -9,15 +9,28 @@ #include "ROS2SimulationInterfacesSystemComponent.h" #include +#include +#include #include -#include -#include +#include #include +#include #include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include namespace ROS2SimulationInterfaces { @@ -67,10 +80,6 @@ namespace ROS2SimulationInterfaces { } - void ROS2SimulationInterfacesSystemComponent::Init() - { - } - void ROS2SimulationInterfacesSystemComponent::Activate() { ROS2SimulationInterfacesRequestBus::Handler::BusConnect(); diff --git a/Gems/SimulationInterfaces/Code/Source/Clients/ROS2SimulationInterfacesSystemComponent.h b/Gems/SimulationInterfaces/Code/Source/Clients/ROS2SimulationInterfacesSystemComponent.h index 5445869fcd..8db1b51f3a 100644 --- a/Gems/SimulationInterfaces/Code/Source/Clients/ROS2SimulationInterfacesSystemComponent.h +++ b/Gems/SimulationInterfaces/Code/Source/Clients/ROS2SimulationInterfacesSystemComponent.h @@ -9,26 +9,14 @@ #pragma once #include -#include - -#include "Services/DeleteEntityServiceHandler.h" -#include "Services/GetEntitiesServiceHandler.h" -#include "Services/GetEntitiesStatesServiceHandler.h" -#include "Services/GetEntityStateServiceHandler.h" -#include "Services/GetSimulationFeaturesServiceHandler.h" -#include "Services/GetSimulationStateServiceHandler.h" -#include "Services/GetSpawnablesServiceHandler.h" -#include "Services/ROS2ServiceBase.h" -#include "Services/ResetSimulationServiceHandler.h" -#include "Services/SetEntityStateServiceHandler.h" -#include "Services/SetSimulationStateServiceHandler.h" -#include "Services/SpawnEntityServiceHandler.h" -#include "Services/StepSimulationServiceHandler.h" -#include "SimulationInterfaces/ROS2SimulationInterfacesRequestBus.h" #include -#include #include #include +#include + +#include + +#include namespace ROS2SimulationInterfaces { @@ -51,7 +39,6 @@ namespace ROS2SimulationInterfaces protected: // AZ::Component interface implementation - void Init() override; void Activate() override; void Deactivate() override; diff --git a/Gems/SimulationInterfaces/Code/Source/Clients/SimulationEntitiesManager.cpp b/Gems/SimulationInterfaces/Code/Source/Clients/SimulationEntitiesManager.cpp index 0d886f7df1..221083ed84 100644 --- a/Gems/SimulationInterfaces/Code/Source/Clients/SimulationEntitiesManager.cpp +++ b/Gems/SimulationInterfaces/Code/Source/Clients/SimulationEntitiesManager.cpp @@ -8,12 +8,12 @@ #include "SimulationEntitiesManager.h" +#include +#include #include -#include "Clients/SimulationFeaturesAggregator.h" #include "CommonUtilities.h" #include "ConsoleCommands.inl" -#include "SimulationInterfaces/SimulationFeaturesAggregatorRequestBus.h" #include #include #include @@ -114,10 +114,6 @@ namespace SimulationInterfaces } } - void SimulationEntitiesManager::Init() - { - } - bool SimulationEntitiesManager::RegisterNewSimulatedBody(AzPhysics::SceneHandle sceneHandle, AzPhysics::SimulatedBodyHandle bodyHandle) { auto* scene = GetSceneHelper(sceneHandle); @@ -264,15 +260,16 @@ namespace SimulationInterfaces SimulationFeaturesAggregatorRequestBus::Broadcast( &SimulationFeaturesAggregatorRequests::AddSimulationFeatures, - AZStd::unordered_set{ // simulation_interfaces::msg::SimulatorFeatures::ENTITY_TAGS, - simulation_interfaces::msg::SimulatorFeatures::ENTITY_BOUNDS_BOX, - // simulation_interfaces::msg::SimulatorFeatures::ENTITY_BOUNDS_CONVEX, - // simulation_interfaces::msg::SimulatorFeatures::ENTITY_CATEGORIES, - simulation_interfaces::msg::SimulatorFeatures::ENTITY_STATE_GETTING, - simulation_interfaces::msg::SimulatorFeatures::ENTITY_STATE_SETTING, - simulation_interfaces::msg::SimulatorFeatures::DELETING, - simulation_interfaces::msg::SimulatorFeatures::SPAWNABLES, - simulation_interfaces::msg::SimulatorFeatures::SPAWNING }); + AZStd::unordered_set{ + // not implemented: simulation_interfaces::msg::SimulatorFeatures::ENTITY_TAGS, + simulation_interfaces::msg::SimulatorFeatures::ENTITY_BOUNDS_BOX, + // not implemented: simulation_interfaces::msg::SimulatorFeatures::ENTITY_BOUNDS_CONVEX, + // not implemented: simulation_interfaces::msg::SimulatorFeatures::ENTITY_CATEGORIES, + simulation_interfaces::msg::SimulatorFeatures::ENTITY_STATE_GETTING, + simulation_interfaces::msg::SimulatorFeatures::ENTITY_STATE_SETTING, + simulation_interfaces::msg::SimulatorFeatures::DELETING, + simulation_interfaces::msg::SimulatorFeatures::SPAWNABLES, + simulation_interfaces::msg::SimulatorFeatures::SPAWNING }); AZ::TickBus::Handler::BusConnect(); } @@ -287,7 +284,6 @@ namespace SimulationInterfaces m_physicsScenesHandle = AzPhysics::InvalidSceneHandle; m_sceneAddedHandler.Disconnect(); - m_sceneAddedHandler.Disconnect(); } AZStd::string SimulationEntitiesManager::AddSimulatedEntity(AZ::EntityId entityId, const AZStd::string& userProposedName) @@ -311,17 +307,15 @@ namespace SimulationInterfaces void SimulationEntitiesManager::RemoveSimulatedEntity(AZ::EntityId entityId) { - auto findIt = m_entityIdToSimulatedEntityMap.find(entityId); - if (findIt != m_entityIdToSimulatedEntityMap.end()) + if (auto findIt = m_entityIdToSimulatedEntityMap.find(entityId); findIt != m_entityIdToSimulatedEntityMap.end()) { const auto& simulatedEntityName = findIt->second; m_entityIdToSimulatedEntityMap.erase(findIt); m_simulatedEntityToEntityIdMap.erase(simulatedEntityName); } - auto findIt2 = m_entityIdToInitialState.find(entityId); - if (findIt2 != m_entityIdToInitialState.end()) + if (auto findIt = m_entityIdToInitialState.find(entityId); findIt != m_entityIdToInitialState.end()) { - m_entityIdToInitialState.erase(findIt2); + m_entityIdToInitialState.erase(findIt); } } @@ -371,8 +365,7 @@ namespace SimulationInterfaces for (const auto& hit : result.m_hits) { const AZ::EntityId entityId = hit.m_entityId; - auto findIt = m_entityIdToSimulatedEntityMap.find(entityId); - if (findIt != m_entityIdToSimulatedEntityMap.end()) + if (auto findIt = m_entityIdToSimulatedEntityMap.find(entityId); findIt != m_entityIdToSimulatedEntityMap.end()) { entities.push_back(findIt->second); } @@ -404,7 +397,7 @@ namespace SimulationInterfaces const auto findIt = m_simulatedEntityToEntityIdMap.find(name); if (findIt == m_simulatedEntityToEntityIdMap.end()) { - AZ_Warning("SimulationInterfaces", findIt != m_simulatedEntityToEntityIdMap.end(), "Entity %s not found", name.c_str()); + AZ_Warning("SimulationInterfaces", false, "Entity %s not found", name.c_str()); return AZ::Failure(FailedResult(simulation_interfaces::msg::Result::RESULT_NOT_FOUND, "Entity not found")); } EntityState entityState{}; @@ -523,7 +516,6 @@ namespace SimulationInterfaces void SimulationEntitiesManager::DeleteEntity(const AZStd::string& name, DeletionCompletedCb completedCb) { const auto findIt = m_simulatedEntityToEntityIdMap.find(name); - if (findIt == m_simulatedEntityToEntityIdMap.end()) { completedCb(AZ::Failure(FailedResult(simulation_interfaces::msg::Result::RESULT_NOT_FOUND, "Entity not found"))); diff --git a/Gems/SimulationInterfaces/Code/Source/Clients/SimulationEntitiesManager.h b/Gems/SimulationInterfaces/Code/Source/Clients/SimulationEntitiesManager.h index 7322467ae8..215845df66 100644 --- a/Gems/SimulationInterfaces/Code/Source/Clients/SimulationEntitiesManager.h +++ b/Gems/SimulationInterfaces/Code/Source/Clients/SimulationEntitiesManager.h @@ -36,7 +36,6 @@ namespace SimulationInterfaces SimulationEntitiesManager(); ~SimulationEntitiesManager(); // AZ::Component interface implementation - void Init() override; void Activate() override; void Deactivate() override; diff --git a/Gems/SimulationInterfaces/Code/Source/Clients/SimulationFeaturesAggregator.cpp b/Gems/SimulationInterfaces/Code/Source/Clients/SimulationFeaturesAggregator.cpp index 699779c1ac..b7250f034c 100644 --- a/Gems/SimulationInterfaces/Code/Source/Clients/SimulationFeaturesAggregator.cpp +++ b/Gems/SimulationInterfaces/Code/Source/Clients/SimulationFeaturesAggregator.cpp @@ -60,10 +60,6 @@ namespace SimulationInterfaces } } - void SimulationFeaturesAggregator::Init() - { - } - void SimulationFeaturesAggregator::Activate() { SimulationFeaturesAggregatorRequestBus::Handler::BusConnect(); diff --git a/Gems/SimulationInterfaces/Code/Source/Clients/SimulationFeaturesAggregator.h b/Gems/SimulationInterfaces/Code/Source/Clients/SimulationFeaturesAggregator.h index 9f445a1d48..45cc269eda 100644 --- a/Gems/SimulationInterfaces/Code/Source/Clients/SimulationFeaturesAggregator.h +++ b/Gems/SimulationInterfaces/Code/Source/Clients/SimulationFeaturesAggregator.h @@ -14,9 +14,7 @@ #include #include #include -#include #include -#include namespace SimulationInterfaces { @@ -38,7 +36,6 @@ namespace SimulationInterfaces ~SimulationFeaturesAggregator(); // AZ::Component - void Init() override; void Activate() override; void Deactivate() override; diff --git a/Gems/SimulationInterfaces/Code/Source/Clients/SimulationManager.cpp b/Gems/SimulationInterfaces/Code/Source/Clients/SimulationManager.cpp index 2c941584c5..1c44c76ad5 100644 --- a/Gems/SimulationInterfaces/Code/Source/Clients/SimulationManager.cpp +++ b/Gems/SimulationInterfaces/Code/Source/Clients/SimulationManager.cpp @@ -81,9 +81,6 @@ namespace SimulationInterfaces } } - void SimulationManager::Init() - { - } void SimulationManager::InitializeSimulationState() { // if start in stopped state, pause simulation. Default state for simulation by the standard is STOPPED and diff --git a/Gems/SimulationInterfaces/Code/Source/Clients/SimulationManager.h b/Gems/SimulationInterfaces/Code/Source/Clients/SimulationManager.h index 7db04c7704..5e3c8acc00 100644 --- a/Gems/SimulationInterfaces/Code/Source/Clients/SimulationManager.h +++ b/Gems/SimulationInterfaces/Code/Source/Clients/SimulationManager.h @@ -42,7 +42,6 @@ namespace SimulationInterfaces ~SimulationManager(); // AZ::Component - void Init() override; void Activate() override; void Deactivate() override; diff --git a/Gems/SimulationInterfaces/Code/Source/Services/DeleteEntityServiceHandler.h b/Gems/SimulationInterfaces/Code/Source/Services/DeleteEntityServiceHandler.h index cd6e8f96a6..2f587a27fc 100644 --- a/Gems/SimulationInterfaces/Code/Source/Services/DeleteEntityServiceHandler.h +++ b/Gems/SimulationInterfaces/Code/Source/Services/DeleteEntityServiceHandler.h @@ -30,8 +30,6 @@ namespace ROS2SimulationInterfaces AZStd::unordered_set GetProvidedFeatures() override; AZStd::optional HandleServiceRequest(const std::shared_ptr header, const Request& request) override; - - private: }; } // namespace ROS2SimulationInterfaces diff --git a/Gems/SimulationInterfaces/Code/Source/Services/GetEntitiesServiceHandler.h b/Gems/SimulationInterfaces/Code/Source/Services/GetEntitiesServiceHandler.h index e5668fabed..bea01df183 100644 --- a/Gems/SimulationInterfaces/Code/Source/Services/GetEntitiesServiceHandler.h +++ b/Gems/SimulationInterfaces/Code/Source/Services/GetEntitiesServiceHandler.h @@ -29,8 +29,6 @@ namespace ROS2SimulationInterfaces AZStd::unordered_set GetProvidedFeatures() override; AZStd::optional HandleServiceRequest(const std::shared_ptr header, const Request& request) override; - - private: }; } // namespace ROS2SimulationInterfaces diff --git a/Gems/SimulationInterfaces/Code/Source/Services/GetEntitiesStatesServiceHandler.h b/Gems/SimulationInterfaces/Code/Source/Services/GetEntitiesStatesServiceHandler.h index 8281548313..02b52d7b9d 100644 --- a/Gems/SimulationInterfaces/Code/Source/Services/GetEntitiesStatesServiceHandler.h +++ b/Gems/SimulationInterfaces/Code/Source/Services/GetEntitiesStatesServiceHandler.h @@ -30,8 +30,6 @@ namespace ROS2SimulationInterfaces AZStd::unordered_set GetProvidedFeatures() override; AZStd::optional HandleServiceRequest(const std::shared_ptr header, const Request& request) override; - - private: }; } // namespace ROS2SimulationInterfaces diff --git a/Gems/SimulationInterfaces/Code/Source/Services/GetEntityStateServiceHandler.h b/Gems/SimulationInterfaces/Code/Source/Services/GetEntityStateServiceHandler.h index 5960c664c3..04855469c2 100644 --- a/Gems/SimulationInterfaces/Code/Source/Services/GetEntityStateServiceHandler.h +++ b/Gems/SimulationInterfaces/Code/Source/Services/GetEntityStateServiceHandler.h @@ -30,7 +30,5 @@ namespace ROS2SimulationInterfaces AZStd::unordered_set GetProvidedFeatures() override; AZStd::optional HandleServiceRequest(const std::shared_ptr header, const Request& request) override; - - private: }; } // namespace ROS2SimulationInterfaces diff --git a/Gems/SimulationInterfaces/Code/Source/Services/GetSimulationFeaturesServiceHandler.cpp b/Gems/SimulationInterfaces/Code/Source/Services/GetSimulationFeaturesServiceHandler.cpp index 658150ebe5..165dfbea4c 100644 --- a/Gems/SimulationInterfaces/Code/Source/Services/GetSimulationFeaturesServiceHandler.cpp +++ b/Gems/SimulationInterfaces/Code/Source/Services/GetSimulationFeaturesServiceHandler.cpp @@ -32,12 +32,12 @@ namespace ROS2SimulationInterfaces o3deInterfaces, &SimulationInterfaces::SimulationFeaturesAggregatorRequests::GetSimulationFeatures); // create common features and return it; // common features are logical AND between two sets - AZStd::unordered_set commonFeatures; - commonFeatures.insert(ros2Interfaces.begin(), ros2Interfaces.end()); - commonFeatures.insert(o3deInterfaces.begin(), o3deInterfaces.end()); + AZStd::unordered_set allFeatures; + allFeatures.insert(ros2Interfaces.begin(), ros2Interfaces.end()); + allFeatures.insert(o3deInterfaces.begin(), o3deInterfaces.end()); Response response; - for (auto id : commonFeatures) + for (auto id : allFeatures) { if (ros2Interfaces.contains(id) && o3deInterfaces.contains(SimulationInterfaces::SimulationFeatureType(id))) { diff --git a/Gems/SimulationInterfaces/Code/Source/Services/GetSimulationFeaturesServiceHandler.h b/Gems/SimulationInterfaces/Code/Source/Services/GetSimulationFeaturesServiceHandler.h index 8e993943b4..6c8c4fbab2 100644 --- a/Gems/SimulationInterfaces/Code/Source/Services/GetSimulationFeaturesServiceHandler.h +++ b/Gems/SimulationInterfaces/Code/Source/Services/GetSimulationFeaturesServiceHandler.h @@ -31,8 +31,6 @@ namespace ROS2SimulationInterfaces AZStd::unordered_set GetProvidedFeatures() override; AZStd::optional HandleServiceRequest(const std::shared_ptr header, const Request& request) override; - - private: }; } // namespace ROS2SimulationInterfaces diff --git a/Gems/SimulationInterfaces/Code/Source/Services/GetSpawnablesServiceHandler.cpp b/Gems/SimulationInterfaces/Code/Source/Services/GetSpawnablesServiceHandler.cpp index 6435f30653..d22f120ec3 100644 --- a/Gems/SimulationInterfaces/Code/Source/Services/GetSpawnablesServiceHandler.cpp +++ b/Gems/SimulationInterfaces/Code/Source/Services/GetSpawnablesServiceHandler.cpp @@ -45,7 +45,6 @@ namespace ROS2SimulationInterfaces simSpawnable.description = spawnable.m_description.c_str(); return simSpawnable; }); - response.result.result = simulation_interfaces::msg::Result::RESULT_OK; return response; } diff --git a/Gems/SimulationInterfaces/Code/Source/Services/GetSpawnablesServiceHandler.h b/Gems/SimulationInterfaces/Code/Source/Services/GetSpawnablesServiceHandler.h index 0a14fe5838..69159cc415 100644 --- a/Gems/SimulationInterfaces/Code/Source/Services/GetSpawnablesServiceHandler.h +++ b/Gems/SimulationInterfaces/Code/Source/Services/GetSpawnablesServiceHandler.h @@ -30,8 +30,6 @@ namespace ROS2SimulationInterfaces AZStd::unordered_set GetProvidedFeatures() override; AZStd::optional HandleServiceRequest(const std::shared_ptr header, const Request& request) override; - - private: }; } // namespace ROS2SimulationInterfaces diff --git a/Gems/SimulationInterfaces/Code/Source/Services/ResetSimulationServiceHandler.cpp b/Gems/SimulationInterfaces/Code/Source/Services/ResetSimulationServiceHandler.cpp index 165fa4da47..03490d437f 100644 --- a/Gems/SimulationInterfaces/Code/Source/Services/ResetSimulationServiceHandler.cpp +++ b/Gems/SimulationInterfaces/Code/Source/Services/ResetSimulationServiceHandler.cpp @@ -31,7 +31,7 @@ namespace ROS2SimulationInterfaces AZStd::optional ResetSimulationServiceHandler::HandleServiceRequest( const std::shared_ptr header, const Request& request) { - if (request.scope == simulation_interfaces::srv::ResetSimulation::Request::SCOPE_STATE) + if (request.scope == Request::SCOPE_STATE) { Response response; SimulationInterfaces::SimulationEntityManagerRequestBus::Broadcast( @@ -40,7 +40,7 @@ namespace ROS2SimulationInterfaces return response; } - if (request.scope == simulation_interfaces::srv::ResetSimulation::Request::SCOPE_SPAWNED) + if (request.scope == Request::SCOPE_SPAWNED) { auto deletionCompletedCb = [this](const AZ::Outcome& outcome) { diff --git a/Gems/SimulationInterfaces/Code/Source/Services/SetEntityStateServiceHandler.h b/Gems/SimulationInterfaces/Code/Source/Services/SetEntityStateServiceHandler.h index 4a144ecb9c..f096580556 100644 --- a/Gems/SimulationInterfaces/Code/Source/Services/SetEntityStateServiceHandler.h +++ b/Gems/SimulationInterfaces/Code/Source/Services/SetEntityStateServiceHandler.h @@ -30,8 +30,6 @@ namespace ROS2SimulationInterfaces AZStd::unordered_set GetProvidedFeatures() override; AZStd::optional HandleServiceRequest(const std::shared_ptr header, const Request& request) override; - - private: }; } // namespace ROS2SimulationInterfaces diff --git a/Gems/SimulationInterfaces/Code/Source/Services/SpawnEntityServiceHandler.cpp b/Gems/SimulationInterfaces/Code/Source/Services/SpawnEntityServiceHandler.cpp index 619bb8172d..60544df56c 100644 --- a/Gems/SimulationInterfaces/Code/Source/Services/SpawnEntityServiceHandler.cpp +++ b/Gems/SimulationInterfaces/Code/Source/Services/SpawnEntityServiceHandler.cpp @@ -37,8 +37,8 @@ namespace ROS2SimulationInterfaces return AZStd::nullopt; } - // Validate frame name - if (!entityNamespace.empty() && !ValidateFrameName(entityNamespace)) + // Validate namespace name + if (!entityNamespace.empty() && !ValidateNamespaceName(entityNamespace)) { Response response; response.result.result = simulation_interfaces::srv::SpawnEntity::Response::NAMESPACE_INVALID; @@ -81,12 +81,12 @@ namespace ROS2SimulationInterfaces return AZStd::regex_match(entityName, entityRegex); } - bool SpawnEntityServiceHandler::ValidateFrameName(const AZStd::string& frameName) + bool SpawnEntityServiceHandler::ValidateNamespaceName(const AZStd::string& namespaceName) { - const AZStd::regex frameRegex{ + const AZStd::regex namespaceRegex{ R"(^[a-zA-Z0-9_/]+$)" - }; // Entity names can only contain alphanumeric characters and underscores and forward slashes - return AZStd::regex_match(frameName, frameRegex); + }; // Namespace names can only contain alphanumeric characters and underscores and forward slashes + return AZStd::regex_match(namespaceName, namespaceRegex); } } // namespace ROS2SimulationInterfaces diff --git a/Gems/SimulationInterfaces/Code/Source/Services/SpawnEntityServiceHandler.h b/Gems/SimulationInterfaces/Code/Source/Services/SpawnEntityServiceHandler.h index e63ab0ff04..26cba7d3ec 100644 --- a/Gems/SimulationInterfaces/Code/Source/Services/SpawnEntityServiceHandler.h +++ b/Gems/SimulationInterfaces/Code/Source/Services/SpawnEntityServiceHandler.h @@ -32,7 +32,7 @@ namespace ROS2SimulationInterfaces private: bool ValidateEntityName(const AZStd::string& entityName); - bool ValidateFrameName(const AZStd::string& frameName); + bool ValidateNamespaceName(const AZStd::string& namespaceName); }; } // namespace ROS2SimulationInterfaces diff --git a/Gems/SimulationInterfaces/Code/Source/SimulationInterfacesModuleInterface.cpp b/Gems/SimulationInterfaces/Code/Source/SimulationInterfacesModuleInterface.cpp index 598d4a802b..61712def0d 100644 --- a/Gems/SimulationInterfaces/Code/Source/SimulationInterfacesModuleInterface.cpp +++ b/Gems/SimulationInterfaces/Code/Source/SimulationInterfacesModuleInterface.cpp @@ -11,10 +11,10 @@ #include -#include "Clients/SimulationFeaturesAggregator.h" -#include "Clients/SimulationManager.h" #include #include +#include +#include namespace SimulationInterfaces { diff --git a/Gems/SimulationInterfaces/Code/Source/Utils/Utils.h b/Gems/SimulationInterfaces/Code/Source/Utils/Utils.h index 57d7f2f8a8..d031a21d72 100644 --- a/Gems/SimulationInterfaces/Code/Source/Utils/Utils.h +++ b/Gems/SimulationInterfaces/Code/Source/Utils/Utils.h @@ -38,7 +38,7 @@ namespace ROS2SimulationInterfaces::Utils const AZ::Aabb aabb = AZ::Aabb::CreateFromMinMax(lowerLeft, upperRight); filter.m_boundsShape = AZStd::make_shared(aabb.GetExtents()); } - else if (type == simulation_interfaces::msg::Bounds::TYPE_CONVEX_HULL) // TYPE_CONVEX_HULL + else if (type == simulation_interfaces::msg::Bounds::TYPE_CONVEX_HULL) { if (request.filters.bounds.points.size() < 3) { @@ -46,7 +46,7 @@ namespace ROS2SimulationInterfaces::Utils } filter.m_boundsShape = AZStd::make_shared(); } - else if (type == simulation_interfaces::msg::Bounds::TYPE_SPHERE) // TYPE_SPHERE + else if (type == simulation_interfaces::msg::Bounds::TYPE_SPHERE) { if (request.filters.bounds.points.size() != 2) { diff --git a/Gems/SimulationInterfaces/Code/Tests/Clients/ROS2SimulationInterfacesTest.cpp b/Gems/SimulationInterfaces/Code/Tests/Clients/ROS2SimulationInterfacesTest.cpp deleted file mode 100644 index 40217ff9bc..0000000000 --- a/Gems/SimulationInterfaces/Code/Tests/Clients/ROS2SimulationInterfacesTest.cpp +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include - -AZ_UNIT_TEST_HOOK(DEFAULT_UNIT_TEST_ENV); diff --git a/Gems/SimulationInterfaces/Code/Tests/Clients/SimulationInterfacesTest.cpp b/Gems/SimulationInterfaces/Code/Tests/Clients/SimulationInterfacesTest.cpp deleted file mode 100644 index 40217ff9bc..0000000000 --- a/Gems/SimulationInterfaces/Code/Tests/Clients/SimulationInterfacesTest.cpp +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include - -AZ_UNIT_TEST_HOOK(DEFAULT_UNIT_TEST_ENV); diff --git a/Gems/SimulationInterfaces/Code/Tests/Tools/InterfacesTest.cpp b/Gems/SimulationInterfaces/Code/Tests/Tools/InterfacesTest.cpp index 71a2b52c54..284fb1d90b 100644 --- a/Gems/SimulationInterfaces/Code/Tests/Tools/InterfacesTest.cpp +++ b/Gems/SimulationInterfaces/Code/Tests/Tools/InterfacesTest.cpp @@ -23,20 +23,37 @@ #include #include -#include "Clients/ROS2SimulationInterfacesSystemComponent.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + #include "Mocks/SimulationEntityManagerMock.h" #include "Mocks/SimulationFeaturesAggregatorRequestsHandlerMock.h" #include "Mocks/SimulationManagerMock.h" + #include -#include -#include -#include + #include #include #include #include #include #include + +#include +#include #include #include #include diff --git a/Gems/SimulationInterfaces/gem.json b/Gems/SimulationInterfaces/gem.json index f0316347e9..ff09497a45 100644 --- a/Gems/SimulationInterfaces/gem.json +++ b/Gems/SimulationInterfaces/gem.json @@ -7,22 +7,26 @@ "origin": "RobotecAI", "origin_url": "https://robotec.ai", "type": "Code", - "summary": "This gem provides C++ API for simulation interfaces.", + "summary": "This gem provides ROS 2 and C++ API for simulation interfaces.", "canonical_tags": [ "Gem" ], "user_tags": [ - "SimulationInterfaces", "ROS2", "ROS 2" + "SimulationInterfaces", + "ROS2", + "ROS 2" ], "platforms": [ "" ], "icon_path": "preview.png", - "requirements": "", + "requirements": "Requires ROS 2 Gem", "documentation_url": "", - "dependencies": ["ROS2"], + "dependencies": [ + "ROS2>=3.3.0" + ], "repo_uri": "", "compatible_engines": [], "engine_api_dependencies": [], "restricted": "SimulationInterfaces" -} +} \ No newline at end of file