Go to the documentation of this file.
39 #ifndef HOMOTOPY_CLASS_PLANNER_H_
40 #define HOMOTOPY_CLASS_PLANNER_H_
49 #include <boost/shared_ptr.hpp>
51 #include <visualization_msgs/Marker.h>
52 #include <geometry_msgs/Point.h>
53 #include <std_msgs/ColorRGBA.h>
74 return std::complex<long double>(pose->x(), pose->y());
81 return std::complex<long double>(pose.pose.position.x, pose.pose.position.y);
160 virtual bool plan(
const std::vector<geometry_msgs::PoseStamped>& initial_plan,
const geometry_msgs::Twist* start_vel = NULL,
bool free_goal_vel=
false);
197 virtual bool getVelocityCommand(
double& vx,
double& vy,
double& omega,
int look_ahead_poses)
const;
223 double inscribed_radius = 0.0,
double circumscribed_radius=0.0,
int look_ahead_idx=-1,
double feasibility_check_lookahead_distance=-1.0);
299 template<
typename B
idirIter,
typename Fun>
387 template<
typename B
idirIter,
typename Fun>
389 boost::optional<TimeDiffSequence::iterator> timediff_start = boost::none, boost::optional<TimeDiffSequence::iterator> timediff_end = boost::none);
407 virtual void computeCurrentCost(std::vector<double>& cost,
double obst_cost_scale=1.0,
double viapoint_cost_scale=1.0,
bool alternative_time_cost=
false);
415 inline static bool isHSignatureSimilar(
const std::complex<long double>& h1,
const std::complex<long double>& h2,
double threshold)
417 double diff_real = std::abs(h2.real() - h1.real());
418 double diff_imag = std::abs(h2.imag() - h1.imag());
419 if (diff_real<=threshold && diff_imag<=threshold)
553 const std::vector<geometry_msgs::PoseStamped>*
initial_plan_;
566 std::default_random_engine
random_;
574 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
const ObstContainer * obstacles() const
Access current obstacle container (read-only)
bool addEquivalenceClassIfNew(const EquivalenceClassPtr &eq_class, bool lock=false)
Internal helper function that adds a new equivalence class to the list of known classes only if it is...
const TebConfig * config() const
Access config (read-only)
virtual bool getVelocityCommand(double &vx, double &vy, double &omega, int look_ahead_poses) const
Get the velocity command from a previously optimized plan to control the robot at the current samplin...
bool isInBestTebClass(const EquivalenceClassPtr &eq_class) const
TebOptimalPlannerPtr bestTeb() const
Access current best trajectory candidate (that relates to the "best" homotopy class).
ViaPointContainer via_points
virtual void visualize()
Publish the local plan, pose sequence and additional information via ros topics (e....
virtual bool isTrajectoryFeasible(base_local_planner::CostmapModel *costmap_model, const std::vector< geometry_msgs::Point > &footprint_spec, double inscribed_radius=0.0, double circumscribed_radius=0.0, int look_ahead_idx=-1, double feasibility_check_lookahead_distance=-1.0)
Check whether the planned trajectory is feasible or not.
virtual void computeCurrentCost(std::vector< double > &cost, double obst_cost_scale=1.0, double viapoint_cost_scale=1.0, bool alternative_time_cost=false)
const ViaPointContainer * via_points_
Store the current list of via-points.
const std::vector< geometry_msgs::PoseStamped > * initial_plan_
Store the initial plan if available for a better trajectory initialization.
std::vector< std::pair< EquivalenceClassPtr, bool > > EquivalenceClassContainer
ros::Time last_eq_class_switching_time_
Store the time at which the equivalence class changed recently.
ObstContainer * obstacles_
Store obstacles that are relevant for planning.
std::complex< long double > getCplxFromMsgPoseStamped(const geometry_msgs::PoseStamped &pose)
Inline function used for calculateHSignature() in combination with geometry_msgs::PoseStamped.
bool hasDiverged() const override
Returns true if the planner has diverged.
int numTebsInBestTebClass() const
const EquivalenceClassContainer & getEquivalenceClassRef() const
Return the current set of equivalence erelations (read-only)
TebOptimalPlannerPtr addAndInitNewTeb(BidirIter path_start, BidirIter path_end, Fun fun_position, double start_orientation, double goal_orientation, const geometry_msgs::Twist *start_velocity, bool free_goal_vel=false)
Add a new Teb to the internal trajectory container, if this teb constitutes a new equivalence class....
EquivalenceClassPtr initial_plan_eq_class_
Store the equivalence class of the initial plan.
void initialize(const TebConfig &cfg, ObstContainer *obstacles=NULL, TebVisualizationPtr visualization=TebVisualizationPtr(), const ViaPointContainer *via_points=NULL)
Initialize the HomotopyClassPlanner.
static bool isHSignatureSimilar(const std::complex< long double > &h1, const std::complex< long double > &h2, double threshold)
Check if two h-signatures are similar (w.r.t. a certain threshold)
RotType
Symbols for left/none/right rotations
TebOptimalPlannerPtr getInitialPlanTEB()
Returns a shared pointer to the TEB related to the initial plan.
TebVisualizationPtr visualization_
Instance of the visualization class (local/global plan, obstacles, ...)
boost::shared_ptr< TebOptimalPlanner > TebOptimalPlannerPtr
Abbrev. for shared instances of the TebOptimalPlanner.
bool computeStartOrientation(const TebOptimalPlannerPtr plan, const double len_orientation_vector, double &orientation)
Given a plan, computes its start orientation using a vector of length >= len_orientation_vector start...
EquivalenceClassPtr calculateEquivalenceClass(BidirIter path_start, BidirIter path_end, Fun fun_cplx_point, const ObstContainer *obstacles=NULL, boost::optional< TimeDiffSequence::iterator > timediff_start=boost::none, boost::optional< TimeDiffSequence::iterator > timediff_end=boost::none)
Calculate the equivalence class of a path.
virtual bool plan(const std::vector< geometry_msgs::PoseStamped > &initial_plan, const geometry_msgs::Twist *start_vel=NULL, bool free_goal_vel=false)
Plan a trajectory based on an initial reference plan.
TebOptimalPlannerPtr last_best_teb_
Points to the plan used in the previous control cycle.
std::default_random_engine random_
std::vector< ObstaclePtr > ObstContainer
Abbrev. for containers storing multiple obstacles.
std::complex< long double > getCplxFromVertexPosePtr(const VertexPose *pose)
< Inline function used for calculateHSignature() in combination with VertexPose pointers
TebOptimalPlannerPtr selectBestTeb()
In case of multiple, internally stored, alternative trajectories, select the best one according to th...
virtual void clearPlanner()
Reset the planner.
bool hasEquivalenceClass(const EquivalenceClassPtr &eq_class) const
Check if a h-signature exists already.
boost::shared_ptr< TebVisualization > TebVisualizationPtr
Abbrev. for shared instances of the TebVisualization.
void deletePlansDetouringBackwards(const double orient_threshold, const double len_orientation_vector)
Checks if the orientation of the computed trajectories differs from that of the best plan of more tha...
boost::shared_ptr< EquivalenceClass > EquivalenceClassPtr
void updateAllTEBs(const PoseSE2 *start, const PoseSE2 *goal, const geometry_msgs::Twist *start_velocity)
Update TEBs with new pose, goal and current velocity.
bool initialized_
Keeps track about the correct initialization of this class.
This abstract class defines an interface for local planners.
EquivalenceClassPtr best_teb_eq_class_
Store the equivalence class of the current best teb.
Config class for the teb_local_planner and its components.
bool isInitialized() const
Returns true if the planner is initialized.
HomotopyClassPlanner()
Default constructor.
Local planner that explores alternative homotopy classes, create a plan for each alternative and fina...
virtual ~HomotopyClassPlanner()
Destruct the HomotopyClassPlanner.
This class implements a pose in the domain SE2: The pose consist of the position x and y and an orie...
void setVisualization(TebVisualizationPtr visualization)
Register a TebVisualization class to enable visiualization routines (e.g. publish the local plan and ...
TebOptPlannerContainer tebs_
Container that stores multiple local teb planners (for alternative equivalence classes) and their cor...
TebOptPlannerContainer::iterator removeTeb(TebOptimalPlannerPtr &teb)
Removes the specified teb and the corresponding homotopy class from the list of available ones.
boost::shared_ptr< GraphSearchInterface > graph_search_
void randomlyDropTebs()
Randomly drop non-optimal TEBs to so we can explore other alternatives.
TebOptimalPlannerPtr best_teb_
Store the current best teb.
const TebOptPlannerContainer & getTrajectoryContainer() const
Read-only access to the internal trajectory container.
virtual void setPreferredTurningDir(RotType dir)
Prefer a desired initial turning direction (by penalizing the opposing one)
void renewAndAnalyzeOldTebs(bool delete_detours)
Renew all found h-signatures for the new planning step based on existing TEBs. Optionally detours can...
void optimizeAllTEBs(int iter_innerloop, int iter_outerloop)
Optimize all available trajectories by invoking the optimizer on each one.
void exploreEquivalenceClassesAndInitTebs(const PoseSE2 &start, const PoseSE2 &goal, double dist_to_obst, const geometry_msgs::Twist *start_vel, bool free_goal_vel=false)
Explore paths in new equivalence classes (e.g. homotopy classes) and initialize TEBs from them.
std::vector< TebOptimalPlannerPtr > TebOptPlannerContainer
Abbrev. for containers storing multiple teb optimal planners.
TebOptimalPlannerPtr initial_plan_teb_
Store pointer to the TEB related to the initial plan (use method getInitialPlanTEB() since it checks ...
const TebConfig * cfg_
Config class that stores and manages all related parameters.
int bestTebIdx() const
find the index of the currently best TEB in the container
EquivalenceClassContainer equivalence_classes_
Store all known quivalence classes (e.g. h-signatures) to allow checking for duplicates after finding...
void clearGraph()
Clear any existing graph of the homotopy class search.
boost::shared_ptr< HomotopyClassPlanner > HomotopyClassPlannerPtr
Abbrev. for a shared pointer of a HomotopyClassPlanner instance.
std::vector< Eigen::Vector2d, Eigen::aligned_allocator< Eigen::Vector2d > > ViaPointContainer
Typedef for a container storing via-points.
void updateReferenceTrajectoryViaPoints(bool all_trajectories)
Associate trajectories with via-points.
int numTebsInClass(const EquivalenceClassPtr &eq_class) const
TebOptimalPlannerPtr findBestTeb()
In case of empty best teb, scores again the available plans to find the best one. The best_teb_ varia...
teb_local_planner
Author(s): Christoph Rösmann
autogenerated on Sun Jan 7 2024 03:45:15