15 #ifndef NAV2_MPPI_CONTROLLER__CRITIC_FUNCTION_HPP_
16 #define NAV2_MPPI_CONTROLLER__CRITIC_FUNCTION_HPP_
21 #include "rclcpp_lifecycle/lifecycle_node.hpp"
22 #include "nav2_costmap_2d/costmap_2d_ros.hpp"
24 #include "nav2_mppi_controller/tools/parameters_handler.hpp"
25 #include "nav2_mppi_controller/critic_data.hpp"
27 namespace mppi::critics
37 bool using_footprint{
false};
66 nav2::LifecycleNode::WeakPtr parent,
67 const std::string & parent_name,
68 const std::string & name,
69 std::shared_ptr<nav2_costmap_2d::Costmap2DROS> costmap_ros,
73 logger_ = parent_.lock()->get_logger();
75 parent_name_ = parent_name;
76 costmap_ros_ = costmap_ros;
77 costmap_ = costmap_ros_->getCostmap();
78 parameters_handler_ = param_handler;
81 getParam(enabled_,
"enabled",
true);
107 std::string name_, parent_name_;
108 nav2::LifecycleNode::WeakPtr parent_;
109 std::shared_ptr<nav2_costmap_2d::Costmap2DROS> costmap_ros_;
113 rclcpp::Logger logger_{rclcpp::get_logger(
"MPPIController")};
Handles getting parameters and dynamic parameter changes.
auto getParamGetter(const std::string &ns)
Get an object to retrieve parameters.
Abstract critic objective function to score trajectories.
std::string getName()
Get name of critic.
void on_configure(nav2::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.
virtual void score(CriticData &data)=0
Main function to score trajectory.
CriticFunction()=default
Constructor for mppi::critics::CriticFunction.
virtual ~CriticFunction()=default
Destructor for mppi::critics::CriticFunction.
virtual void initialize()=0
Initialize critic.
A 2D costmap provides a mapping between points in the world and their associated "costs".
Data to pass to critics for scoring, including state, trajectories, pruned path, global goal,...
Utility for storing cost information.