Manages a collection of obstacles and provides avoidance computations.
More...
#include <obstacle_manager.hpp>
|
| | ObstacleManager ()=default |
| | Default constructor for ObstacleManager.
|
| |
| void | setRobotDimensions (float width, float length) |
| | Set the dimensions of the robot to define its bounding box for collisions.
|
| |
| void | addObstacle (float x, float y, float radius) |
| | Add a circular obstacle to the field representation.
|
| |
| void | removeObstacle (size_t index) |
| | Remove an obstacle by its index.
|
| |
| void | clearObstacles () |
| | Clear all tracked obstacles.
|
| |
| const std::vector< Obstacle > & | getObstacles () const |
| | Get the list of currently tracked obstacles.
|
| |
| bool | checkIntersection (const Eigen::Vector2f &start, const Eigen::Vector2f &end, float safety_margin, Obstacle &out_obstacle, Eigen::Vector2f &out_closest) const |
| | Check if a path segment intersects with any obstacle.
|
| |
| Eigen::Vector2f | getAvoidanceTarget (const Eigen::Vector2f &robot_pos, const Eigen::Vector2f &target_pos, float safety_margin, float clearance, float robot_heading_rad, int recursion_depth=0) const |
| | Calculate a target vector that avoids collisions while navigating towards a goal.
|
| |
| Eigen::Vector2f | getPotentialFieldTarget (const Eigen::Vector2f &robot_pos, const Eigen::Vector2f &target_pos, float robot_heading_rad) const |
| | Get an artificial potential field target vector using the manager's configured parameters (pf_ka, pf_kr, pf_influence_radius).
|
| |
| void | setAvoidanceMode (AvoidanceMode mode) |
| | Set the avoidance mode.
|
| |
| AvoidanceMode | getAvoidanceMode () |
| |
| void | setAvoidanceParams (float safetyMargin, float clearance) |
| | Set safety margin and clearance used by avoidance routines.
|
| |
| void | setPotentialFieldParams (float ka, float kr, float influenceRadius) |
| | Set potential field parameters.
|
| |
Manages a collection of obstacles and provides avoidance computations.
Provides methods for checking path intersections and generating vectors to steer away from potential collisions.
Definition at line 23 of file obstacle_manager.hpp.
◆ AvoidanceMode
◆ ObstacleManager()
| hololib::ObstacleManager::ObstacleManager |
( |
| ) |
|
|
default |
◆ setRobotDimensions()
| void hololib::ObstacleManager::setRobotDimensions |
( |
float |
width, |
|
|
float |
length |
|
) |
| |
Set the dimensions of the robot to define its bounding box for collisions.
- Parameters
-
| width | Width of the robot. |
| length | Length of the robot. |
◆ addObstacle()
| void hololib::ObstacleManager::addObstacle |
( |
float |
x, |
|
|
float |
y, |
|
|
float |
radius |
|
) |
| |
Add a circular obstacle to the field representation.
- Parameters
-
| x | X coordinate of the obstacle. |
| y | Y coordinate of the obstacle. |
| radius | Radius of the obstacle. |
◆ removeObstacle()
| void hololib::ObstacleManager::removeObstacle |
( |
size_t |
index | ) |
|
Remove an obstacle by its index.
- Parameters
-
| index | The index of the obstacle in the internal vector. |
◆ clearObstacles()
| void hololib::ObstacleManager::clearObstacles |
( |
| ) |
|
Clear all tracked obstacles.
◆ getObstacles()
| const std::vector< Obstacle > & hololib::ObstacleManager::getObstacles |
( |
| ) |
const |
Get the list of currently tracked obstacles.
- Returns
- const std::vector<Obstacle>& Reference to the obstacle vector.
◆ checkIntersection()
| bool hololib::ObstacleManager::checkIntersection |
( |
const Eigen::Vector2f & |
start, |
|
|
const Eigen::Vector2f & |
end, |
|
|
float |
safety_margin, |
|
|
Obstacle & |
out_obstacle, |
|
|
Eigen::Vector2f & |
out_closest |
|
) |
| const |
Check if a path segment intersects with any obstacle.
- Parameters
-
| start | Start point of the segment. |
| end | End point of the segment. |
| safety_margin | Extra margin to add to the robot/obstacle bounds. |
| out_obstacle | Output parameter for the intersected obstacle. |
| out_closest | Output parameter for the closest point of intersection. |
- Returns
- true if an intersection occurs, false otherwise.
◆ getAvoidanceTarget()
| Eigen::Vector2f hololib::ObstacleManager::getAvoidanceTarget |
( |
const Eigen::Vector2f & |
robot_pos, |
|
|
const Eigen::Vector2f & |
target_pos, |
|
|
float |
safety_margin, |
|
|
float |
clearance, |
|
|
float |
robot_heading_rad, |
|
|
int |
recursion_depth = 0 |
|
) |
| const |
Calculate a target vector that avoids collisions while navigating towards a goal.
- Parameters
-
| robot_pos | Current robot position. |
| target_pos | Desired goal position. |
| safety_margin | Extra margin around obstacles. |
| clearance | Desired clearance distance from obstacles. |
| robot_heading_rad | Current robot heading in radians. |
| recursion_depth | Internal use for recursive path-finding limitations. |
- Returns
- Eigen::Vector2f The corrected target point to aim for.
◆ getPotentialFieldTarget()
| Eigen::Vector2f hololib::ObstacleManager::getPotentialFieldTarget |
( |
const Eigen::Vector2f & |
robot_pos, |
|
|
const Eigen::Vector2f & |
target_pos, |
|
|
float |
robot_heading_rad |
|
) |
| const |
Get an artificial potential field target vector using the manager's configured parameters (pf_ka, pf_kr, pf_influence_radius).
- Parameters
-
| robot_pos | Current robot position. |
| target_pos | Desired goal position. |
| robot_heading_rad | Current robot heading in radians. |
- Returns
- Eigen::Vector2f The resultant vector from potential fields.
◆ setAvoidanceMode()
| void hololib::ObstacleManager::setAvoidanceMode |
( |
AvoidanceMode |
mode | ) |
|
◆ getAvoidanceMode()
◆ setAvoidanceParams()
| void hololib::ObstacleManager::setAvoidanceParams |
( |
float |
safetyMargin, |
|
|
float |
clearance |
|
) |
| |
Set safety margin and clearance used by avoidance routines.
◆ setPotentialFieldParams()
| void hololib::ObstacleManager::setPotentialFieldParams |
( |
float |
ka, |
|
|
float |
kr, |
|
|
float |
influenceRadius |
|
) |
| |
Set potential field parameters.