Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <ROS2/Utilities/ROS2Conversions.h>
#include <Source/RigidBodyComponent.h>
#include <imgui/imgui.h>
#include <tf2_ros/transform_listener.h>
#include <tf2_ros/transform_listener.hpp>

namespace ROS2PoseControl
{
Expand Down Expand Up @@ -135,7 +135,7 @@ namespace ROS2PoseControl
m_poseSubscription = ros2Node->create_subscription<geometry_msgs::msg::PoseStamped>(
namespacedTopicName.data(),
m_configuration.m_poseTopicConfiguration.GetQoS(),
[this](geometry_msgs::msg::PoseStamped::SharedPtr msg)
[this](geometry_msgs::msg::PoseStamped::ConstSharedPtr msg)
{
OnPoseMessageReceived(msg);
}
Expand Down Expand Up @@ -287,7 +287,7 @@ namespace ROS2PoseControl
return AZ::Success(AZ::Transform::CreateFromQuaternionAndTranslation(rotation, translation));
}

AZ::Outcome<AZ::Transform, void> ROS2PoseControl::GetTransformFromPoseStamped(const geometry_msgs::msg::PoseStamped::SharedPtr msg)
AZ::Outcome<AZ::Transform, void> ROS2PoseControl::GetTransformFromPoseStamped(const geometry_msgs::msg::PoseStamped::ConstSharedPtr msg)
{
if (!msg)
{
Expand All @@ -314,7 +314,7 @@ namespace ROS2PoseControl
return AZ::Success(transform);
}

void ROS2PoseControl::OnPoseMessageReceived(const geometry_msgs::msg::PoseStamped::SharedPtr msg)
void ROS2PoseControl::OnPoseMessageReceived(const geometry_msgs::msg::PoseStamped::ConstSharedPtr msg)
{
if (m_configuration.m_tracking_mode != TrackingMode::PoseMessages)
{
Expand Down
9 changes: 5 additions & 4 deletions Gems/ROS2PoseControl/Code/Source/Clients/ROS2PoseControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
#include <geometry_msgs/msg/pose_stamped.hpp>
#include <rclcpp/publisher.hpp>
#include <rclcpp/subscription.hpp>
#include <tf2_ros/buffer.h>
#include <tf2_ros/transform_listener.h>
#include <tf2_ros/buffer.hpp>
#include <tf2_ros/transform_listener.hpp>

namespace ROS2PoseControl
{
Expand Down Expand Up @@ -77,7 +77,8 @@ namespace ROS2PoseControl
//! transform is assumed to be in the global frame.
//! @param msg The PoseStamped message.
//! @return The world transform translated using the global frame and the pose stamped.
[[nodiscard]] AZ::Outcome<AZ::Transform, void> GetTransformFromPoseStamped(const geometry_msgs::msg::PoseStamped::SharedPtr msg);
[[nodiscard]] AZ::Outcome<AZ::Transform, void> GetTransformFromPoseStamped(
const geometry_msgs::msg::PoseStamped::ConstSharedPtr msg);

//! Removes the tilt from a transform by projecting the transform's forward vector onto the gravity direction and creating a new
//! basis from the projected forward vector and the gravity direction.
Expand All @@ -94,7 +95,7 @@ namespace ROS2PoseControl

//! Applies the given transform to the entity. Run when a transform is received from a PoseStamped message.
//! @param transform The transform to apply.
void OnPoseMessageReceived(const geometry_msgs::msg::PoseStamped::SharedPtr msg);
void OnPoseMessageReceived(const geometry_msgs::msg::PoseStamped::ConstSharedPtr msg);

//! Applies the given transform to the entity. Will check if removing tilt, applying an offset, and clamping to the ground are
//! enabled in the configuration and add those modifications to the input transform.
Expand Down
2 changes: 1 addition & 1 deletion Gems/ROS2PoseControl/gem.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"gem_name": "ROS2PoseControl",
"version": "4.0.0",
"version": "4.0.1",
"display_name": "ROS2PoseControl",
"license": "Apache-2.0",
"license_url": "https://opensource.org/licenses/Apache-2.0",
Expand Down
Loading