Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions Code/Source/HumanWorker/NpcNavigatorComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
#include <LmbrCentral/Shape/ShapeComponentBus.h>
#include <ROS2/Frame/ROS2FrameComponent.h>
#include <ROS2/ROS2Bus.h>
#include <ROS2/ROS2GemUtilities.h>
#include <ROS2/Utilities/ROS2Names.h>
#include <RecastNavigation/DetourNavigationBus.h>
#include <RecastNavigation/RecastNavigationMeshBus.h>

Expand Down Expand Up @@ -142,8 +140,7 @@ namespace HumanWorker
}
});

m_publisher =
CreatePublisher(ROS2::Utils::GetGameOrEditorComponent<ROS2::ROS2FrameComponent>(GetEntity()), m_twistTopicConfiguration);
m_publisher = CreatePublisher(GetEntity()->FindComponent<ROS2::ROS2FrameComponent>(), m_twistTopicConfiguration);

AZ::TickBus::Handler::BusConnect();

Expand Down Expand Up @@ -260,7 +257,9 @@ namespace HumanWorker
ROS2::ROS2FrameComponent* frame, const ROS2::TopicConfiguration& topicConfiguration)
{
auto ros2Node = ROS2::ROS2Interface::Get()->GetNode();
const auto& topicName = ROS2::ROS2Names::GetNamespacedName(frame->GetNamespace(), topicConfiguration.m_topic);
AZStd::string topicName = "";
ROS2::ROS2NamesRequestBus::BroadcastResult(
topicName, &ROS2::ROS2NamesRequests::GetNamespacedName, frame->GetNamespace(), topicConfiguration.m_topic);
const auto& qos = topicConfiguration.GetQoS();
return ros2Node->create_publisher<geometry_msgs::msg::Twist>(topicName.data(), qos);
}
Expand Down
17 changes: 13 additions & 4 deletions Code/Source/HumanWorker/NpcPoseNavigatorComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
#include <AzCore/std/parallel/mutex.h>
#include <ROS2/Frame/ROS2FrameComponent.h>
#include <ROS2/ROS2Bus.h>
#include <ROS2/ROS2GemUtilities.h>
#include <ROS2/Utilities/ROS2Conversions.h>
#include <ROS2/Utilities/ROS2Names.h>

namespace HumanWorker
{
Expand Down Expand Up @@ -73,9 +71,20 @@ namespace HumanWorker
}

const auto* ros2FrameComponent = m_entity->FindComponent<ROS2::ROS2FrameComponent>();
auto namespacedTopicName = ROS2::ROS2Names::GetNamespacedName(ros2FrameComponent->GetNamespace(), m_poseTopicConfiguration.m_topic);
AZStd::string namespacedTopicName = "";
ROS2::ROS2NamesRequestBus::BroadcastResult(
namespacedTopicName,
&ROS2::ROS2NamesRequests::GetNamespacedName,
ros2FrameComponent->GetNamespace(),
m_poseTopicConfiguration.m_topic);

if (namespacedTopicName.empty())
{
AZ_Error("NpcPoseNavigatorComponent", false, "Failed to get namespaced topic name.");
return;
}

const AZStd::string odomFrame = ros2FrameComponent->GetGlobalFrameName();
const AZStd::string odomFrame = ros2FrameComponent->GetGlobalFrameID();

m_tfBuffer = std::make_unique<tf2_ros::Buffer>(ros2Node->get_clock());
m_tfListener = std::make_unique<tf2_ros::TransformListener>(*m_tfBuffer);
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ Human worker objects are delivered as O3DE _prefabs_, containing visual models a
- `DetourNavigation` is a scene descriptor component for finding the path between the `Endpoints` within the navigation mesh.

## Release notes
### 3.0.0 for O3DE 2510.x
Changes compared to `2.0.0`
- Modified to work with `ROS2 Gem >= 4.0.0`
- Added check for invalid recast navigation mesh in `NpcNavigatorComponent`

### 2.0.0 for O3DE 2409.x
Changes compared to `1.1.0`
- Modified to work with `ROS2 Gem >= 3.1.0`
Expand All @@ -64,4 +69,4 @@ This work is licensed under [Apache License, Version 2.0][apache]. You may elect

[apache]: https://opensource.org/licenses/Apache-2.0
[mit]: https://opensource.org/licenses/MIT
[apache_shield]: https://img.shields.io/badge/License-Apache_2.0-blue.svg
[apache_shield]: https://img.shields.io/badge/License-Apache_2.0-blue.svg
4 changes: 2 additions & 2 deletions gem.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"gem_name": "HumanWorker",
"version": "2.0.0",
"version": "3.0.0",
"display_name": "HumanWorker",
"license": "Apache-2.0",
"license_url": "https://opensource.org/licenses/Apache-2.0",
Expand All @@ -20,7 +20,7 @@
"icon_path": "preview.png",
"requirements": "This gem requires ROS2, RecastNavigation, and PhysX gems.",
"dependencies": [
"ROS2>=3.1.0",
"ROS2>=4.0.0",
"RecastNavigation",
"PhysX5"
],
Expand Down