ExclusionZoneDescription Message
Package: nav2_msgs
Category: Other Messages
Description of an exclusion zone for the collision monitor / detector. Used by the AddExclusionZone service to add zones at runtime.
Message Definition
| Field | Type | Description |
|---|---|---|
zone_name |
string |
Description of an exclusion zone for the collision monitor / detector. Used by the AddExclusionZone service to add zones at runtime.. Unique name within the source |
type |
string |
“polygon” or “circle” |
points |
geometry_msgs/Point32[] |
Polygon vertices in frame_id (ignored for circle) |
radius |
float64 |
Circle radius in metres (ignored for polygon) |
min_height |
float64 |
Lower z-bound in base frame (default: -DBL_MAX) |
max_height |
float64 |
Upper z-bound in base frame (default: +DBL_MAX) |
enabled |
bool |
Whether zone is active on creation |
visualize |
bool |
Whether to publish the zone polygon for rviz |
frame_hold_timeout |
float64 |
Extra staleness allowance (seconds) |
Usage Examples
Python
import rclpy
from rclpy.node import Node
from nav2_msgs.msg import ExclusionZoneDescription
class ExclusionZoneDescriptionPublisher(Node):
def __init__(self):
super().__init__('exclusionzonedescription_publisher')
self.publisher = self.create_publisher(ExclusionZoneDescription, 'exclusionzonedescription', 10)
def publish_message(self):
msg = ExclusionZoneDescription()
msg.zone_name = 'example_value'
msg.type = 'example_value'
msg.points = [] # Fill array as needed
msg.radius = 0.0
msg.min_height = 0.0
msg.max_height = 0.0
msg.enabled = True
msg.visualize = True
msg.frame_hold_timeout = 0.0
self.publisher.publish(msg)
C++
#include "rclcpp/rclcpp.hpp"
#include "nav2_msgs/msg/exclusion_zone_description.hpp"
class ExclusionZoneDescriptionPublisher : public rclcpp::Node
{
public:
ExclusionZoneDescriptionPublisher() : Node("exclusionzonedescription_publisher")
{
publisher_ = create_publisher<nav2_msgs::msg::ExclusionZoneDescription>("exclusionzonedescription", 10);
}
void publish_message()
{
auto msg = nav2_msgs::msg::ExclusionZoneDescription();
msg.zone_name = "example_value";
msg.type = "example_value";
// Fill msg.points array as needed
msg.radius = 0.0;
msg.min_height = 0.0;
msg.max_height = 0.0;
msg.enabled = true;
msg.visualize = true;
msg.frame_hold_timeout = 0.0;
publisher_->publish(msg);
}
private:
rclcpp::Publisher<nav2_msgs::msg::ExclusionZoneDescription>::SharedPtr publisher_;
};