37 #ifndef NAV2_COSTMAP_2D__LAYER_HPP_
38 #define NAV2_COSTMAP_2D__LAYER_HPP_
43 #include <unordered_set>
45 #include "nav2_ros_common/tf2_factories.hpp"
46 #include "rclcpp/callback_group.hpp"
47 #include "rclcpp/clock.hpp"
48 #include "rclcpp/logger.hpp"
49 #include "nav2_costmap_2d/costmap_2d.hpp"
50 #include "nav2_costmap_2d/layered_costmap.hpp"
51 #include "nav2_ros_common/lifecycle_node.hpp"
79 nav2::TransformBuffer * tf,
80 const nav2::LifecycleNode::WeakPtr & node,
81 rclcpp::CallbackGroup::SharedPtr callback_group);
104 double robot_x,
double robot_y,
double robot_yaw,
double * min_x,
115 int min_i,
int min_j,
int max_i,
int max_j) = 0;
161 const std::vector<geometry_msgs::msg::Point> &
getFootprint()
const;
163 std::string
getFullName(
const std::string & param_name);
186 nav2::TransformBuffer * tf_;
187 rclcpp::CallbackGroup::SharedPtr callback_group_;
188 nav2::LifecycleNode::WeakPtr node_;
189 rclcpp::Clock::SharedPtr clock_;
190 rclcpp::Logger logger_{rclcpp::get_logger(
"nav2_costmap_2d")};
199 std::atomic_bool current_;
205 std::vector<geometry_msgs::msg::Point> footprint_spec_;
A 2D costmap provides a mapping between points in the world and their associated "costs".
Abstract class for layered costmap plugin implementations.
virtual void onFootprintChanged()
LayeredCostmap calls this whenever the footprint there changes (via LayeredCostmap::setFootprint())....
virtual void activate()
Restart publishers if they've been stopped.
std::string joinWithParentNamespace(const std::string &topic)
virtual void deactivate()
Stop publishers.
virtual bool isClearable()=0
If clearing operations should be processed on this layer or not.
void setCurrent(bool current)
Set whether the data in the layer is up to date.
bool isCurrent() const
Check to make sure all the data in the layer is up to date. If the layer is not up to date,...
virtual void onInitialize()
This is called at the end of initialize(). Override to implement subclass-specific initialization.
virtual void reset()=0
Reset this costmap.
virtual ~Layer()
A destructor.
bool isEnabled() const
Gets whether the layer is enabled.
const std::vector< geometry_msgs::msg::Point > & getFootprint() const
Convenience function for layered_costmap_->getFootprint().
void initialize(LayeredCostmap *parent, std::string name, nav2::TransformBuffer *tf, const nav2::LifecycleNode::WeakPtr &node, rclcpp::CallbackGroup::SharedPtr callback_group)
Initialization process of layer on startup.
virtual void updateBounds(double robot_x, double robot_y, double robot_yaw, double *min_x, double *min_y, double *max_x, double *max_y)=0
This is called by the LayeredCostmap to poll this plugin as to how much of the costmap it needs to up...
virtual void matchSize()
Implement this to make this layer match the size of the parent costmap.
virtual void updateCosts(Costmap2D &master_grid, int min_i, int min_j, int max_i, int max_j)=0
Actually update the underlying costmap, only within the bounds calculated during UpdateBounds().
std::string getFullName(const std::string ¶m_name)
Convenience functions for declaring ROS parameters.
std::string getName() const
Get the name of the costmap layer.
Instantiates different layer plugins and aggregates them into one score.