|
Nav2 Navigation Stack - lyrical
lyrical
ROS 2 Navigation Stack
|
Implementation for polygon source. More...
#include <nav2_collision_monitor/include/nav2_collision_monitor/polygon_source.hpp>


Public Member Functions | |
| PolygonSource (const nav2::LifecycleNode::WeakPtr &node, const std::string &source_name, const nav2::TransformBuffer::SharedPtr tf_buffer, const std::string &base_frame_id, const std::string &global_frame_id, const tf2::Duration &transform_tolerance, const rclcpp::Duration &source_timeout, const bool base_shift_correction) | |
| PolygonSource constructor. More... | |
| ~PolygonSource () | |
| PolygonSource destructor. | |
| bool | configure () |
| Data source configuration routine. Obtains ROS-parameters and creates subscriber. More... | |
| bool | getSourceData (const rclcpp::Time &curr_time, std::vector< Point > &data) override |
| Adds latest data from polygon source to the data array. More... | |
| void | convertPolygonStampedToPoints (const geometry_msgs::msg::PolygonStamped &polygon, std::vector< Point > &data) const |
| Converts a PolygonInstanceStamped to a std::vector<Point> More... | |
Public Member Functions inherited from nav2_collision_monitor::Source | |
| Source (const nav2::LifecycleNode::WeakPtr &node, const std::string &source_name, const nav2::TransformBuffer::SharedPtr tf_buffer, const std::string &base_frame_id, const std::string &global_frame_id, const tf2::Duration &transform_tolerance, const rclcpp::Duration &source_timeout, const bool base_shift_correction) | |
| Source constructor. More... | |
| virtual | ~Source () |
| Source destructor. | |
| bool | getData (const rclcpp::Time &curr_time, std::vector< Point > &data) |
| Adds latest data from source to the data array, then removes any points falling inside an enabled exclusion zone. More... | |
| void | activate () |
| Activates the exclusion zone visualization publishers (if any) | |
| void | deactivate () |
| Deactivates the exclusion zone visualization publishers (if any) | |
| void | publishExclusionZones () const |
| Publishes the source's exclusion zones for visualization. | |
| bool | getEnabled () const |
| Obtains source enabled state. More... | |
| std::string | getSourceName () const |
| Obtains the name of the data source. More... | |
| rclcpp::Duration | getSourceTimeout () const |
| Obtains the source_timeout parameter of the data source. More... | |
Protected Member Functions | |
| void | getParameters (std::string &source_topic) |
| Getting sensor-specific ROS-parameters. More... | |
| void | dataCallback (geometry_msgs::msg::PolygonInstanceStamped::ConstSharedPtr msg) |
| PolygonSource data callback. More... | |
Protected Member Functions inherited from nav2_collision_monitor::Source | |
| bool | configure () |
| Source configuration routine. More... | |
| void | getCommonParameters (std::string &source_topic) |
| Supporting routine obtaining ROS-parameters common for all data sources. More... | |
| bool | sourceValid (const rclcpp::Time &source_time, const rclcpp::Time &curr_time) const |
| Checks whether the source data might be considered as valid. More... | |
| void | addExclusionZoneCallback (const std::shared_ptr< rmw_request_id_t > request_header, const std::shared_ptr< nav2_msgs::srv::AddExclusionZone::Request > request, std::shared_ptr< nav2_msgs::srv::AddExclusionZone::Response > response) |
| Service callback to add an exclusion zone at runtime. | |
| void | removeExclusionZoneCallback (const std::shared_ptr< rmw_request_id_t > request_header, const std::shared_ptr< nav2_msgs::srv::RemoveExclusionZone::Request > request, std::shared_ptr< nav2_msgs::srv::RemoveExclusionZone::Response > response) |
| Service callback to remove an exclusion zone at runtime. | |
| rcl_interfaces::msg::SetParametersResult | validateParameterUpdatesCallback (const std::vector< rclcpp::Parameter > ¶meters) |
| Validate incoming parameter updates before applying them. This callback is triggered when one or more parameters are about to be updated. It checks the validity of parameter values and rejects updates that would lead to invalid or inconsistent configurations. More... | |
| void | updateParametersCallback (const std::vector< rclcpp::Parameter > ¶meters) |
| Apply parameter updates after validation This callback is executed when parameters have been successfully updated. It updates the internal configuration of the node with the new parameter values. More... | |
| bool | getTransform (const rclcpp::Time &curr_time, const std_msgs::msg::Header &data_header, tf2::Transform &tf_transform) const |
| Obtain the transform to get data from source frame and time where it was received to the base frame and current time (if base_shift_correction_ is true) or the transform without time shift considered which is less accurate but much more faster option not dependent on state estimation frames. More... | |
Protected Attributes | |
| nav2::Subscription< geometry_msgs::msg::PolygonInstanceStamped >::SharedPtr | data_sub_ |
| PolygonSource data subscriber. | |
| std::vector< geometry_msgs::msg::PolygonInstanceStamped > | data_ |
| Latest data obtained. | |
| double | sampling_distance_ |
| distance between sampled points on polygon edges | |
Protected Attributes inherited from nav2_collision_monitor::Source | |
| nav2::LifecycleNode::WeakPtr | node_ |
| Collision Monitor node. | |
| rclcpp::Logger | logger_ {rclcpp::get_logger("collision_monitor")} |
| Collision monitor node logger stored for further usage. | |
| std::mutex | mutex_ |
| Dynamic parameters handler. | |
| rclcpp::node_interfaces::PostSetParametersCallbackHandle::SharedPtr | post_set_params_handler_ |
| rclcpp::node_interfaces::OnSetParametersCallbackHandle::SharedPtr | on_set_params_handler_ |
| std::string | source_name_ |
| Name of data source. | |
| nav2::TransformBuffer::SharedPtr | tf_buffer_ |
| TF buffer. | |
| std::string | base_frame_id_ |
| Robot base frame ID. | |
| std::string | global_frame_id_ |
| Global frame ID for correct transform calculation. | |
| tf2::Duration | transform_tolerance_ |
| Transform tolerance. | |
| rclcpp::Duration | source_timeout_ |
| Maximum time interval in which data is considered valid. | |
| bool | base_shift_correction_ |
| Whether to correct source data towards to base frame movement, considering the difference between current time and latest source time. | |
| bool | enabled_ |
| Whether source is enabled. | |
| std::vector< std::shared_ptr< ExclusionZone > > | exclusion_zones_ |
| Exclusion zones masking out points from this source. | |
| nav2::ServiceServer< nav2_msgs::srv::AddExclusionZone >::SharedPtr | add_ez_service_ |
| Service to add an exclusion zone at runtime. | |
| nav2::ServiceServer< nav2_msgs::srv::RemoveExclusionZone >::SharedPtr | remove_ez_service_ |
| Service to remove an exclusion zone at runtime. | |
Implementation for polygon source.
Definition at line 34 of file polygon_source.hpp.
| nav2_collision_monitor::PolygonSource::PolygonSource | ( | const nav2::LifecycleNode::WeakPtr & | node, |
| const std::string & | source_name, | ||
| const nav2::TransformBuffer::SharedPtr | tf_buffer, | ||
| const std::string & | base_frame_id, | ||
| const std::string & | global_frame_id, | ||
| const tf2::Duration & | transform_tolerance, | ||
| const rclcpp::Duration & | source_timeout, | ||
| const bool | base_shift_correction | ||
| ) |
PolygonSource constructor.
| node | Collision Monitor node pointer |
| source_name | Name of data source |
| tf_buffer | Shared pointer to a TF buffer |
| base_frame_id | Robot base frame ID. The output data will be transformed into this frame. |
| global_frame_id | Global frame ID for correct transform calculation |
| transform_tolerance | Transform tolerance |
| source_timeout | Maximum time interval in which data is considered valid |
| base_shift_correction | Whether to correct source data towards to base frame movement, considering the difference between current time and latest source time |
Definition at line 31 of file polygon_source.cpp.
| bool nav2_collision_monitor::PolygonSource::configure | ( | ) |
Data source configuration routine. Obtains ROS-parameters and creates subscriber.
Definition at line 51 of file polygon_source.cpp.
References nav2_collision_monitor::Source::configure(), data_sub_, dataCallback(), getParameters(), and nav2_collision_monitor::Source::node_.

| void nav2_collision_monitor::PolygonSource::convertPolygonStampedToPoints | ( | const geometry_msgs::msg::PolygonStamped & | polygon, |
| std::vector< Point > & | data | ||
| ) | const |
Converts a PolygonInstanceStamped to a std::vector<Point>
Definition at line 126 of file polygon_source.cpp.
References sampling_distance_, and nav2_collision_monitor::Source::source_name_.
Referenced by getSourceData().

|
protected |
PolygonSource data callback.
| msg | Shared pointer to PolygonSource message |
Definition at line 173 of file polygon_source.cpp.
References data_, and nav2_collision_monitor::Source::node_.
Referenced by configure().

|
protected |
Getting sensor-specific ROS-parameters.
| source_topic | Output name of source subscription topic |
Definition at line 160 of file polygon_source.cpp.
References nav2_collision_monitor::Source::getCommonParameters(), nav2_collision_monitor::Source::node_, sampling_distance_, and nav2_collision_monitor::Source::source_name_.
Referenced by configure().


|
overridevirtual |
Adds latest data from polygon source to the data array.
| curr_time | Current node time for data interpolation |
| data | Array where the data from source to be added. Added data is transformed to base_frame_id_ coordinate system at curr_time. |
Implements nav2_collision_monitor::Source.
Definition at line 73 of file polygon_source.cpp.
References nav2_collision_monitor::Source::base_frame_id_, nav2_collision_monitor::Source::base_shift_correction_, convertPolygonStampedToPoints(), data_, nav2_collision_monitor::Source::global_frame_id_, nav2_collision_monitor::Source::tf_buffer_, and nav2_collision_monitor::Source::transform_tolerance_.
