Nav2 Navigation Stack - humble  humble
ROS 2 Navigation Stack
Classes | Typedefs | Enumerations | Functions
nav2_costmap_2d Namespace Reference

Classes

class  ClearCostmapService
 Exposes services to clear costmap objects in inclusive/exclusive regions or completely. More...
 
struct  MapLocation
 
class  Costmap2D
 A 2D costmap provides a mapping between points in the world and their associated "costs". More...
 
class  Costmap2DPublisher
 A tool to periodically publish visualization data from a Costmap2D. More...
 
class  Costmap2DROS
 A ROS wrapper for a 2D Costmap. Handles subscribing to topics that provide observations about obstacles in either the form of PointCloud or LaserScan messages. More...
 
class  BinaryFilter
 Reads in a speed restriction mask and enables a robot to dynamically adjust speed based on pose in map to slow in dangerous areas. Done via absolute speed setting or percentage of maximum speed. More...
 
class  CostmapFilter
 : CostmapFilter basic class. It is inherited from Layer in order to avoid hidden problems when the shared handling of costmap_ resource (PR #1936) More...
 
class  KeepoutFilter
 Reads in a keepout mask and marks keepout regions in the map to prevent planning or control in restricted areas. More...
 
class  SpeedFilter
 Reads in a speed restriction mask and enables a robot to dynamically adjust speed based on pose in map to slow in dangerous areas. Done via absolute speed setting or percentage of maximum speed. More...
 
class  CostmapLayer
 A costmap layer base class for costmap plugin layers. Rather than just a layer, this object also contains an internal costmap object to populate and maintain state. More...
 
class  CostmapSubscriber
 Subscribes to the costmap via a ros topic. More...
 
class  CostmapTopicCollisionChecker
 Using a costmap via a ros topic, this object is used to find if robot poses are in collision with the costmap environment. More...
 
class  Image
 Image with pixels of type T Сan own data, be a wrapper over some memory buffer, or refer to a fragment of another image Pixels of one row are stored continuity. But rows continuity is not guaranteed. The distance (number of elements of type T) from row(i) to row(i + 1) is equal to step() More...
 
class  MemoryBuffer
 A memory buffer that can grow to an upper-bounded capacity. More...
 
class  DenoiseLayer
 Layer filters noise-induced standalone obstacles (white costmap pixels) or small obstacles groups. More...
 
class  CollisionCheckerException
 Exceptions thrown if collision checker determines a pose is in collision with the environment costmap. More...
 
class  IllegalPoseException
 Thrown when CollisionChecker encounters a fatal error. More...
 
class  FootprintCollisionChecker
 Checker for collision with a footprint on a costmap. More...
 
class  FootprintSubscriber
 Subscriber to the footprint topic to get current robot footprint (if changing) for use in collision avoidance. More...
 
class  CellData
 Storage for cell information used during obstacle inflation. More...
 
class  InflationLayer
 Layer to convolve costmap by robot's radius or footprint to prevent collisions and largely simply collision checking. More...
 
class  Layer
 Abstract class for layered costmap plugin implementations. More...
 
class  LayeredCostmap
 Instantiates different layer plugins and aggregates them into one score. More...
 
class  Observation
 Stores an observation in terms of a point cloud and the origin of the source. More...
 
class  ObservationBuffer
 Takes in point clouds from sensors, transforms them to the desired frame, and stores them. More...
 
class  ObstacleLayer
 Takes in laser and pointcloud data to populate into 2D costmap. More...
 
class  RangeSensorLayer
 Takes in IR/Sonar/similar point measurement sensors and populates in costmap. More...
 
class  StaticLayer
 Takes in a map generated from SLAM to add costs to costmap. More...
 
class  VoxelLayer
 Takes laser and pointcloud data to populate a 3D voxel representation of the environment. More...
 

Typedefs

typedef std::vector< geometry_msgs::msg::Point > Footprint
 
using ClearExceptRegion = nav2_msgs::srv::ClearCostmapExceptRegion
 
using ClearAroundRobot = nav2_msgs::srv::ClearCostmapAroundRobot
 
using ClearEntirely = nav2_msgs::srv::ClearEntireCostmap
 

Enumerations

enum class  ConnectivityType : int { Way4 = 4 , Way8 = 8 }
 

Functions

std::vector< std::vector< float > > parseVVF (const std::string &input, std::string &error_return)
 Parse a vector of vectors of floats from a string. More...
 
template<class Max >
void dilate (const Image< uint8_t > &input, Image< uint8_t > &output, ConnectivityType connectivity, Max &&max_function)
 Perform morphological dilation. More...
 
template<ConnectivityType connectivity, class Label , class IsBg >
std::pair< Image< Label >, Label > connectedComponents (const Image< uint8_t > &image, MemoryBuffer &buffer, imgproc_impl::EquivalenceLabelTrees< Label > &label_trees, IsBg &&is_background)
 Compute the connected components labeled image of binary image Implements the SAUF algorithm (Two Strategies to Speed up Connected Component Labeling Algorithms Kesheng Wu, Ekow Otoo, Kenji Suzuki). More...
 
template<ConnectivityType connectivity, class Label , class IsBg >
Image< Label > connectedComponents (const Image< uint8_t > &image, MemoryBuffer &buffer, imgproc_impl::EquivalenceLabelTrees< Label > &label_trees, const IsBg &is_background, Label &total_labels)
 
void calculateMinAndMaxDistances (const std::vector< geometry_msgs::msg::Point > &footprint, double &min_dist, double &max_dist)
 Calculate the extreme distances for the footprint. More...
 
geometry_msgs::msg::Point toPoint (geometry_msgs::msg::Point32 pt)
 Convert Point32 to Point.
 
geometry_msgs::msg::Point32 toPoint32 (geometry_msgs::msg::Point pt)
 Convert Point to Point32.
 
geometry_msgs::msg::Polygon toPolygon (std::vector< geometry_msgs::msg::Point > pts)
 Convert vector of Points to Polygon msg.
 
std::vector< geometry_msgs::msg::Point > toPointVector (geometry_msgs::msg::Polygon::SharedPtr polygon)
 Convert Polygon msg to vector of Points.
 
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) More...
 
