19 #include "nav2_costmap_2d/footprint_subscriber.hpp"
20 #include "tf2/utils.hpp"
27 std::vector<geometry_msgs::msg::Point> & footprint,
28 std_msgs::msg::Header & footprint_header)
30 if (!footprint_received_.load()) {
34 auto current_footprint = footprint_.load();
35 if (!current_footprint) {
40 footprint_header = current_footprint->header;
47 std::vector<geometry_msgs::msg::Point> & footprint,
48 std_msgs::msg::Header & footprint_header)
54 geometry_msgs::msg::PoseStamped current_pose;
55 if (!nav2_util::getCurrentPose(
56 current_pose, tf_, footprint_header.frame_id, robot_base_frame_,
57 transform_tolerance_, footprint_header.stamp))
62 double x = current_pose.pose.position.x;
63 double y = current_pose.pose.position.y;
64 double theta = tf2::getYaw(current_pose.pose.orientation);
66 std::vector<geometry_msgs::msg::Point> temp;
70 footprint_header.frame_id = robot_base_frame_;
71 footprint_header.stamp = current_pose.header.stamp;
78 const geometry_msgs::msg::PolygonStamped::ConstSharedPtr & msg)
80 footprint_.store(msg);
81 if (!footprint_received_.load()) {
82 footprint_received_.store(
true);
void transformFootprint(double x, double y, double theta, const std::vector< geometry_msgs::msg::Point > &footprint_spec, std::vector< geometry_msgs::msg::Point > &oriented_footprint)
Given a pose and base footprint, build the oriented footprint of the robot (list of Points)
std::vector< geometry_msgs::msg::Point > toPointVector(const geometry_msgs::msg::Polygon &polygon)
Convert Polygon msg to vector of Points.