Apollo 10.0
自动驾驶开放平台
apollo::routing::edge_creator 命名空间参考

函数

void GetPbEdge (const Node &node_from, const Node &node_to, const Edge::DirectionType &type, const RoutingConfig &routing_config, Edge *edge)
 

函数说明

◆ GetPbEdge()

void apollo::routing::edge_creator::GetPbEdge ( const Node node_from,
const Node node_to,
const Edge::DirectionType type,
const RoutingConfig routing_config,
Edge edge 
)

在文件 edge_creator.cc25 行定义.

27 {
28 edge->set_from_lane_id(node_from.lane_id());
29 edge->set_to_lane_id(node_to.lane_id());
30 edge->set_direction_type(type);
31
32 edge->set_cost(0.0);
33 if (type == Edge::LEFT || type == Edge::RIGHT) {
34 const auto& target_range =
35 (type == Edge::LEFT) ? node_from.left_out() : node_from.right_out();
36 double changing_area_length = 0.0;
37 for (const auto& range : target_range) {
38 changing_area_length += range.end().s() - range.start().s();
39 }
40 double ratio = 1.0;
41 if (changing_area_length < routing_config.base_changing_length()) {
42 ratio = std::pow(
43 changing_area_length / routing_config.base_changing_length(), -1.5);
44 }
45 edge->set_cost(routing_config.change_penalty() * ratio);
46 }
47}
optional CurvePoint end
repeated CurveRange left_out
optional string lane_id
repeated CurveRange right_out