Nav2 Navigation Stack - jazzy  jazzy
ROS 2 Navigation Stack
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
mppi::critics::ObstaclesCritic Class Reference
Inheritance diagram for mppi::critics::ObstaclesCritic:
Inheritance graph
[legend]
Collaboration diagram for mppi::critics::ObstaclesCritic:
Collaboration graph
[legend]

Public Member Functions

void initialize () override
 Initialize critic.
 
void score (CriticData &data) override
 Evaluate cost related to obstacle avoidance. More...
 
- Public Member Functions inherited from mppi::critics::CriticFunction
 CriticFunction ()=default
 Constructor for mppi::critics::CriticFunction.
 
virtual ~CriticFunction ()=default
 Destructor for mppi::critics::CriticFunction.
 
void on_configure (rclcpp_lifecycle::LifecycleNode::WeakPtr parent, const std::string &parent_name, const std::string &name, std::shared_ptr< nav2_costmap_2d::Costmap2DROS > costmap_ros, ParametersHandler *param_handler)
 Configure critic on bringup. More...
 
std::string getName ()
 Get name of critic.
 

Protected Member Functions

bool inCollision (float cost) const
 Checks if cost represents a collision. More...
 
CollisionCost costAtPose (float x, float y, float theta)
 cost at a robot pose More...
 
float distanceToObstacle (const CollisionCost &cost)
 Distance to obstacle from cost. More...
 
float findCircumscribedCost (std::shared_ptr< nav2_costmap_2d::Costmap2DROS > costmap)
 Find the min cost of the inflation decay function for which the robot MAY be in collision in any orientation. More...
 

Protected Attributes

nav2_costmap_2d::FootprintCollisionChecker< nav2_costmap_2d::Costmap2D * > collision_checker_ {nullptr}
 
bool consider_footprint_ {true}
 
float collision_cost_ {0}
 
float inflation_scale_factor_ {0}
 
float inflation_radius_ {0}
 
float possible_collision_cost_
 
float collision_margin_distance_
 
float near_goal_distance_
 
float circumscribed_cost_ {0}
 
float circumscribed_radius_ {0}
 
unsigned int power_ {0}
 
float repulsion_weight_
 
float critical_weight_ {0}
 
std::string inflation_layer_name_
 
- Protected Attributes inherited from mppi::critics::CriticFunction
bool enabled_
 
std::string name_
 
std::string parent_name_
 
rclcpp_lifecycle::LifecycleNode::WeakPtr parent_
 
std::shared_ptr< nav2_costmap_2d::Costmap2DROScostmap_ros_
 
nav2_costmap_2d::Costmap2Dcostmap_ {nullptr}
 
ParametersHandlerparameters_handler_
 
rclcpp::Logger logger_ {rclcpp::get_logger("MPPIController")}
 

Detailed Description

Definition at line 37 of file obstacles_critic.hpp.

Member Function Documentation

◆ costAtPose()

CollisionCost mppi::critics::ObstaclesCritic::costAtPose ( float  x,
float  y,
float  theta 
)
inlineprotected

cost at a robot pose

Parameters
xX of pose
yY of pose
thetatheta of pose
Returns
Collision information at pose

Definition at line 222 of file obstacles_critic.cpp.

References nav2_costmap_2d::FootprintCollisionChecker< CostmapT >::footprintCostAtPose(), nav2_costmap_2d::FootprintCollisionChecker< CostmapT >::pointCost(), and nav2_costmap_2d::FootprintCollisionChecker< CostmapT >::worldToMap().

Referenced by score().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ distanceToObstacle()

float mppi::critics::ObstaclesCritic::distanceToObstacle ( const CollisionCost cost)
inlineprotected

Distance to obstacle from cost.

Parameters
costCostmap cost
Returns
float Distance to the obstacle represented by cost

Definition at line 104 of file obstacles_critic.cpp.

Referenced by score().

Here is the caller graph for this function:

◆ findCircumscribedCost()

float mppi::critics::ObstaclesCritic::findCircumscribedCost ( std::shared_ptr< nav2_costmap_2d::Costmap2DROS costmap)
protected

Find the min cost of the inflation decay function for which the robot MAY be in collision in any orientation.

Parameters
costmapCostmap2DROS to get minimum inscribed cost (e.g. 128 in inflation layer documentation)
Returns
double circumscribed cost, any higher than this and need to do full footprint collision checking since some element of the robot could be in collision

Definition at line 69 of file obstacles_critic.cpp.

Referenced by initialize(), and score().

Here is the caller graph for this function:

◆ inCollision()

bool mppi::critics::ObstaclesCritic::inCollision ( float  cost) const
inlineprotected

Checks if cost represents a collision.

Parameters
costCostmap cost
Returns
bool if in collision

Definition at line 204 of file obstacles_critic.cpp.

Referenced by score().

Here is the caller graph for this function:

◆ score()

void mppi::critics::ObstaclesCritic::score ( CriticData data)
overridevirtual

Evaluate cost related to obstacle avoidance.

Parameters
costs[out] add obstacle cost values to this tensor

Implements mppi::critics::CriticFunction.

Definition at line 119 of file obstacles_critic.cpp.

References costAtPose(), distanceToObstacle(), findCircumscribedCost(), and inCollision().

Here is the call graph for this function:

The documentation for this class was generated from the following files: