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 #ifdef __cpp_lib_atomic_shared_ptr
35 auto current_footprint = footprint_.load();
37 auto current_footprint = std::atomic_load(&footprint_);
39 if (!current_footprint) {
44 footprint_header = current_footprint->header;
51 std::vector<geometry_msgs::msg::Point> & footprint,
52 std_msgs::msg::Header & footprint_header)
58 geometry_msgs::msg::PoseStamped current_pose;
59 if (!nav2_util::getCurrentPose(
60 current_pose, tf_, footprint_header.frame_id, robot_base_frame_,
61 transform_tolerance_, footprint_header.stamp))
66 double x = current_pose.pose.position.x;
67 double y = current_pose.pose.position.y;
68 double theta = tf2::getYaw(current_pose.pose.orientation);
70 std::vector<geometry_msgs::msg::Point> temp;
74 footprint_header.frame_id = robot_base_frame_;
75 footprint_header.stamp = current_pose.header.stamp;
82 const geometry_msgs::msg::PolygonStamped::ConstSharedPtr & msg)
84 #ifdef __cpp_lib_atomic_shared_ptr
85 footprint_.store(msg);
87 std::atomic_store(&footprint_, msg);
89 if (!footprint_received_.load()) {
90 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.