实际中用的是Homotopy planner,这里做一些简单说明
算法初始化
构造函数就一句initialize(cfg, obstacles, robot_model, visual, via_points);
, 代码比较绕:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17void HomotopyClassPlanner::initialize(const TebConfig& cfg, ObstContainer* obstacles,
RobotFootprintModelPtr robot_model, TebVisualizationPtr visual,
const ViaPointContainer* via_points)
{
cfg_ = &cfg;
obstacles_ = obstacles;
via_points_ = via_points;
robot_model_ = robot_model;
if (cfg_->hcp.simple_exploration)
graph_search_ = boost::shared_ptr<GraphSearchInterface>(new lrKeyPointGraph(*cfg_, this));
else
graph_search_ = boost::shared_ptr<GraphSearchInterface>(new ProbRoadmapGraph(*cfg_, this));
initialized_ = true;
setVisualization(visual); // 只有一句,对 visualization_ 赋值
}simple_exploration
默认false,也就是用复杂的ProbRoadmapGraph
类。
plan 函数
1 | // initial_plan 其实就是 transformed_plan |
HomotopyClassPlanner::plan —— exploreEquivalenceClassesAndInitTebs —— createGraph() —— PointObstacle::checkLineIntersection —— PointObstacle::checkCollision
1 | PointObstacle::checkLineIntersection |
optimizeAllTEBs
1 | void HomotopyClassPlanner::optimizeAllTEBs(int iter_innerloop, int iter_outerloop) |
EquivalenceClassContainer equivalence_classes_;
//!< Store all known quivalence classes (e.g. h-signatures) to allow checking for duplicates after finding and adding new ones.
// The second parameter denotes whether to exclude the class from detour deletion or not (true: force keeping).
typedef boost::shared_ptr<TebOptimalPlanner> TebOptimalPlannerPtr;
typedef std::vector< TebOptimalPlannerPtr > TebOptPlannerContainer;
teb()
函数 返回 const TimedElasticBand&