diff --git a/modules/planning/common/reference_line_info.cc b/modules/planning/common/reference_line_info.cc index fc75eb214ff3738a7dbc253f3778007125c18a0c..d4570202fa45ff5d116e591c3abece94ed767319 100644 --- a/modules/planning/common/reference_line_info.cc +++ b/modules/planning/common/reference_line_info.cc @@ -127,6 +127,14 @@ ADCTrajectory::RightOfWayStatus ReferenceLineInfo::GetRightOfWayStatus() const { const hdmap::RouteSegments& ReferenceLineInfo::Lanes() const { return lanes_; } +const std::list ReferenceLineInfo::TargetLaneId() const { + std::list lane_ids; + for (const auto& lane_seg : lanes_) { + lane_ids.push_back(lane_seg.lane->id()); + } + return lane_ids; +} + const SLBoundary& ReferenceLineInfo::AdcSlBoundary() const { return adc_sl_boundary_; } diff --git a/modules/planning/common/reference_line_info.h b/modules/planning/common/reference_line_info.h index 51b2673c721f80acba6e88ed97e904bd10497576..75565fc894e4ecace619241bdfecf1fcd3b86574 100644 --- a/modules/planning/common/reference_line_info.h +++ b/modules/planning/common/reference_line_info.h @@ -108,6 +108,7 @@ class ReferenceLineInfo { bool IsDrivable() const; const hdmap::RouteSegments& Lanes() const; + const std::list TargetLaneId() const; void ExportDecision(DecisionResult* decision_result) const; diff --git a/modules/planning/planning.cc b/modules/planning/planning.cc index 51b2abbd90a7bc1a1ff603af702395ff389bd2fb..e00e145ef15118816f0e194171421c5d6131986a 100644 --- a/modules/planning/planning.cc +++ b/modules/planning/planning.cc @@ -388,6 +388,9 @@ Status Planning::Plan(const double current_time_stamp, // set right of way status trajectory_pb->set_right_of_way_status( best_reference_line->GetRightOfWayStatus()); + for (const auto& id : best_reference_line->TargetLaneId()) { + trajectory_pb->add_lane_id()->CopyFrom(id); + } best_reference_line->ExportDecision(trajectory_pb->mutable_decision()); diff --git a/modules/planning/proto/planning.proto b/modules/planning/proto/planning.proto index 7ae982abad59617713e2e5b984f5aa5b36f7662d..1e612729351444d2263cbe04c10b0c7bebb919dc 100644 --- a/modules/planning/proto/planning.proto +++ b/modules/planning/proto/planning.proto @@ -6,6 +6,7 @@ import "modules/common/proto/header.proto"; import "modules/common/proto/vehicle_signal.proto"; import "modules/common/proto/pnc_point.proto"; import "modules/canbus/proto/chassis.proto"; +import "modules/map/proto/map_id.proto"; import "modules/planning/proto/decision.proto"; import "modules/planning/proto/planning_internal.proto"; @@ -70,7 +71,7 @@ message LatencyStats { optional double init_frame_time_ms = 3; } -// next id: 18 +// next id: 19 message ADCTrajectory { optional apollo.common.Header header = 1; @@ -109,4 +110,7 @@ message ADCTrajectory { PROTECTED = 1; } optional RightOfWayStatus right_of_way_status = 17; + + // lane id along reference line + repeated apollo.hdmap.Id lane_id = 18; } diff --git a/modules/planning/testdata/garage_test/result_follow_0.pb.txt b/modules/planning/testdata/garage_test/result_follow_0.pb.txt index 4b55b6c12d77360f75209daa45e75d907396a750..d4aba42893b21be7b3d9b0d4d0d4d3544661433d 100644 --- a/modules/planning/testdata/garage_test/result_follow_0.pb.txt +++ b/modules/planning/testdata/garage_test/result_follow_0.pb.txt @@ -1741,3 +1741,6 @@ routing_header { sequence_num: 1 } right_of_way_status: UNPROTECTED +lane_id { + id: "1_-1" +} diff --git a/modules/planning/testdata/garage_test/result_out_of_map_0.pb.txt b/modules/planning/testdata/garage_test/result_out_of_map_0.pb.txt index 8a0f8db3285abf6821c04e0c2f90c3adf0b774dc..22d86e24aaa13f74ef75ab18816f23521f1ca28e 100644 --- a/modules/planning/testdata/garage_test/result_out_of_map_0.pb.txt +++ b/modules/planning/testdata/garage_test/result_out_of_map_0.pb.txt @@ -1740,3 +1740,6 @@ routing_header { sequence_num: 1 } right_of_way_status: UNPROTECTED +lane_id { + id: "1_-1" +} diff --git a/modules/planning/testdata/garage_test/result_stop_dest_0.pb.txt b/modules/planning/testdata/garage_test/result_stop_dest_0.pb.txt index 8a0f8db3285abf6821c04e0c2f90c3adf0b774dc..22d86e24aaa13f74ef75ab18816f23521f1ca28e 100644 --- a/modules/planning/testdata/garage_test/result_stop_dest_0.pb.txt +++ b/modules/planning/testdata/garage_test/result_stop_dest_0.pb.txt @@ -1740,3 +1740,6 @@ routing_header { sequence_num: 1 } right_of_way_status: UNPROTECTED +lane_id { + id: "1_-1" +} diff --git a/modules/planning/testdata/garage_test/result_stop_obstacle_0.pb.txt b/modules/planning/testdata/garage_test/result_stop_obstacle_0.pb.txt index 1a870db9033036deedad81783c0296af87d80fa7..dc4f5e3740f46b0509de2e028975b9c53075a72c 100644 --- a/modules/planning/testdata/garage_test/result_stop_obstacle_0.pb.txt +++ b/modules/planning/testdata/garage_test/result_stop_obstacle_0.pb.txt @@ -1755,3 +1755,6 @@ routing_header { sequence_num: 1 } right_of_way_status: UNPROTECTED +lane_id { + id: "1_-1" +} diff --git a/modules/planning/testdata/garage_test/result_stop_over_line_0.pb.txt b/modules/planning/testdata/garage_test/result_stop_over_line_0.pb.txt index 5e7c551afd356aa015414ba118b885a98151b1a0..f84d5af407d8b0e1534802cea09b7c80ebcc5252 100644 --- a/modules/planning/testdata/garage_test/result_stop_over_line_0.pb.txt +++ b/modules/planning/testdata/garage_test/result_stop_over_line_0.pb.txt @@ -1111,3 +1111,6 @@ routing_header { sequence_num: 1 } right_of_way_status: UNPROTECTED +lane_id { + id: "1_-1" +} diff --git a/modules/planning/testdata/sunnyvale_loop_test/result_avoid_change_left_0.pb.txt b/modules/planning/testdata/sunnyvale_loop_test/result_avoid_change_left_0.pb.txt index 3810e85e875eba723f0f3e9f2f927632ddb5f1a0..3a6e85cdb37e9898dd650c6dc6ae119597a852f6 100644 --- a/modules/planning/testdata/sunnyvale_loop_test/result_avoid_change_left_0.pb.txt +++ b/modules/planning/testdata/sunnyvale_loop_test/result_avoid_change_left_0.pb.txt @@ -1605,3 +1605,6 @@ routing_header { sequence_num: 2 } right_of_way_status: UNPROTECTED +lane_id { + id: "40_1_-2" +} diff --git a/modules/planning/testdata/sunnyvale_loop_test/result_change_lane_0.pb.txt b/modules/planning/testdata/sunnyvale_loop_test/result_change_lane_0.pb.txt index d8bf7f7930254165607482aedf08403ccfe894fd..101b9fb2f17137d49b5750b0c973445e0f3247e7 100644 --- a/modules/planning/testdata/sunnyvale_loop_test/result_change_lane_0.pb.txt +++ b/modules/planning/testdata/sunnyvale_loop_test/result_change_lane_0.pb.txt @@ -1717,3 +1717,6 @@ routing_header { sequence_num: 8 } right_of_way_status: UNPROTECTED +lane_id { + id: "57_1_-1" +} diff --git a/modules/planning/testdata/sunnyvale_loop_test/result_cruise_0.pb.txt b/modules/planning/testdata/sunnyvale_loop_test/result_cruise_0.pb.txt index 51314443e167a38ac65f8d1f7b501f14603f4d5f..c52f440fac2480225982236c0106be36ce165036 100644 --- a/modules/planning/testdata/sunnyvale_loop_test/result_cruise_0.pb.txt +++ b/modules/planning/testdata/sunnyvale_loop_test/result_cruise_0.pb.txt @@ -1284,3 +1284,12 @@ routing_header { sequence_num: 1 } right_of_way_status: UNPROTECTED +lane_id { + id: "752_1_-1" +} +lane_id { + id: "753_1_-1" +} +lane_id { + id: "6_1_-2" +} diff --git a/modules/planning/testdata/sunnyvale_loop_test/result_follow_01_0.pb.txt b/modules/planning/testdata/sunnyvale_loop_test/result_follow_01_0.pb.txt index 8ff6583bb99c184042aede09603ce3f14b5cc25c..b90efc34ac18ce36e9be32924b5fdf6292b52d4f 100644 --- a/modules/planning/testdata/sunnyvale_loop_test/result_follow_01_0.pb.txt +++ b/modules/planning/testdata/sunnyvale_loop_test/result_follow_01_0.pb.txt @@ -1732,3 +1732,18 @@ routing_header { module_name: "routing" } right_of_way_status: UNPROTECTED +lane_id { + id: "140_1_-1" +} +lane_id { + id: "747_1_-1" +} +lane_id { + id: "141_1_-2" +} +lane_id { + id: "906_1_-1" +} +lane_id { + id: "9_1_-2" +} diff --git a/modules/planning/testdata/sunnyvale_loop_test/result_follow_02_0.pb.txt b/modules/planning/testdata/sunnyvale_loop_test/result_follow_02_0.pb.txt index 1a8395b8f2bf3a3c6ad7ac1e886ea71090e2b1d5..bd4470e25304ff348483011309768c869916d48d 100644 --- a/modules/planning/testdata/sunnyvale_loop_test/result_follow_02_0.pb.txt +++ b/modules/planning/testdata/sunnyvale_loop_test/result_follow_02_0.pb.txt @@ -1283,3 +1283,15 @@ routing_header { module_name: "routing" } right_of_way_status: UNPROTECTED +lane_id { + id: "37_1_-4" +} +lane_id { + id: "38_1_-4" +} +lane_id { + id: "84_1_-1" +} +lane_id { + id: "58_1_-2" +} diff --git a/modules/planning/testdata/sunnyvale_loop_test/result_follow_03_0.pb.txt b/modules/planning/testdata/sunnyvale_loop_test/result_follow_03_0.pb.txt index 261d76e248ac993e4cee3626b97803f609d2c60c..c2dd42e8b2fd9fa92b8180746fda00b2a8fbb024 100644 --- a/modules/planning/testdata/sunnyvale_loop_test/result_follow_03_0.pb.txt +++ b/modules/planning/testdata/sunnyvale_loop_test/result_follow_03_0.pb.txt @@ -1754,3 +1754,15 @@ routing_header { module_name: "routing" } right_of_way_status: UNPROTECTED +lane_id { + id: "747_1_-1" +} +lane_id { + id: "141_1_-2" +} +lane_id { + id: "906_1_-1" +} +lane_id { + id: "9_1_-2" +} diff --git a/modules/planning/testdata/sunnyvale_loop_test/result_mission_complete_0.pb.txt b/modules/planning/testdata/sunnyvale_loop_test/result_mission_complete_0.pb.txt index 39f575da4d6f08201bc1412151e3555f8328c7c0..6e03207fa49418e1edc9c296d578ba1cc2ea2597 100644 --- a/modules/planning/testdata/sunnyvale_loop_test/result_mission_complete_0.pb.txt +++ b/modules/planning/testdata/sunnyvale_loop_test/result_mission_complete_0.pb.txt @@ -1741,3 +1741,6 @@ routing_header { sequence_num: 3 } right_of_way_status: UNPROTECTED +lane_id { + id: "57_1_-1" +} diff --git a/modules/planning/testdata/sunnyvale_loop_test/result_nudge_0.pb.txt b/modules/planning/testdata/sunnyvale_loop_test/result_nudge_0.pb.txt index 7114283269d5c3c2de46aba5200ddbaa61baf10b..2c5eaab0afb37b2c1fcb63c8ae0ed1303a08295f 100644 --- a/modules/planning/testdata/sunnyvale_loop_test/result_nudge_0.pb.txt +++ b/modules/planning/testdata/sunnyvale_loop_test/result_nudge_0.pb.txt @@ -1587,3 +1587,12 @@ routing_header { module_name: "routing" } right_of_way_status: UNPROTECTED +lane_id { + id: "138_1_-1" +} +lane_id { + id: "144_1_-1" +} +lane_id { + id: "140_1_-1" +} diff --git a/modules/planning/testdata/sunnyvale_loop_test/result_qp_path_failure_0.pb.txt b/modules/planning/testdata/sunnyvale_loop_test/result_qp_path_failure_0.pb.txt index 34696126f553f0ceea66d20f96712eefca692ce5..9a8e626cdf6b3cbfa6be782ad65b2874c9af9a58 100644 --- a/modules/planning/testdata/sunnyvale_loop_test/result_qp_path_failure_0.pb.txt +++ b/modules/planning/testdata/sunnyvale_loop_test/result_qp_path_failure_0.pb.txt @@ -1480,3 +1480,18 @@ routing_header { sequence_num: 2 } right_of_way_status: UNPROTECTED +lane_id { + id: "12_1_-3" +} +lane_id { + id: "133_1_-3" +} +lane_id { + id: "88_1_-1" +} +lane_id { + id: "21_1_-1" +} +lane_id { + id: "22_1_-1" +} diff --git a/modules/planning/testdata/sunnyvale_loop_test/result_rightturn_01_0.pb.txt b/modules/planning/testdata/sunnyvale_loop_test/result_rightturn_01_0.pb.txt index 669ee58d6226b76c0502ee9a7e02577c44d77fa6..7068602dc862c9f97165688b48fbe8cc613a314c 100644 --- a/modules/planning/testdata/sunnyvale_loop_test/result_rightturn_01_0.pb.txt +++ b/modules/planning/testdata/sunnyvale_loop_test/result_rightturn_01_0.pb.txt @@ -1732,3 +1732,18 @@ routing_header { module_name: "routing" } right_of_way_status: UNPROTECTED +lane_id { + id: "39_1_-3" +} +lane_id { + id: "37_1_-4" +} +lane_id { + id: "38_1_-4" +} +lane_id { + id: "84_1_-1" +} +lane_id { + id: "58_1_-2" +} diff --git a/modules/planning/testdata/sunnyvale_loop_test/result_rightturn_with_red_light_0.pb.txt b/modules/planning/testdata/sunnyvale_loop_test/result_rightturn_with_red_light_0.pb.txt index 6a9461e0481ac316aa8eb2066297bbeba3ed34a1..733513627c99bd27058a82d82d5150601b96064f 100644 --- a/modules/planning/testdata/sunnyvale_loop_test/result_rightturn_with_red_light_0.pb.txt +++ b/modules/planning/testdata/sunnyvale_loop_test/result_rightturn_with_red_light_0.pb.txt @@ -1732,3 +1732,18 @@ routing_header { module_name: "routing" } right_of_way_status: UNPROTECTED +lane_id { + id: "39_1_-3" +} +lane_id { + id: "37_1_-4" +} +lane_id { + id: "38_1_-4" +} +lane_id { + id: "84_1_-1" +} +lane_id { + id: "58_1_-2" +} diff --git a/modules/planning/testdata/sunnyvale_loop_test/result_slowdown_01_0.pb.txt b/modules/planning/testdata/sunnyvale_loop_test/result_slowdown_01_0.pb.txt index bd9e8435d578dedd2a097840859609ef44c0a35c..114215c1936d4da69fafaadeb68c4d8a64ed901c 100644 --- a/modules/planning/testdata/sunnyvale_loop_test/result_slowdown_01_0.pb.txt +++ b/modules/planning/testdata/sunnyvale_loop_test/result_slowdown_01_0.pb.txt @@ -1754,3 +1754,12 @@ routing_header { module_name: "routing" } right_of_way_status: UNPROTECTED +lane_id { + id: "141_1_-2" +} +lane_id { + id: "906_1_-1" +} +lane_id { + id: "9_1_-2" +} diff --git a/modules/planning/testdata/sunnyvale_loop_test/result_stop_0.pb.txt b/modules/planning/testdata/sunnyvale_loop_test/result_stop_0.pb.txt index 9a7f55d988b8522848828423a95c959644dcd398..a956f261049b10011ff24918d20f468a6d6f0f17 100644 --- a/modules/planning/testdata/sunnyvale_loop_test/result_stop_0.pb.txt +++ b/modules/planning/testdata/sunnyvale_loop_test/result_stop_0.pb.txt @@ -1813,3 +1813,15 @@ routing_header { module_name: "routing" } right_of_way_status: UNPROTECTED +lane_id { + id: "28_1_-1" +} +lane_id { + id: "27_1_-1" +} +lane_id { + id: "81_1_-1" +} +lane_id { + id: "160_1_-3" +} diff --git a/modules/prediction/predictor/move_sequence/move_sequence_predictor.cc b/modules/prediction/predictor/move_sequence/move_sequence_predictor.cc index 19009e2fca68b97942b5550cf930e7efd927a2d7..4c9a4526fe0c5150433fcc1d4a8397b0a8aeff03 100644 --- a/modules/prediction/predictor/move_sequence/move_sequence_predictor.cc +++ b/modules/prediction/predictor/move_sequence/move_sequence_predictor.cc @@ -134,7 +134,8 @@ void MoveSequencePredictor::Predict(Obstacle* obstacle) { << "] will draw a lane sequence trajectory [" << ToString(sequence) << "] with probability [" << sequence.probability() << "]."; - std::string curr_lane_id = sequence.lane_segment(0).lane_id(); + // TODO(Prediction): remove the following line + // std::string curr_lane_id = sequence.lane_segment(0).lane_id(); std::vector points; DrawMoveSequenceTrajectoryPoints(*obstacle, sequence, FLAGS_prediction_duration,