Baidu Apollo代码解析之碰撞检测

在Lattice Planner中,需要对1D横纵向轨迹结合(combine)后形成的2D轨迹做限制检测(速度、加速度等)和碰撞检测。碰撞检测由CollisionChecker类完成,文件路径:apollo\modules\planning\constraint_checker\collision_checker.cc。碰撞检测主要是遍历每个障碍物的预测轨迹的每个轨迹点、遍历自车规划轨迹的每个轨迹点,分别构造轮廓box(近似bounding box),查看box是否重叠(overlap)。原理比较简单,粗暴贴代码。

/**
     * @brief Constructor
     * @param obstacles obstacles information from Prediction module
     * @param ego_vehicle_s s position of ego vehicle in Frenet Coordinate System(s-l, s-d)
     * @param ego_vehicle_d d position of ego vehicle in Frenet
     * @param discretized_reference_line the sampling points on reference line, the reference line in discretized form
     * @param ptr_reference_line_info
     * @param ptr_path_time_graph s-t graph
     */
CollisionChecker::CollisionChecker(
    const std::vector<const Obstacle*>& obstacles, const double ego_vehicle_s,
    const double ego_vehicle_d,
    const std::vector<PathPoint>& discretized_reference_line,
    const ReferenceLineInfo* ptr_reference_line_info,
    const std::shared_ptr<PathTimeGraph>& ptr_path_time_graph) {
  ptr_reference_line_info_ = ptr_reference_line_info;
  ptr_path_time_graph_ = ptr_path_time_graph;
  BuildPredictedEnvironment(obstacles, ego_vehicle_s, ego_vehicle_d,
                            discretized_reference_line);
}

    /**
     * @brief Check if there are overlaps between obstacles' predicted trajectories and ego vehicle's planning trajectory
     * @param obstacles
     * @param ego_trajectory
     * @param ego_length the length of ego vehicle
     * @param ego_width
     * @param ego_back_edge_to_center not sure. I guess it's the gap between
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值