Nav2 Navigation Stack - rolling  main
ROS 2 Navigation Stack
Public Member Functions | Protected Attributes | List of all members
nav2_map_server::Shape Class Referenceabstract

Basic class, other vector objects to be inherited from. More...

#include <nav2_map_server/include/nav2_map_server/vector_object_shapes.hpp>

Inheritance diagram for nav2_map_server::Shape:
Inheritance graph
[legend]

Public Member Functions

 Shape (const nav2::LifecycleNode::WeakPtr &node)
 Shape basic class constructor. More...
 
virtual ~Shape ()
 Shape destructor.
 
ShapeType getType ()
 Returns type of the shape. More...
 
bool obtainShapeUUID (const std::string &shape_name, unsigned char *out_uuid)
 Supporting routine obtaining shape UUID from ROS-parameters for the given shape object. More...
 
virtual int8_t getValue () const =0
 Gets the value of the shape. Empty virtual method intended to be used in child implementations. More...
 
virtual std::string getFrameID () const =0
 Gets frame ID of the shape. Empty virtual method intended to be used in child implementations. More...
 
virtual std::string getUUID () const =0
 Gets UUID of the shape. Empty virtual method intended to be used in child implementations. More...
 
virtual bool isUUID (const unsigned char *uuid) const =0
 Checks whether the shape is equal to a given UUID. Empty virtual method intended to be used in child implementations. More...
 
virtual bool isFill () const =0
 Whether the shape to be filled or only its borders to be put on map. Empty virtual method intended to be used in child implementations. More...
 
virtual bool obtainParams (const std::string &shape_name)=0
 Supporting routine obtaining ROS-parameters for the given vector object. Empty virtual method intended to be used in child implementations. More...
 
virtual bool toFrame (const std::string &to_frame, const std::shared_ptr< tf2_ros::Buffer > tf_buffer, const double transform_tolerance)=0
 Transforms shape coordinates to a new frame. Empty virtual method intended to be used in child implementations. More...
 
virtual void getBoundaries (double &min_x, double &min_y, double &max_x, double &max_y)=0
 Gets shape box-boundaries. Empty virtual method intended to be used in child implementations. More...
 
virtual bool isPointInside (const double px, const double py) const =0
 Is the point inside the shape. Empty virtual method intended to be used in child implementations. More...
 
virtual void putBorders (nav_msgs::msg::OccupancyGrid::SharedPtr map, const OverlayType overlay_type)=0
 Puts shape borders on map. Empty virtual method intended to be used in child implementations. More...
 

Protected Attributes

ShapeType type_
 Type of shape.
 
nav2::LifecycleNode::WeakPtr node_
 VectorObjectServer node.
 

Detailed Description

Basic class, other vector objects to be inherited from.

Definition at line 46 of file vector_object_shapes.hpp.

Constructor & Destructor Documentation

◆ Shape()

nav2_map_server::Shape::Shape ( const nav2::LifecycleNode::WeakPtr &  node)
explicit

Shape basic class constructor.

Parameters
nodeVector Object server node pointer

Definition at line 37 of file vector_object_shapes.cpp.

Member Function Documentation

◆ getBoundaries()

virtual void nav2_map_server::Shape::getBoundaries ( double &  min_x,
double &  min_y,
double &  max_x,
double &  max_y 
)
pure virtual

Gets shape box-boundaries. Empty virtual method intended to be used in child implementations.

Parameters
min_xoutput min X-boundary of shape
min_youtput min Y-boundary of shape
max_xoutput max X-boundary of shape
max_youtput max Y-boundary of shape

Implemented in nav2_map_server::Circle, and nav2_map_server::Polygon.

◆ getFrameID()

virtual std::string nav2_map_server::Shape::getFrameID ( ) const
pure virtual

Gets frame ID of the shape. Empty virtual method intended to be used in child implementations.

Returns
Frame ID where the shape is

Implemented in nav2_map_server::Circle, and nav2_map_server::Polygon.

