Skip to content

Commit

Permalink
extract function transformFootprint
Browse files Browse the repository at this point in the history
  • Loading branch information
cmraaron committed Apr 24, 2023
1 parent 02c1fce commit cdee965
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/nav_to_anywhere.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@
#include "tf2_ros/transform_broadcaster.h"
#include "nav2_costmap_2d/footprint.hpp"

geometry_msgs::msg::PolygonStamped transformFootprint(
const geometry_msgs::msg::Pose2D & pose,
const std::vector<geometry_msgs::msg::Point> & footprint)
{
geometry_msgs::msg::PolygonStamped oriented_footprint;
nav2_costmap_2d::transformFootprint(pose.x, pose.y, pose.theta, footprint, oriented_footprint);
return oriented_footprint;
}

int main(int argc, char * argv[])
{
const auto footprint_default_loaded =
Expand Down Expand Up @@ -120,11 +129,7 @@ int main(int argc, char * argv[])
}
}
broadcast_tf();
geometry_msgs::msg::PolygonStamped oriented_footprint;
nav2_costmap_2d::transformFootprint(
pos_active.x, pos_active.y, pos_active.theta, footprint,
oriented_footprint);
local_footprint_pub->publish(oriented_footprint);
local_footprint_pub->publish(transformFootprint(pos_active, footprint));
});

const auto nav_to_pose_action_service = rclcpp_action::create_server<NavigateToPose>(
Expand Down

0 comments on commit cdee965

Please sign in to comment.