Nav2 Navigation Stack - rolling
main
ROS 2 Navigation Stack
|
A route operation to process a costmap to determine if a route is blocked requiring immediate rerouting. If using the local costmap topic, then it will check in the local time horizon only. if using the global, it may check the full route for continued validity. It is however recommended to specify a maximum collision distance for evaluation to prevent necessarily long-term evaluation of collision information which may not be representative of the conditions in that area by the time the robot gets there. More...
#include <nav2_route/include/nav2_route/plugins/route_operations/collision_monitor.hpp>
Classes | |
struct | LineSegment |
Public Member Functions | |
CollisionMonitor ()=default | |
Constructor. | |
virtual | ~CollisionMonitor ()=default |
destructor | |
void | configure (const nav2::LifecycleNode::SharedPtr node, std::shared_ptr< nav2_costmap_2d::CostmapSubscriber > costmap_subscriber, const std::string &name) override |
Configure. | |
std::string | getName () override |
Get name of the plugin for parameter scope mapping. More... | |
RouteOperationType | processType () override |
Indication that the adjust speed limit route operation is performed on all state changes. More... | |
OperationResult | perform (NodePtr, EdgePtr curr_edge, EdgePtr, const Route &route, const geometry_msgs::msg::PoseStamped &curr_pose, const Metadata *) override |
The main speed limit operation to adjust the maximum speed of the vehicle. More... | |
![]() | |
RouteOperation ()=default | |
Constructor. | |
virtual | ~RouteOperation ()=default |
Destructor. | |
Protected Member Functions | |
Coordinates | backoutValidEndPoint (const Coordinates &start, const Coordinates &end, const float dist) |
Backs out the end coordinate along the line segment start-end to length dist. More... | |
bool | backoutValidEndPoint (const Coordinates &start, LineSegment &line) |
Backs out the line end coordinates of the start-end line segment where costmap transforms are possible. More... | |
bool | lineToMap (const Coordinates &start, const Coordinates &end, LineSegment &line) |
Converts a line segment start-end into a LineSegment struct in costmap frame. More... | |
bool | isInCollision (const LineSegment &line) |
Checks a line segment in costmap frame for validity. More... | |
void | getCostmap () |
Gets the latest costmap from the costmap subscriber. | |
Protected Attributes | |
std::string | name_ |
std::string | topic_ |
std::atomic_bool | reroute_ |
rclcpp::Logger | logger_ {rclcpp::get_logger("CollisionMonitor")} |
rclcpp::Clock::SharedPtr | clock_ |
rclcpp::Time | last_check_time_ |
rclcpp::Duration | checking_duration_ {0, 0} |
float | max_collision_dist_ |
float | max_cost_ |
bool | reroute_on_collision_ |
unsigned int | check_resolution_ {1u} |
std::shared_ptr< nav2_costmap_2d::CostmapSubscriber > | costmap_subscriber_ |
std::shared_ptr< nav2_costmap_2d::Costmap2D > | costmap_ {nullptr} |
Additional Inherited Members | |
![]() | |
using | Ptr = std::shared_ptr< nav2_route::RouteOperation > |
A route operation to process a costmap to determine if a route is blocked requiring immediate rerouting. If using the local costmap topic, then it will check in the local time horizon only. if using the global, it may check the full route for continued validity. It is however recommended to specify a maximum collision distance for evaluation to prevent necessarily long-term evaluation of collision information which may not be representative of the conditions in that area by the time the robot gets there.
Definition at line 43 of file collision_monitor.hpp.
|
protected |
Backs out the end coordinate along the line segment start-end to length dist.
start | Start of line segment |
end | End of line segment |
dist | Distance along line segment to find the new end point along |
dist
away from the start along the line Definition at line 168 of file collision_monitor.cpp.
Referenced by perform().
|
protected |
Backs out the line end coordinates of the start-end line segment where costmap transforms are possible.
start | Start of line segment |
line | LineSegment object to replace the x1/y1 values for along segment until invalid |
Definition at line 183 of file collision_monitor.cpp.
References nav2_util::LineIterator::advance(), nav2_util::LineIterator::getX(), nav2_util::LineIterator::getY(), and nav2_util::LineIterator::isValid().
|
inlineoverridevirtual |
Get name of the plugin for parameter scope mapping.
Implements nav2_route::RouteOperation.
Definition at line 73 of file collision_monitor.hpp.
Referenced by configure().
|
protected |
Checks a line segment in costmap frame for validity.
line | LineSegment object to collision check in costmap set |
Definition at line 221 of file collision_monitor.cpp.
References nav2_util::LineIterator::advance(), nav2_util::LineIterator::getX(), nav2_util::LineIterator::getY(), and nav2_util::LineIterator::isValid().
Referenced by perform().
|
protected |
Converts a line segment start-end into a LineSegment struct in costmap frame.
start | Start of line segment |
end | End of line segment |
line | LineSegment object to populate |
Definition at line 210 of file collision_monitor.cpp.
Referenced by perform().
|
overridevirtual |
The main speed limit operation to adjust the maximum speed of the vehicle.
mdata | Metadata corresponding to the operation in the navigation graph. If metadata is invalid or irrelevant, a nullptr is given |
node_achieved | Node achieved, for additional context |
edge_entered | Edge entered by node achievement, for additional context |
edge_exited | Edge exited by node achievement, for additional context |
route | Current route being tracked in full, for additional context |
curr_pose | Current robot pose in the route frame, for additional context |
Implements nav2_route::RouteOperation.
Definition at line 90 of file collision_monitor.cpp.
References backoutValidEndPoint(), getCostmap(), isInCollision(), and lineToMap().
|
inlineoverridevirtual |
Indication that the adjust speed limit route operation is performed on all state changes.
Reimplemented from nav2_route::RouteOperation.
Definition at line 80 of file collision_monitor.hpp.