79 bool checkIntersection(
const Eigen::Vector2f& start,
const Eigen::Vector2f& end,
float safety_margin,
80 Obstacle& out_obstacle, Eigen::Vector2f& out_closest)
const;
94 Eigen::Vector2f
getAvoidanceTarget(
const Eigen::Vector2f& robot_pos,
const Eigen::Vector2f& target_pos,
95 float safety_margin,
float clearance,
float robot_heading_rad,
96 int recursion_depth = 0)
const;
108 float robot_heading_rad)
const;
128 std::vector<Obstacle> obstacles;
129 float robot_width = 18.0f;
130 float robot_length = 18.0f;
132 float avoidanceSafetyMargin = 4.0f;
133 float avoidanceClearance = 8.0f;
136 float pf_influence_radius = 15.0f;
Manages a collection of obstacles and provides avoidance computations.
void setRobotDimensions(float width, float length)
Set the dimensions of the robot to define its bounding box for collisions.
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,...
const std::vector< Obstacle > & getObstacles() const
Get the list of currently tracked obstacles.
void setAvoidanceMode(AvoidanceMode mode)
Set the avoidance mode.
void clearObstacles()
Clear all tracked obstacles.
void setPotentialFieldParams(float ka, float kr, float influenceRadius)
Set potential field parameters.
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.
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.
void setAvoidanceParams(float safetyMargin, float clearance)
Set safety margin and clearance used by avoidance routines.
void addObstacle(float x, float y, float radius)
Add a circular obstacle to the field representation.
ObstacleManager()=default
Default constructor for ObstacleManager.
AvoidanceMode getAvoidanceMode()
void removeObstacle(size_t index)
Remove an obstacle by its index.
Represents a physical obstacle on the field.
Eigen::Vector2f position
2D coordinate position of the obstacle
float radius
Radius of the obstacle used for avoidance.