15 #include "nav2_mppi_controller/critics/prefer_forward_critic.hpp"
17 namespace mppi::critics
23 getParam(power_,
"cost_power", 1);
24 getParam(weight_,
"cost_weight", 5.0f);
26 threshold_to_consider_,
27 "threshold_to_consider", 0.5f);
30 logger_,
"PreferForwardCritic instantiated with %d power and %f weight.", power_, weight_);
35 using xt::evaluation_strategy::immediate;
36 if (!enabled_ || utils::withinPositionGoalTolerance(
37 threshold_to_consider_, data.state.pose.pose, data.goal))
43 data.costs += xt::pow(
46 xt::maximum(-data.state.vx, 0)) * data.model_dt, {1}, immediate) * weight_, power_);
48 data.costs += xt::sum(
49 std::move(xt::maximum(-data.state.vx, 0)) * data.model_dt, {1}, immediate) * weight_;
55 #include <pluginlib/class_list_macros.hpp>
57 PLUGINLIB_EXPORT_CLASS(
auto getParamGetter(const std::string &ns)
Get an object to retreive parameters.
Abstract critic objective function to score trajectories.
void score(CriticData &data) override
Evaluate cost related to robot orientation at goal pose (considered only if robot near last goal in c...
void initialize() override
Initialize critic.
Data to pass to critics for scoring, including state, trajectories, pruned path, global goal,...