Nav2 Navigation Stack - rolling  main
ROS 2 Navigation Stack
Public Types | Public Member Functions | Static Public Member Functions | List of all members
nav2_costmap_2d::InflationLayerInterface Class Referenceabstract

Abstract interface for inflation layers, providing common methods needed by navigation components regardless of the inflation implementation. More...

#include <nav2_costmap_2d/include/nav2_costmap_2d/inflation_layer_interface.hpp>

Inheritance diagram for nav2_costmap_2d::InflationLayerInterface:
Inheritance graph
[legend]
Collaboration diagram for nav2_costmap_2d::InflationLayerInterface:
Collaboration graph
[legend]

Public Types

typedef std::recursive_mutex mutex_t
 

Public Member Functions

virtual double getCostScalingFactor ()=0
 Get the cost scaling factor. More...
 
virtual double getInflationRadius ()=0
 Get the inflation radius. More...
 
virtual mutex_t * getMutex ()=0
 Get the mutex of the inflation information. More...
 
virtual unsigned char computeCost (double distance) const =0
 Given a distance, compute a cost. More...
 
- Public Member Functions inherited from nav2_costmap_2d::Layer
 Layer ()
 A constructor.
 
virtual ~Layer ()
 A destructor.
 
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 deactivate ()
 Stop publishers.
 
virtual void activate ()
 Restart publishers if they've been stopped.
 
virtual void reset ()=0
 Reset this costmap.
 
virtual bool isClearable ()=0
 If clearing operations should be processed on this layer or not.
 
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 update. Each layer can increase the size of this bounds. More...
 
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().
 
virtual void matchSize ()
 Implement this to make this layer match the size of the parent costmap.
 
virtual void onFootprintChanged ()
 LayeredCostmap calls this whenever the footprint there changes (via LayeredCostmap::setFootprint()). Override to be notified of changes to the robot's footprint.
 
std::string getName () const
 Get the name of the costmap layer.
 
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, then it may be unsafe to plan using the data from this layer, and the planner may need to know. More...
 
void setCurrent (bool current)
 Set whether the data in the layer is up to date. More...
 
bool isEnabled () const
 Gets whether the layer is enabled.
 
const std::vector< geometry_msgs::msg::Point > & getFootprint () const
 Convenience function for layered_costmap_->getFootprint().
 
std::string getFullName (const std::string &param_name)
 Convenience functions for declaring ROS parameters.
 
std::string joinWithParentNamespace (const std::string &topic)
 

Static Public Member Functions

static std::shared_ptr< InflationLayerInterfacegetInflationLayer (std::shared_ptr< nav2_costmap_2d::Costmap2DROS > &costmap_ros, const std::string layer_name="")
 Get the inflation layer from a costmap, checking for both InflationLayer and LegacyInflationLayer implementations. More...
 

Additional Inherited Members

- Protected Member Functions inherited from nav2_costmap_2d::Layer
virtual void onInitialize ()
 This is called at the end of initialize(). Override to implement subclass-specific initialization. More...
 
- Protected Attributes inherited from nav2_costmap_2d::Layer
LayeredCostmaplayered_costmap_
 
std::string name_
 
nav2::TransformBuffer * tf_
 
rclcpp::CallbackGroup::SharedPtr callback_group_
 
nav2::LifecycleNode::WeakPtr node_
 
rclcpp::Clock::SharedPtr clock_
 
rclcpp::Logger logger_ {rclcpp::get_logger("nav2_costmap_2d")}
 
std::atomic_bool current_
 
bool enabled_
 

Detailed Description

Abstract interface for inflation layers, providing common methods needed by navigation components regardless of the inflation implementation.

Definition at line 34 of file inflation_layer_interface.hpp.

Member Function Documentation

◆ computeCost()

virtual unsigned char nav2_costmap_2d::InflationLayerInterface::computeCost ( double  distance) const
pure virtual

Given a distance, compute a cost.

Parameters
distanceThe distance from an obstacle in cells
Returns
A cost value for the distance

Implemented in nav2_costmap_2d::LegacyInflationLayer, and nav2_costmap_2d::InflationLayer.

◆ getCostScalingFactor()

virtual double nav2_costmap_2d::InflationLayerInterface::getCostScalingFactor ( )
pure virtual

Get the cost scaling factor.

Returns
The cost scaling factor

Implemented in nav2_costmap_2d::LegacyInflationLayer, and nav2_costmap_2d::InflationLayer.

◆ getInflationLayer()

static std::shared_ptr<InflationLayerInterface> nav2_costmap_2d::InflationLayerInterface::getInflationLayer ( std::shared_ptr< nav2_costmap_2d::Costmap2DROS > &  costmap_ros,
const std::string  layer_name = "" 
)
inlinestatic

Get the inflation layer from a costmap, checking for both InflationLayer and LegacyInflationLayer implementations.

Parameters
costmap_rosThe costmap ROS wrapper
layer_nameOptional name of the specific layer to find
Returns
Shared pointer to the inflation layer interface, or nullptr if not found

Definition at line 73 of file inflation_layer_interface.hpp.

Referenced by mppi::critics::CostCritic::findCircumscribedCost(), and mppi::critics::ObstaclesCritic::findCircumscribedCost().

Here is the caller graph for this function:

◆ getInflationRadius()

virtual double nav2_costmap_2d::InflationLayerInterface::getInflationRadius ( )
pure virtual

Get the inflation radius.

Returns
The inflation radius in meters

Implemented in nav2_costmap_2d::LegacyInflationLayer, and nav2_costmap_2d::InflationLayer.

◆ getMutex()

virtual mutex_t* nav2_costmap_2d::InflationLayerInterface::getMutex ( )
pure virtual

Get the mutex of the inflation information.

Returns
Pointer to the mutex

Implemented in nav2_costmap_2d::LegacyInflationLayer, and nav2_costmap_2d::InflationLayer.


The documentation for this class was generated from the following file: