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

Add Spline Path Publisher Component #108

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

w-czerski
Copy link
Contributor

@w-czerski w-czerski commented Jan 28, 2025

About:

This PR adds a component with a spline path publisher.
It exposes current entity attached spline as a path available for ros2.

Signed-off-by: Wojciech Czerski <[email protected]>
Signed-off-by: Wojciech Czerski <[email protected]>
Signed-off-by: Wojciech Czerski <[email protected]>
Copy link
Contributor

@jhanca-robotecai jhanca-robotecai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not run the code, only browsed diagonally. Some nitpicks listed.

Signed-off-by: Wojciech Czerski <[email protected]>
Signed-off-by: Wojciech Czerski <[email protected]>
@w-czerski
Copy link
Contributor Author

Merge order:

#109 -> #108 -> main

serializeContext->Class<SplinePublisher, AZ::Component>()->Version(0)->Field("m_config", &SplinePublisher::m_config);
if (auto editContext = serializeContext->GetEditContext())
{
editContext->Class<SplinePublisher>("SplinePathPublisher", "Enables to publish spline as a ros2 path.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
editContext->Class<SplinePublisher>("SplinePathPublisher", "Enables to publish spline as a ros2 path.")
editContext->Class<SplinePublisher>("SplinePathPublisher", "Enables to publish spline as a ROS 2 path.")

SplinePublisherConfiguration::SplinePublisherConfiguration()
{
m_TopicConfig.m_type = "nav_msgs::msg::Path";
m_TopicConfig.m_topic = "spline_path";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Technically, the "spline path" might be confusing, because the spline doesn't move along the route defined by a path (like "tractor path" for example). We could use just spline or something like spline_points.

Suggested change
m_TopicConfig.m_topic = "spline_path";
m_TopicConfig.m_topic = "spline";

const ROS2::ROS2FrameComponent* ros2Frame = GetEntity()->FindComponent<ROS2::ROS2FrameComponent>();
if (!ros2Frame)
{
AZ_Warning("SplinePublisher::Activate", false, "ROS2 Frame Component is not available!");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
AZ_Warning("SplinePublisher::Activate", false, "ROS2 Frame Component is not available!");
AZ_Warning("SplinePublisher::Activate", false, "ROS 2 frame component is not available!");

const ROS2::ROS2FrameComponent* ros2Frame = GetEntity()->FindComponent<ROS2::ROS2FrameComponent>();
if (!ros2Frame)
{
AZ_Warning("SplinePublisher::PublishSplineAsPath", false, "ROS2 Frame Component is not available!");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
AZ_Warning("SplinePublisher::PublishSplineAsPath", false, "ROS2 Frame Component is not available!");
AZ_Warning("SplinePublisher::PublishSplineAsPath", false, "ROS 2 frame component is not available!");

Comment on lines +110 to +111
const ROS2::ROS2FrameComponent* ros2Frame = GetEntity()->FindComponent<ROS2::ROS2FrameComponent>();
if (!ros2Frame)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, the ros2Frame can be assumed to exist because you connect to Tick bus after the check in line 68.

As far as I know, you can't remove/add components when entity is active, therefore we can be sure that nothing strange happen between the ticks (without deactivate/activate and frame re-check). Additionally, you can save the reference and reuse it here if needed - no need to find component in every tick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants