Class Polygon
Defined in File polygon.hpp
Inheritance Relationships
Derived Types
public nav2_collision_monitor::Circle
(Class Circle)public nav2_collision_monitor::VelocityPolygon
(Class VelocityPolygon)
Class Documentation
Basic polygon shape class. For STOP/SLOWDOWN/LIMIT model it represents zone around the robot while for APPROACH model it represents robot footprint.
Subclassed by nav2_collision_monitor::Circle, nav2_collision_monitor::VelocityPolygon
Public Functions
Polygon constructor.
- Parameters:
node – Collision Monitor node pointer
polygon_name – Name of polygon
tf_buffer – Shared pointer to a TF buffer
base_frame_id – Robot base frame ID
transform_tolerance – Transform tolerance
Polygon destructor.
Shape configuration routine. Obtains ROS-parameters related to shape object and creates polygon lifecycle publisher.
- Returns:
True in case of everything is configured correctly, or false otherwise
Activates polygon lifecycle publisher.
Deactivates polygon lifecycle publisher.
Returns the name of polygon.
- Returns:
Polygon name
Obtains polygon action type.
- Returns:
Action type for current polygon
Obtains polygon enabled state.
- Returns:
Whether polygon is enabled
Obtains polygon minimum points to enter inside polygon causing the action.
- Returns:
Minimum number of data readings within a zone to trigger the action
Obtains speed slowdown ratio for current polygon. Applicable for SLOWDOWN model.
- Returns:
Speed slowdown ratio
Obtains speed linear limit for current polygon. Applicable for LIMIT model.
- Returns:
Speed linear limit
Obtains speed angular z limit for current polygon. Applicable for LIMIT model.
- Returns:
Speed angular limit
Obtains required time before collision for current polygon. Applicable for APPROACH model.
- Returns:
Time before collision in seconds
Gets polygon points.
- Parameters:
poly – Output polygon points (vertices)
Returns true if polygon points were set. Otherwise, prints a warning and returns false.
Updates polygon from footprint subscriber (if any)
Gets number of points inside given polygon.
- Parameters:
points – Input array of points to be checked
- Returns:
Number of points inside polygon. If there are no points, returns zero value.
Obtains estimated (simulated) time before a collision. Applicable for APPROACH model.
- Parameters:
collision_points – Array of 2D obstacle points
velocity – Simulated robot velocity
- Returns:
Estimated time before a collision. If there is no collision, return value will be negative.
Publishes polygon message into a its own topic.
Protected Functions
Supporting routine obtaining ROS-parameters common for all shapes.
- Parameters:
polygon_pub_topic – Output name of polygon or radius subscription topic. Empty, if no polygon subscription.
polygon_sub_topic – Output name of polygon publishing topic
footprint_topic – Output name of footprint topic. Empty, if no footprint subscription.
use_dynamic_sub – If false, the parameter polygon_sub_topic or footprint_topic will not be declared
- Returns:
True if all parameters were obtained or false in failure case
Supporting routine obtaining polygon-specific ROS-parameters.
- Parameters:
polygon_sub_topic – Output name of polygon or radius subscription topic. Empty, if no polygon subscription.
polygon_pub_topic – Output name of polygon publishing topic
footprint_topic – Output name of footprint topic. Empty, if no footprint subscription.
- Returns:
True if all parameters were obtained or false in failure case
Creates polygon or radius topic subscription.
- Parameters:
polygon_sub_topic – Output name of polygon or radius subscription topic. Empty, if no polygon subscription.
Updates polygon from geometry_msgs::msg::PolygonStamped message.
- Parameters:
msg – Message to update polygon from
Dynamic polygon callback.
- Parameters:
msg – Shared pointer to the polygon message
Callback executed when a parameter change is detected.
- Parameters:
event – ParameterEvent message
Checks if point is inside polygon.
- Parameters:
point – Given point to check
- Returns:
True if given point is inside polygon, otherwise false
Extracts Polygon points from a string with of the form [[x1,y1],[x2,y2],[x3,y3]…].
- Parameters:
poly_string – Input String containing the verteceis of the polygon
polygon – Output Point vector with all the vertecies of the polygon
- Returns:
True if all parameters were obtained or false in failure case
Protected Attributes
Collision Monitor node.
Collision monitor node logger stored for further usage.
Dynamic parameters handler.
Name of polygon.
Action type for the polygon.
Minimum number of data readings within a zone to trigger the action.
Robot slowdown (share of its actual speed)
Robot linear limit.
Robot angular limit.
Time before collision in seconds.
Time step for robot movement simulation.
Whether polygon is enabled.
Wether the subscription to polygon topic has transient local QoS durability.
Polygon subscription.
Footprint subscriber.
TF buffer.
Base frame ID.
Transform tolerance.
Whether to publish the polygon.
Polygon, used for: 1. visualization; 2. storing latest dynamic polygon message.
Polygon publisher for visualization purposes.
Polygon points (vertices) in a base_frame_id_.