Class Polygon
Defined in File polygon.hpp
Inheritance Relationships
Derived Type
public nav2_collision_monitor::Circle
(Class Circle)
Class Documentation
Basic polygon shape class. For STOP/SLOWDOWN model it represents zone around the robot while for APPROACH model it represents robot footprint.
Subclassed by nav2_collision_monitor::Circle
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 maximum points to enter inside polygon causing no action.
- Returns:
Maximum points to enter to current polygon and take no action
Obtains speed slowdown ratio for current polygon. Applicable for SLOWDOWN model.
- Returns:
Speed slowdown ratio
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)
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 publishing topic
- Returns:
True if all parameters were obtained or false in failure case
Supporting routine obtaining polygon-specific ROS-parameters.
- Parameters:
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
Checks if point is inside polygon.
Callback executed when a parameter change is detected
- Parameters:
point – Given point to check
event – ParameterEvent message
- Returns:
True if given point is inside polygon, otherwise false
Protected Attributes
Collision Monitor node.
Collision monitor node logger stored for further usage.
Dynamic parameters handler.
Name of polygon.
Action type for the polygon.
Maximum number of data readings within a zone to not trigger the action.
Robot slowdown (share of its actual speed)
Time before collision in seconds.
Time step for robot movement simulation.
Footprint subscriber.
Whether polygon is enabled.
TF buffer.
Base frame ID.
Transform tolerance.
Whether to publish the polygon.
Polygon points stored for later publishing.
Polygon publisher for visualization purposes.
Polygon points (vertices)