void transformFootprint (double x, double y, double theta, const std::vector< geometry_msgs::msg::Point > &footprint_spec, geometry_msgs::msg::PolygonStamped &oriented_footprint)
 Given a pose and base footprint, build the oriented footprint of the robot (PolygonStamped) More...
 
void padFootprint (std::vector< geometry_msgs::msg::Point > &footprint, double padding)
 Adds the specified amount of padding to the footprint (in place)
 
std::vector< geometry_msgs::msg::Point > makeFootprintFromRadius (double radius)
 Create a circular footprint from a given radius.
 
bool makeFootprintFromString (const std::string &footprint_string, std::vector< geometry_msgs::msg::Point > &footprint)
 Make the footprint from the given string. More...
 

Detailed Description

Provides a mapping for often used cost values

Provides constants used in costmap filters

Enumeration Type Documentation

◆ ConnectivityType

Enumerator
Way4 

neighbors pixels are connected horizontally and vertically

Way8 

neighbors pixels are connected horizontally, vertically and diagonally

Definition at line 33 of file image_processing.hpp.

Function Documentation

◆ calculateMinAndMaxDistances()

void nav2_costmap_2d::calculateMinAndMaxDistances ( const std::vector< geometry_msgs::msg::Point > &  footprint,
double &  min_dist,
double &  max_dist 
)

Calculate the extreme distances for the footprint.

Parameters
footprintThe footprint to examine
min_distOutput parameter of the minimum distance
max_distOutput parameter of the maximum distance

Definition at line 43 of file footprint.cpp.

Referenced by nav2_costmap_2d::LayeredCostmap::setFootprint().

Here is the caller graph for this function:

◆ connectedComponents()

template<ConnectivityType connectivity, class Label , class IsBg >
std::pair<Image<Label>, Label> nav2_costmap_2d::connectedComponents ( const Image< uint8_t > &  image,
MemoryBuffer buffer,
imgproc_impl::EquivalenceLabelTrees< Label > &  label_trees,
IsBg &&  is_background 
)

Compute the connected components labeled image of binary image Implements the SAUF algorithm (Two Strategies to Speed up Connected Component Labeling Algorithms Kesheng Wu, Ekow Otoo, Kenji Suzuki).

