Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry-picks stabilization -> development #773

Merged
merged 10 commits into from
Oct 16, 2024
2 changes: 1 addition & 1 deletion Gems/OpenXRVk/gem.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"documentation_url": "",
"dependencies": [],
"repo_uri": "https://raw.githubusercontent.com/o3de/o3de-extras/development",
"download_source_uri": "https://github.com/o3de/o3de-extras/releases/download/2.0/openxrvk-1.0.0-gem.zip",
"download_source_uri": "https://github.com/o3de/o3de-extras/releases/download/2.0/openxrvk-1.0.1-gem.zip",
"version": "1.0.1"
}
9 changes: 7 additions & 2 deletions Gems/ROS2/Code/Include/ROS2/Frame/NamespaceConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,14 @@ namespace ROS2
//! @param parentNamespace parent namespace.
void SetParentNamespace(const AZStd::string& parentNamespace);

//! Initializes the namespace configuration.
//! This function should be called in the Init functions of frame components.
void Init();

private:
AZStd::string m_namespace;
AZStd::string m_parentNamespace;
AZStd::string m_customNamespace = ""; //!< Custom namespace that can be set by the user
AZStd::string m_namespace = ""; //!< Current namespace (might be custom); set automatically
AZStd::string m_parentNamespace = ""; //!< Parent namespace (might be custom); set automatically
NamespaceStrategy m_namespaceStrategy = NamespaceStrategy::Default;
bool m_isRoot;
AZStd::string m_entityName;
Expand Down
1 change: 1 addition & 0 deletions Gems/ROS2/Code/Include/ROS2/Frame/ROS2FrameComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ namespace ROS2

//////////////////////////////////////////////////////////////////////////
// Component overrides
void Init() override;
void Activate() override;
void Deactivate() override;
//////////////////////////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ namespace ROS2
ROS2FrameEditorComponent(const ROS2FrameConfiguration ros2FrameConfiguration);

// AzToolsFramework::Components::EditorComponentBase overrides
void Init() override;
void Activate() override;
void Deactivate() override;
void BuildGameEntity(AZ::Entity* gameEntity) override;
Expand Down
1 change: 1 addition & 0 deletions Gems/ROS2/Code/Source/Camera/CameraSensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ namespace ROS2
m_entityId.ToString().c_str());
AZ::RPI::RenderPipelineDescriptor pipelineDesc;
pipelineDesc.m_mainViewTagName = "MainCamera";
pipelineDesc.m_allowModification = true;
pipelineDesc.m_name = m_pipelineName;

pipelineDesc.m_rootPassTemplate = GetPipelineTemplateName();
Expand Down
15 changes: 11 additions & 4 deletions Gems/ROS2/Code/Source/Frame/NamespaceConfiguration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace ROS2
m_namespace = ROS2Names::RosifyName(m_entityName);
break;
case NamespaceStrategy::Custom:
// Leave the namespace as is
m_namespace = m_customNamespace;
break;
default:
AZ_Assert(false, "Unhandled namespace strategy");
Expand Down Expand Up @@ -96,14 +96,20 @@ namespace ROS2
return m_namespaceStrategy == NamespaceConfiguration::NamespaceStrategy::Custom;
}

void NamespaceConfiguration::Init()
{
// Make sure that the namespace is up to date.
OnNamespaceStrategySelected();
}

void NamespaceConfiguration::Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<NamespaceConfiguration>()
->Version(1)
->Field("Namespace Strategy", &NamespaceConfiguration::m_namespaceStrategy)
->Field("Namespace", &NamespaceConfiguration::m_namespace);
->Field("Namespace", &NamespaceConfiguration::m_customNamespace);