◆ getType()

ShapeType nav2_map_server::Shape::getType ( )

Returns type of the shape.

Returns
Type of the shape

Definition at line 44 of file vector_object_shapes.cpp.

References type_.

◆ getUUID()

virtual std::string nav2_map_server::Shape::getUUID ( ) const
pure virtual

Gets UUID of the shape. Empty virtual method intended to be used in child implementations.

Returns
Shape UUID string

Implemented in nav2_map_server::Circle, and nav2_map_server::Polygon.

◆ getValue()

virtual int8_t nav2_map_server::Shape::getValue ( ) const
pure virtual

Gets the value of the shape. Empty virtual method intended to be used in child implementations.

Returns
OccupancyGrid value of the shape

Implemented in nav2_map_server::Circle, and nav2_map_server::Polygon.

◆ isFill()

virtual bool nav2_map_server::Shape::isFill ( ) const
pure virtual

Whether the shape to be filled or only its borders to be put on map. Empty virtual method intended to be used in child implementations.

Returns
True if shape to be filled

Implemented in nav2_map_server::Circle, and nav2_map_server::Polygon.

◆ isPointInside()

virtual bool nav2_map_server::Shape::isPointInside ( const double  px,
const double  py 
) const
pure virtual

Is the point inside the shape. Empty virtual method intended to be used in child implementations.

Parameters
pxX-coordinate of the given point to check
pyY-coordinate of the given point to check
Returns
True if given point inside the shape

Implemented in nav2_map_server::Circle, and nav2_map_server::Polygon.

◆ isUUID()

virtual bool nav2_map_server::Shape::isUUID ( const unsigned char *  uuid) const
pure virtual

Checks whether the shape is equal to a given UUID. Empty virtual method intended to be used in child implementations.

Parameters
uuidGiven UUID to check with
Returns
True if the shape has the same as given UUID, otherwise false

Implemented in nav2_map_server::Circle, and nav2_map_server::Polygon.

◆ obtainParams()

virtual bool nav2_map_server::Shape::obtainParams ( const std::string &  shape_name)
pure virtual

Supporting routine obtaining ROS-parameters for the given vector object. Empty virtual method intended to be used in child implementations.

Parameters
shape_nameName of the shape
Returns
True if all parameters were obtained or false in failure case

Implemented in nav2_map_server::Circle, and nav2_map_server::Polygon.

◆ obtainShapeUUID()

bool nav2_map_server::Shape::obtainShapeUUID ( const std::string &  shape_name,
unsigned char *  out_uuid 
)

Supporting routine obtaining shape UUID from ROS-parameters for the given shape object.

Returns
True if UUID was obtained or false in failure case

Definition at line 49 of file vector_object_shapes.cpp.

References node_.

Referenced by nav2_map_server::Polygon::obtainParams(), and nav2_map_server::Circle::obtainParams().

Here is the caller graph for this function:

◆ putBorders()

virtual void nav2_map_server::Shape::putBorders ( nav_msgs::msg::OccupancyGrid::SharedPtr  map,
const OverlayType  overlay_type 
)
pure virtual

Puts shape borders on map. Empty virtual method intended to be used in child implementations.

Parameters
mapOutput map pointer
overlay_typeOverlay type

Implemented in nav2_map_server::Circle, and nav2_map_server::Polygon.

◆ toFrame()

virtual bool nav2_map_server::Shape::toFrame ( const std::string &  to_frame,
const std::shared_ptr< tf2_ros::Buffer >  tf_buffer,
const double  transform_tolerance 
)
pure virtual

Transforms shape coordinates to a new frame. Empty virtual method intended to be used in child implementations.

Parameters
to_frameFrame ID to transform to
tf_bufferTF buffer to use for the transformation
transform_toleranceTransform tolerance
Returns
Whether it was transformed successfully

Implemented in nav2_map_server::Circle, and nav2_map_server::Polygon.


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