Template Parameters
connectivitypixels connectivity type
Labelinteger type of label
IsBgfunctor with signature bool (uint8_t)
Parameters
imageinput image
buffermemory block that will be used to store the result (labeled image) and the internal buffer for labels trees
label_treesunion-find data structure
is_backgroundreturns true if the passed pixel value is background
Exceptions
LabelOverflowif all possible values of the Label type are used and it is impossible to create a new unique
Returns
pair(labeled image, total number of labels) Labeled image has the same size as image. Label 0 represents the background label, labels [1, <return value> - 1] - separate components. Total number of labels == 0 for empty image. In other cases, label 0 is always counted, even if there is no background in the image. For example, for an image of one background pixel, the total number of labels == 2. Two labels (0, 1) have been counted, although label 0 is not used)

◆ dilate()

template<class Max >
void nav2_costmap_2d::dilate ( const Image< uint8_t > &  input,
Image< uint8_t > &  output,
ConnectivityType  connectivity,
Max &&  max_function 
)
inline

Perform morphological dilation.

Template Parameters
Maxfunction object
Parameters
inputinput image
outputoutput image
connectivityselector for selecting structuring element (Way4-> cross, Way8-> rect)
max_functiontakes as input std::initializer_list<uint8_t> with three elements. Returns the greatest value in list

Definition at line 94 of file image_processing.hpp.

◆ makeFootprintFromString()

bool nav2_costmap_2d::makeFootprintFromString ( const std::string &  footprint_string,
std::vector< geometry_msgs::msg::Point > &  footprint 
)

Make the footprint from the given string.

Format should be bracketed array of arrays of floats, like so: [[1.0, 2.2], [3.3, 4.2], ...]

Definition at line 174 of file footprint.cpp.

References parseVVF().

Referenced by nav2_costmap_2d::Costmap2DROS::dynamicParametersCallback(), nav2_costmap_2d::Costmap2DROS::getParameters(), and nav2_costmap_2d::Costmap2DROS::on_configure().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parseVVF()

std::vector< std::vector< float > > nav2_costmap_2d::parseVVF ( const std::string &  input,
std::string &  error_return 
)

Parse a vector of vectors of floats from a string.

Parse a vector of vector of floats from a string.

Parameters
error_returnIf no error, error_return is set to "". If error, error_return will describe the error. Syntax is [[1.0, 2.0], [3.3, 4.4, 5.5], ...]

On error, error_return is set and the return value could be anything, like part of a successful parse.

Parameters
input
error_returnSyntax is [[1.0, 2.0], [3.3, 4.4, 5.5], ...]

Definition at line 44 of file array_parser.cpp.

Referenced by makeFootprintFromString().

Here is the caller graph for this function:

◆ transformFootprint() [1/2]

void nav2_costmap_2d::transformFootprint ( double  x,
double  y,
double  theta,
const std::vector< geometry_msgs::msg::Point > &  footprint_spec,
geometry_msgs::msg::PolygonStamped &  oriented_footprint 
)

Given a pose and base footprint, build the oriented footprint of the robot (PolygonStamped)

Parameters
xThe x position of the robot
yThe y position of the robot
thetaThe orientation of the robot
footprint_specBasic shape of the footprint
oriented_footprintWill be filled with the points in the oriented footprint of the robot

Definition at line 127 of file footprint.cpp.

◆ transformFootprint() [2/2]

void nav2_costmap_2d::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)

Parameters
xThe x position of the robot
yThe y position of the robot
thetaThe orientation of the robot
footprint_specBasic shape of the footprint
oriented_footprintWill be filled with the points in the oriented footprint of the robot

Definition at line 109 of file footprint.cpp.

Referenced by nav2_costmap_2d::CostmapTopicCollisionChecker::getFootprint(), nav2_costmap_2d::FootprintSubscriber::getFootprintInRobotFrame(), nav2_costmap_2d::Costmap2DROS::getOrientedFootprint(), nav2_costmap_2d::ObstacleLayer::updateFootprint(), nav2_costmap_2d::StaticLayer::updateFootprint(), and nav2_costmap_2d::Costmap2DROS::updateMap().

Here is the caller graph for this function: