Nav2 Navigation Stack - humble  humble
ROS 2 Navigation Stack
Public Member Functions | List of all members
dwb_critics::PreferForwardCritic Class Reference

Penalize trajectories with move backwards and/or turn too much. More...

#include <nav2_dwb_controller/dwb_critics/include/dwb_critics/prefer_forward.hpp>

Inheritance diagram for dwb_critics::PreferForwardCritic:
Inheritance graph
[legend]
Collaboration diagram for dwb_critics::PreferForwardCritic:
Collaboration graph
[legend]

Public Member Functions

void onInit () override
 
double scoreTrajectory (const dwb_msgs::msg::Trajectory2D &traj) override
 Return a raw score for the given trajectory. More...
 
- Public Member Functions inherited from dwb_core::TrajectoryCritic
void initialize (const nav2_util::LifecycleNode::SharedPtr &nh, const std::string &name, const std::string &ns, std::shared_ptr< nav2_costmap_2d::Costmap2DROS > costmap_ros)
 Initialize the critic with appropriate pointers and parameters. More...
 
virtual void reset ()
 Reset the state of the critic. More...
 
virtual bool prepare (const geometry_msgs::msg::Pose2D &, const nav_2d_msgs::msg::Twist2D &, const geometry_msgs::msg::Pose2D &, const nav_2d_msgs::msg::Path2D &)
 Prior to evaluating any trajectories, look at contextual information constant across all trajectories. More...
 
virtual void debrief (const nav_2d_msgs::msg::Twist2D &)
 debrief informs the critic what the chosen cmd_vel was (if it cares)
 
virtual void addCriticVisualization (std::vector< std::pair< std::string, std::vector< float >>> &)
 Add information to the given pointcloud for debugging costmap-grid based scores. More...
 
std::string getName ()
 
virtual double getScale () const
 
void setScale (const double scale)
 

Additional Inherited Members

- Public Types inherited from dwb_core::TrajectoryCritic
using Ptr = std::shared_ptr< dwb_core::TrajectoryCritic >
 
- Protected Attributes inherited from dwb_core::TrajectoryCritic
std::string name_
 
std::string dwb_plugin_name_
 
std::shared_ptr< nav2_costmap_2d::Costmap2DROScostmap_ros_
 
double scale_
 
rclcpp_lifecycle::LifecycleNode::WeakPtr node_
 

Detailed Description

Penalize trajectories with move backwards and/or turn too much.

Has three different scoring conditions: 1) If the trajectory's x velocity is negative, return the penalty 2) If the trajectory's x is low and the theta is also low, return the penalty. 3) Otherwise, return a scaled version of the trajectory's theta.

Definition at line 53 of file prefer_forward.hpp.

Member Function Documentation

◆ scoreTrajectory()

double dwb_critics::PreferForwardCritic::scoreTrajectory ( const dwb_msgs::msg::Trajectory2D &  traj)
overridevirtual

Return a raw score for the given trajectory.

scores < 0 are considered invalid/errors, such as collisions This is the raw score in that the scale should not be applied to it.

Implements dwb_core::TrajectoryCritic.

Definition at line 73 of file prefer_forward.cpp.


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