if (AZ::EditContext* ec = serializeContext->GetEditContext())
{
Expand All @@ -117,9 +123,10 @@ namespace ROS2
->EnumAttribute(NamespaceConfiguration::NamespaceStrategy::Empty, "Empty")
->EnumAttribute(NamespaceConfiguration::NamespaceStrategy::FromEntityName, "Generate from entity name")
->EnumAttribute(NamespaceConfiguration::NamespaceStrategy::Custom, "Custom")
->DataElement(AZ::Edit::UIHandlers::Default, &NamespaceConfiguration::m_namespace, "Namespace", "Namespace")
->DataElement(AZ::Edit::UIHandlers::Default, &NamespaceConfiguration::m_customNamespace, "Namespace", "Namespace")
->Attribute(AZ::Edit::Attributes::Visibility, &NamespaceConfiguration::IsNamespaceCustom)
->Attribute(AZ::Edit::Attributes::ChangeValidate, &ROS2Names::ValidateNamespaceField);
->Attribute(AZ::Edit::Attributes::ChangeValidate, &ROS2Names::ValidateNamespaceField)
->Attribute(AZ::Edit::Attributes::ChangeNotify, &NamespaceConfiguration::UpdateNamespace);
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions Gems/ROS2/Code/Source/Frame/ROS2FrameComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ namespace ROS2

AZ_CLASS_ALLOCATOR_IMPL(JsonFrameComponentConfigSerializer, AZ::SystemAllocator);

void ROS2FrameComponent::Init()
{
m_namespaceConfiguration.Init();
}

void ROS2FrameComponent::Activate()
{
m_namespaceConfiguration.PopulateNamespace(IsTopLevel(), GetEntity()->GetName());
Expand Down
5 changes: 5 additions & 0 deletions Gems/ROS2/Code/Source/Frame/ROS2FrameEditorComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ namespace ROS2
m_configuration = ros2FrameConfiguration;
}

void ROS2FrameEditorComponent::Init()
{
m_configuration.m_namespaceConfiguration.Init();
}

void ROS2FrameEditorComponent::Activate()
{
ROS2FrameComponentBus::Handler::BusConnect(GetEntityId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
#include <AzToolsFramework/ToolsComponents/TransformComponent.h>
#include <ROS2/Communication/TopicConfiguration.h>
#include <ROS2/Frame/ROS2FrameEditorComponent.h>
#include <ROS2/Utilities/ROS2Names.h>
#include <RobotImporter/Utils/RobotImporterUtils.h>
#include <RobotImporter/Utils/TypeConversions.h>
#include <SdfAssetBuilder/SdfAssetBuilderSettings.h>
#include <VehicleDynamics/WheelControllerComponent.h>
#include <ROS2/Utilities/ROS2Names.h>

#include <sdf/Element.hh>
#include <sdf/Joint.hh>

namespace ROS2::SDFormat
Expand Down Expand Up @@ -106,16 +107,19 @@ namespace ROS2::SDFormat
// Inserts name (key) and value (val) of given parameter to map.
void ParseRegularContent(const sdf::Element& content, HooksUtils::PluginParams& remappings)
{
std::string contentName = content.GetName();
std::string contentValue = content.GetValue()->GetAsString();
if (contentName.empty() || contentValue.empty())
const AZStd::string contentName = content.GetName().c_str();
const sdf::ParamPtr contentValuePtr = content.GetValue();
if (!contentValuePtr || contentName.empty())
{
AZ_Warning("PluginParser", false, "Encountered empty parameter value while parsing URDF/SDF plugin.");
AZ_Warning("PluginParser", false, "Encountered invalid (empty) remapping while parsing URDF/SDF plugin.");
return;
}
AZStd::string key(contentName.c_str(), contentName.size());
AZStd::string val(contentValue.c_str(), contentValue.size());
remappings[key] = val;

const AZStd::string contentValue = contentValuePtr->GetAsString().c_str();
if (!contentValue.empty())
{
remappings[contentName] = contentValue;
}
}

// Parses parameters present in ros element, inserting them to the map.
Expand All @@ -127,17 +131,25 @@ namespace ROS2::SDFormat
ParseRegularContent(rosContent, remappings);
return;
}
AZStd::string contentValue = rosContent.GetValue()->GetAsString().c_str();

if (contentValue.find_last_of('=') == std::string::npos || contentValue.find_last_of(':') == std::string::npos)
const sdf::ParamPtr contentValuePtr = rosContent.GetValue();
if (!contentValuePtr)
{
AZ_Warning("PluginParser", false, "ROS 2 content in parsing URDF/SDF plugin data not available.");
return;
}

AZStd::string contentValue = contentValuePtr->GetAsString().c_str();

if (contentValue.find_last_of('=') == AZStd::string::npos || contentValue.find_last_of(':') == AZStd::string::npos)
{
AZ_Warning("PluginParser", false, "Encountered invalid remapping while parsing URDF/SDF plugin.");
return;
}

// get new name of the topic
int startVal = contentValue.find_last_of('=');
if (contentValue.find_last_of('/') != std::string::npos && contentValue.find_last_of('/') > startVal)
if (contentValue.find_last_of('/') != AZStd::string::npos && contentValue.find_last_of('/') > startVal)
{
startVal = contentValue.find_last_of("/");
}
Expand Down
18 changes: 17 additions & 1 deletion Gems/ROS2/Code/Source/Spawner/ROS2SpawnerComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "ROS2SpawnerComponent.h"
#include "Spawner/ROS2SpawnerComponentController.h"
#include <AzCore/Math/Quaternion.h>
#include <AzCore/Serialization/EditContext.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/std/string/conversions.h>
Expand Down Expand Up @@ -124,6 +125,20 @@ namespace ROS2
return;
}

AZ::Quaternion rotation(
request->initial_pose.orientation.x,
request->initial_pose.orientation.y,
request->initial_pose.orientation.z,
request->initial_pose.orientation.w);

if (rotation.IsZero())
{
response.success = false;
response.status_message = "Rotation is undefined. Action aborted.";
service_handle->send_response(*header, response);
return;
}

AZStd::string spawnableName(request->name.c_str());
AZStd::string spawnableNamespace(request->robot_namespace.c_str());
AZStd::string spawnPointName(request->xml.c_str(), request->xml.size());
Expand Down Expand Up @@ -217,7 +232,8 @@ namespace ROS2
request->initial_pose.orientation.x,
request->initial_pose.orientation.y,
request->initial_pose.orientation.z,
request->initial_pose.orientation.w),
request->initial_pose.orientation.w)
.GetNormalized(),
1.0f };
}
}
Expand Down
3 changes: 2 additions & 1 deletion Gems/ROS2/Code/Source/VehicleDynamics/Utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ namespace ROS2::VehicleDynamics::Utilities
if (articulation)
{
steeringData.m_steeringJoint = articulation->GetId();
const bool hasFreeAxis = Utils::TryGetFreeArticulationAxis(steeringData.m_steeringEntity, steeringData.m_axis);
[[maybe_unused]] const bool hasFreeAxis =
Utils::TryGetFreeArticulationAxis(steeringData.m_steeringEntity, steeringData.m_axis);

AZ_Error("VehicleDynamics::Utilities", hasFreeAxis, "Articulation steering has no free axis somehow");
}
Expand Down
4 changes: 2 additions & 2 deletions Gems/ROS2/gem.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"gem_name": "ROS2",
"version": "3.2.0",
"version": "3.2.1",
"platforms": [
"Linux"
],
Expand Down Expand Up @@ -36,5 +36,5 @@
],
"restricted": "ROS2",
"repo_uri": "https://raw.githubusercontent.com/o3de/o3de-extras/development",
"download_source_uri": "https://github.com/o3de/o3de-extras/releases/download/2.0/ros2-3.2.0-gem.zip"
"download_source_uri": "https://github.com/o3de/o3de-extras/releases/download/2.0//ros2-3.2.1-gem.zip"
}
3 changes: 1 addition & 2 deletions Gems/RosRobotSample/gem.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,5 @@
],
"repo_uri": "https://raw.githubusercontent.com/o3de/o3de-extras/development",
"restricted": "",
"download_source_uri": "https://github.com/o3de/o3de-extras/releases/download/2.0/rosrobotsample-2.0.0-gem.zip"
"download_source_uri": "https://github.com/o3de/o3de-extras/releases/download/2.0/rosrobotsample-2.0.1-gem.zip"
}

2 changes: 1 addition & 1 deletion Gems/XR/gem.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"documentation_url": "",
"dependencies": [],
"repo_uri": "https://raw.githubusercontent.com/o3de/o3de-extras/development",
"download_source_uri": "https://github.com/o3de/o3de-extras/releases/download/2.0/xr-1.0.0-gem.zip",
"download_source_uri": "https://github.com/o3de/o3de-extras/releases/download/2.0/xr-1.0.1-gem.zip",
"version": "1.0.1"
}
4 changes: 2 additions & 2 deletions Projects/OpenXRTest/project.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"project_name": "OpenXRTest",
"version": "1.0.0",
"version": "1.0.1",
"project_id": "{947211d5-689a-437f-8ad7-7f558edcd40a}",
"repo_uri": "https://raw.githubusercontent.com/o3de/o3de-extras/development",
"download_source_uri": "https://github.com/o3de/o3de-extras/releases/download/2.0/openxrtest-1.0.0-project.zip",
"download_source_uri": "https://github.com/o3de/o3de-extras/releases/download/2.0/openxrtest-1.0.1-project.zip",
"origin": "https://github.com/o3de/o3de-extras",
"license": "For terms please see the LICENSE*.TXT files at the root of this distribution.",
"display_name": "OpenXRTest",
Expand Down
5 changes: 4 additions & 1 deletion Templates/Multiplayer/template.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"template_name": "Multiplayer",
"version": "2.0.0",
"origin": "Open 3D Engine - o3de.org",
"license": "https://opensource.org/licenses/MIT",
"display_name": "Multiplayer",
Expand Down Expand Up @@ -1472,5 +1473,7 @@
{
"dir": "cmake"
}
]
],
"repo_uri": "https://raw.githubusercontent.com/o3de/o3de-extras/development",
"download_source_uri": "https://github.com/o3de/o3de-extras/releases/download/2.0/multiplayer-2.0.0-template.zip"
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,66 +53,19 @@ amcl:

bt_navigator:
ros__parameters:
use_sim_time: True
use_sim_time: true
global_frame: map
robot_base_frame: <robot_namespace>/base_link
odom_topic: odom
odom_topic: /odom
bt_loop_duration: 10
default_server_timeout: 20
# 'default_nav_through_poses_bt_xml' and 'default_nav_to_pose_bt_xml' are use defaults:
# nav2_bt_navigator/navigate_to_pose_w_replanning_and_recovery.xml
# nav2_bt_navigator/navigate_through_poses_w_replanning_and_recovery.xml
# They can be set here or via a RewrittenYaml remap from a parent launch file to Nav2.
plugin_lib_names:
- nav2_compute_path_to_pose_action_bt_node
- nav2_compute_path_through_poses_action_bt_node
- nav2_smooth_path_action_bt_node
- nav2_follow_path_action_bt_node
- nav2_spin_action_bt_node
- nav2_wait_action_bt_node
- nav2_assisted_teleop_action_bt_node
- nav2_back_up_action_bt_node
- nav2_drive_on_heading_bt_node
- nav2_clear_costmap_service_bt_node
- nav2_is_stuck_condition_bt_node
- nav2_goal_reached_condition_bt_node
- nav2_goal_updated_condition_bt_node
- nav2_globally_updated_goal_condition_bt_node
- nav2_is_path_valid_condition_bt_node
- nav2_initial_pose_received_condition_bt_node
- nav2_reinitialize_global_localization_service_bt_node
- nav2_rate_controller_bt_node
- nav2_distance_controller_bt_node
- nav2_speed_controller_bt_node
- nav2_truncate_path_action_bt_node
- nav2_truncate_path_local_action_bt_node
- nav2_goal_updater_node_bt_node
- nav2_recovery_node_bt_node
- nav2_pipeline_sequence_bt_node
- nav2_round_robin_node_bt_node
- nav2_transform_available_condition_bt_node
- nav2_time_expired_condition_bt_node
- nav2_path_expiring_timer_condition
- nav2_distance_traveled_condition_bt_node
- nav2_single_trigger_bt_node
- nav2_goal_updated_controller_bt_node
- nav2_is_battery_low_condition_bt_node
- nav2_navigate_through_poses_action_bt_node
- nav2_navigate_to_pose_action_bt_node
- nav2_remove_passed_goals_action_bt_node
- nav2_planner_selector_bt_node
- nav2_controller_selector_bt_node
- nav2_goal_checker_selector_bt_node
- nav2_controller_cancel_bt_node
- nav2_path_longer_on_approach_bt_node
- nav2_wait_cancel_bt_node
- nav2_spin_cancel_bt_node
- nav2_back_up_cancel_bt_node
- nav2_assisted_teleop_cancel_bt_node
- nav2_drive_on_heading_cancel_bt_node
- nav2_would_a_controller_recovery_help_condition_bt_node
- nav2_would_a_planner_recovery_help_condition_bt_node
- nav2_would_a_smoother_recovery_help_condition_bt_node
wait_for_service_timeout: 1000
action_server_result_timeout: 900.0
navigators: [navigate_to_pose, navigate_through_poses]
navigate_to_pose:
plugin: nav2_bt_navigator::NavigateToPoseNavigator
navigate_through_poses:
plugin: nav2_bt_navigator::NavigateThroughPosesNavigator

bt_navigator_navigate_through_poses_rclcpp_node:
ros__parameters:
Expand Down Expand Up @@ -265,7 +218,7 @@ planner_server:
use_sim_time: True
planner_plugins: ["GridBased"]
GridBased:
plugin: "nav2_navfn_planner/NavfnPlanner"
plugin: "nav2_navfn_planner::NavfnPlanner"
tolerance: 0.5
use_astar: false
allow_unknown: true
Expand All @@ -282,13 +235,13 @@ behavior_server:
cycle_frequency: 10.0
behavior_plugins: ["spin", "backup", "drive_on_heading", "wait"]
spin:
plugin: "nav2_behaviors/Spin"
plugin: "nav2_behaviors::Spin"
backup:
plugin: "nav2_behaviors/BackUp"
plugin: "nav2_behaviors::BackUp"
drive_on_heading:
plugin: "nav2_behaviors/DriveOnHeading"
plugin: "nav2_behaviors::DriveOnHeading"
wait:
plugin: "nav2_behaviors/Wait"
plugin: "nav2_behaviors::Wait"
global_frame: <robot_namespace>/odom
robot_base_frame: <robot_namespace>/base_link
transform_tolerance: 0.1
Expand Down
Loading