|
HoloLib
High-performance holonomic (X-Drive) control library for VEX V5
|
Manages a collection of obstacles and provides avoidance computations. More...
#include <obstacle.h>
Public Member Functions | |
| 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 ka, float kr, float influence_radius, float robot_heading_rad) const |
| Get an artificial potential field target vector. | |
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 22 of file obstacle.h.
|
default |
Default constructor for ObstacleManager.
| void ObstacleManager::setRobotDimensions | ( | float | width, |
| float | length | ||
| ) |
Set the dimensions of the robot to define its bounding box for collisions.
| width | Width of the robot. |
| length | Length of the robot. |
| void ObstacleManager::addObstacle | ( | float | x, |
| float | y, | ||
| float | radius | ||
| ) |
Add a circular obstacle to the field representation.
| x | X coordinate of the obstacle. |
| y | Y coordinate of the obstacle. |
| radius | Radius of the obstacle. |
| void ObstacleManager::removeObstacle | ( | size_t | index | ) |
Remove an obstacle by its index.
| index | The index of the obstacle in the internal vector. |
| void ObstacleManager::clearObstacles | ( | ) |
Clear all tracked obstacles.
| const std::vector< Obstacle > & ObstacleManager::getObstacles | ( | ) | const |
Get the list of currently tracked obstacles.
| bool 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.
| 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. |
| Eigen::Vector2f 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.
| 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. |
| Eigen::Vector2f ObstacleManager::getPotentialFieldTarget | ( | const Eigen::Vector2f & | robot_pos, |
| const Eigen::Vector2f & | target_pos, | ||
| float | ka, | ||
| float | kr, | ||
| float | influence_radius, | ||
| float | robot_heading_rad | ||
| ) | const |
Get an artificial potential field target vector.
| robot_pos | Current robot position. |
| target_pos | Desired goal position. |
| ka | Attractive force constant. |
| kr | Repulsive force constant. |
| influence_radius | Distance at which obstacles begin exerting repulsive force. |
| robot_heading_rad | Current robot heading in radians. |