Skip to content

Commit 29b20f6

Browse files
authored
Merge branch 'main' into autoware_behavior_velocity_planner_common
2 parents c9bf077 + 63643f4 commit 29b20f6

File tree

72 files changed

+43825
-9
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+43825
-9
lines changed

.github/CODEOWNERS

+3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ common/autoware_component_interface_specs/** isamu.takagi@tier4.jp ryohsuke.mits
33
common/autoware_geography_utils/** anh.nguyen.2@tier4.jp masahiro.sakamoto@tier4.jp ryu.yamamoto@tier4.jp shintaro.sakoda@tier4.jp taiki.yamada@tier4.jp yamato.ando@tier4.jp @autowarefoundation/autoware-core-global-codeowners
44
common/autoware_interpolation/** fumiya.watanabe@tier4.jp takayuki.murooka@tier4.jp @autowarefoundation/autoware-core-global-codeowners
55
common/autoware_kalman_filter/** koji.minoda@tier4.jp takeshi.ishita@tier4.jp yukihiro.saito@tier4.jp @autowarefoundation/autoware-core-global-codeowners
6+
common/autoware_lanelet2_utils/** kosuke.takeuchi@tier4.jp mamoru.sobue@tier4.jp @autowarefoundation/autoware-core-global-codeowners
67
common/autoware_motion_utils/** fumiya.watanabe@tier4.jp kosuke.takeuchi@tier4.jp mamoru.sobue@tier4.jp satoshi.ota@tier4.jp taiki.tanaka@tier4.jp takamasa.horibe@tier4.jp takayuki.murooka@tier4.jp tomoya.kimura@tier4.jp @autowarefoundation/autoware-core-global-codeowners
78
common/autoware_node/** mfc@autoware.org @autowarefoundation/autoware-core-global-codeowners
9+
common/autoware_object_recognition_utils/** takayuki.murooka@tier4.jp yoshi.ri@tier4.jp @autowarefoundation/autoware-core-global-codeowners
810
common/autoware_osqp_interface/** fumiya.watanabe@tier4.jp maxime.clement@tier4.jp satoshi.ota@tier4.jp takayuki.murooka@tier4.jp @autowarefoundation/autoware-core-global-codeowners
911
common/autoware_point_types/** cynthia.liu@autocore.ai david.wong@tier4.jp max.schmeller@tier4.jp @autowarefoundation/autoware-core-global-codeowners
1012
common/autoware_qp_interface/** fumiya.watanabe@tier4.jp maxime.clement@tier4.jp satoshi.ota@tier4.jp takayuki.murooka@tier4.jp @autowarefoundation/autoware-core-global-codeowners
@@ -15,6 +17,7 @@ localization/autoware_ekf_localizer/** anh.nguyen.2@tier4.jp kento.yabuuchi.2@ti
1517
localization/autoware_localization_util/** anh.nguyen.2@tier4.jp kento.yabuuchi.2@tier4.jp lxg19892021@gmail.com masahiro.sakamoto@tier4.jp ryu.yamamoto@tier4.jp shintaro.sakoda@tier4.jp taiki.yamada@tier4.jp yamato.ando@tier4.jp @autowarefoundation/autoware-core-global-codeowners
1618
planning/autoware_objects_of_interest_marker_interface/** fumiya.watanabe@tier4.jp kosuke.takeuchi@tier4.jp lxg19892021@gmail.com zulfaqar.azmi@tier4.jp @autowarefoundation/autoware-core-global-codeowners
1719
planning/autoware_path_generator/** kosuke.takeuchi@tier4.jp mitsuhiro.sakamoto@tier4.jp satoshi.ota@tier4.jp takayuki.murooka@tier4.jp @autowarefoundation/autoware-core-global-codeowners
20+
planning/autoware_planning_factor_interface/** mamoru.sobue@tier4.jp satoshi.ota@tier4.jp @autowarefoundation/autoware-core-global-codeowners
1821
sensing/autoware_gnss_poser/** anh.nguyen.2@tier4.jp kento.yabuuchi.2@tier4.jp lxg19892021@gmail.com masahiro.sakamoto@tier4.jp ryu.yamamoto@tier4.jp shintaro.sakoda@tier4.jp taiki.yamada@tier4.jp yamato.ando@tier4.jp @autowarefoundation/autoware-core-global-codeowners
1922
testing/autoware_planning_test_manager/** kyoichi.sugahara@tier4.jp mamoru.sobue@tier4.jp takamasa.horibe@tier4.jp @autowarefoundation/autoware-core-global-codeowners
2023
testing/autoware_pyplot/** mamoru.sobue@tier4.jp yukinari.hisaki.2@tier4.jp @autowarefoundation/autoware-core-global-codeowners

codecov.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,9 @@ flag_management:
2424
- name_prefix: patch-
2525
type: patch
2626
target: auto
27+
28+
ignore:
29+
- "**/test/*"
30+
- "**/test/**/*"
31+
- "**/debug.*"
32+
- tools/**
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
cmake_minimum_required(VERSION 3.8)
2+
project(autoware_lanelet2_utils)
3+
4+
find_package(autoware_cmake REQUIRED)
5+
autoware_package()
6+
7+
ament_auto_add_library(${PROJECT_NAME} SHARED
8+
src/kind.cpp
9+
src/topology.cpp
10+
src/intersection.cpp
11+
)
12+
13+
if(BUILD_TESTING)
14+
find_package(ament_cmake_ros REQUIRED)
15+
ament_auto_find_test_dependencies()
16+
17+
set(test_files
18+
test/kind.cpp
19+
test/topology.cpp
20+
test/intersection.cpp
21+
)
22+
23+
foreach (test_file IN LISTS test_files)
24+
get_filename_component(test_file_name ${test_file} NAME)
25+
ament_auto_add_gtest(${test_file_name}_${PROJECT_NAME} ${test_file})
26+
target_link_libraries(${test_file_name}_${PROJECT_NAME}
27+
${PROJECT_NAME}
28+
)
29+
endforeach()
30+
endif()
31+
32+
ament_auto_package(INSTALL_TO_SHARE
33+
sample_map
34+
)
35+
36+
install(PROGRAMS
37+
scripts/lanelet_anonymizer.py
38+
scripts/lanelet_id_aligner.py
39+
DESTINATION lib/${PROJECT_NAME}
40+
)

common/autoware_lanelet2_utils/README.md

+183
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// Copyright 2025 TIER IV, Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#ifndef AUTOWARE__LANELET2_UTILS__INTERSECTION_HPP_
16+
#define AUTOWARE__LANELET2_UTILS__INTERSECTION_HPP_
17+
18+
#include <lanelet2_core/Forward.h>
19+
20+
#include <optional>
21+
22+
namespace autoware::lanelet2_utility
23+
{
24+
25+
static constexpr const char * k_turn_direction = "turn_direction";
26+
static constexpr const char * k_turn_direction_straight = "straight";
27+
static constexpr const char * k_turn_direction_left = "left";
28+
static constexpr const char * k_turn_direction_right = "right";
29+
30+
enum TurnDirection : int { Straight = 0, Left, Right };
31+
32+
/**
33+
* @brief check if given lanelet has "turn_direction" attribute
34+
* @param [in] input lanelet
35+
* @return true if and only if the given lanelet has "turn_direction" attribute
36+
*/
37+
bool is_intersection_lanelet(const lanelet::ConstLanelet & lanelet);
38+
39+
/**
40+
* @brief check if given lanelet has "turn_direction" attribute and the value is "straight"
41+
* @param [in] input lanelet
42+
* @return true if and only if the given lanelet has "turn_direction" attribute and the value is
43+
* "straight"
44+
*/
45+
bool is_straight_direction(const lanelet::ConstLanelet & lanelet);
46+
47+
/**
48+
* @brief check if given lanelet has "turn_direction" attribute and the value is "left"
49+
* @param [in] input lanelet
50+
* @return true if and only if the given lanelet has "turn_direction" attribute and the value is
51+
* "left"
52+
*/
53+
bool is_left_direction(const lanelet::ConstLanelet & lanelet);
54+
55+
/**
56+
* @brief check if given lanelet has "turn_direction" attribute and the value is "right"
57+
* @param [in] input lanelet
58+
* @return true if and only if the given lanelet has "turn_direction" attribute and the value is
59+
* "right"
60+
*/
61+
bool is_right_direction(const lanelet::ConstLanelet & lanelet);
62+
63+
/**
64+
* @brief get the turn_direction value
65+
* @param [in] input lanelet
66+
* @return valid TurnDirection value if `lanelet` has valid "turn_direction" value, otherwise null
67+
* "right"
68+
*/
69+
std::optional<TurnDirection> get_turn_direction(const lanelet::ConstLanelet & lanelet);
70+
71+
} // namespace autoware::lanelet2_utility
72+
#endif // AUTOWARE__LANELET2_UTILS__INTERSECTION_HPP_
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// Copyright 2025 TIER IV, Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#ifndef AUTOWARE_LANELET2_UTILS__KIND_HPP_
16+
#define AUTOWARE_LANELET2_UTILS__KIND_HPP_
17+
18+
#include <lanelet2_core/Forward.h>
19+
20+
namespace autoware::lanelet2_utils
21+
{
22+
static constexpr const char * k_road_lane_type = "road";
23+
static constexpr const char * k_shoulder_lane_type = "road_shoulder";
24+
static constexpr const char * k_bicycle_lane_type = "bicycle_lane";
25+
26+
/*
27+
* TODO(soblin): distinguish road lane type
28+
class RoadLane : public lanelet::ConstLanelet
29+
{
30+
};
31+
32+
class RoadShoulderLane : public lanelet::ConstLanelet
33+
{
34+
};
35+
36+
class BicycleLane : public lanelet::ConstLanelet
37+
{
38+
};
39+
*/
40+
41+
/**
42+
* @brief check if the given lanelet type has "road" subtype
43+
* @param [in] lanelet input lanelet
44+
* @return if the lanelet is road or not
45+
*/
46+
bool is_road_lane(const lanelet::ConstLanelet & lanelet);
47+
48+
/**
49+
* @brief check if the given lanelet type has "road_shoulder" subtype
50+
* @param [in] lanelet input lanelet
51+
* @return if the lanelet is road_shoulder or not
52+
*/
53+
bool is_shoulder_lane(const lanelet::ConstLanelet & lanelet);
54+
55+
/**
56+
* @brief check if the given lanelet type has "bicycle_lane" subtype
57+
* @param [in] lanelet input lanelet
58+
* @return if the lanelet is bicycle_lane or not
59+
*/
60+
bool is_bicycle_lane(const lanelet::ConstLanelet & lanelet);
61+
} // namespace autoware::lanelet2_utils
62+
#endif // AUTOWARE_LANELET2_UTILS__KIND_HPP_
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
// Copyright 2025 TIER IV, Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#ifndef AUTOWARE_LANELET2_UTILS__TOPOLOGY_HPP_
16+
#define AUTOWARE_LANELET2_UTILS__TOPOLOGY_HPP_
17+
18+
#include <lanelet2_core/primitives/Lanelet.h>
19+
#include <lanelet2_routing/Forward.h>
20+
#include <lanelet2_traffic_rules/TrafficRulesFactory.h>
21+
22+
#include <optional>
23+
#include <vector>
24+
25+
namespace autoware::lanelet2_utils
26+
{
27+
/**
28+
* @brief instantiate RoutingGraph from given LaneletMap only from "road" lanes
29+
* @param location [in, opt, lanelet::Locations::Germany] location value
30+
* @param participant [in, opt, lanelet::Participants::Vehicle] participant value
31+
* @return RoutingGraph object without road_shoulder and bicycle_lane
32+
*/
33+
lanelet::routing::RoutingGraphConstPtr instantiate_routing_graph(
34+
lanelet::LaneletMapConstPtr lanelet_map, const char * location = lanelet::Locations::Germany,
35+
const char * participant = lanelet::Participants::Vehicle);
36+
37+
/**
38+
* @brief get the left adjacent and same_direction lanelet on the routing graph if exists regardless
39+
* of lane change permission
40+
* @param [in] lanelet input lanelet
41+
* @param [in] routing_graph routing_graph containing `lanelet`
42+
* @return optional of left adjacent lanelet(nullopt if there is no such adjacent lanelet)
43+
*/
44+
std::optional<lanelet::ConstLanelet> left_lanelet(
45+
const lanelet::ConstLanelet & lanelet,
46+
const lanelet::routing::RoutingGraphConstPtr routing_graph);
47+
48+
/**
49+
* @brief get the right adjacent and same_direction lanelet on the routing graph if exists
50+
* @param [in] lanelet input lanelet
51+
* @param [in] routing_graph routing_graph containing `lanelet`
52+
* @return optional of right adjacent lanelet(nullopt if there is no such adjacent lanelet)
53+
*/
54+
std::optional<lanelet::ConstLanelet> right_lanelet(
55+
const lanelet::ConstLanelet & lanelet,
56+
const lanelet::routing::RoutingGraphConstPtr routing_graph);
57+
58+
/**
59+
* @brief get left_lanelet() or sibling lanelet. If `lanelet` has turn_direction, search for sibling
60+
* lanelet is limited to the one with same turn_direction value
61+
* @param [in] lanelet input lanelet
62+
* @param [in] routing_graph routing_graph containing `lanelet`
63+
* @return optional of aforementioned lanelet(nullopt if there is no such lanelet)
64+
*/
65+
/*
66+
std::optional<lanelet::ConstLanelet> left_similar_lanelet(
67+
const lanelet::ConstLanelet & lanelet, const lanelet::LaneletMapConstPtr lanelet_map,
68+
const lanelet::routing::RoutingGraphConstPtr routing_graph);
69+
*/
70+
71+
/**
72+
* @brief get right_lanelet() or sibling lanelet. If `lanelet` has turn_direction, search for
73+
* sibling lanelet is limited to the one with same turn_direction value
74+
* @param [in] lanelet input lanelet
75+
* @param [in] routing_graph routing_graph containing `lanelet`
76+
* @return optional of aforementioned lanelet(nullopt if there is no such lanelet)
77+
*/
78+
/*
79+
std::optional<lanelet::ConstLanelet> right_similar_lanelet(
80+
const lanelet::ConstLanelet & lanelet, const lanelet::LaneletMapConstPtr lanelet_map,
81+
const lanelet::routing::RoutingGraphConstPtr routing_graph);
82+
*/
83+
84+
/**
85+
* @brief get the left adjacent and opposite_direction lanelet on the routing graph if exists
86+
* @param [in] lanelet input lanelet
87+
* @param [in] lanelet_map lanelet_map containing `lanelet`
88+
* @return optional of the left opposite lanelet(nullopt if there is not such opposite lanelet)
89+
*/
90+
std::optional<lanelet::ConstLanelet> left_opposite_lanelet(
91+
const lanelet::ConstLanelet & lanelet, const lanelet::LaneletMapConstPtr lanelet_map);
92+
93+
/**
94+
* @brief get the right adjacent and opposite_direction lanelet on the routing graph if exists
95+
* @param [in] lanelet input lanelet
96+
* @param [in] routing_graph routing_graph containing `lanelet`
97+
* @return optional of the right opposite lanelet(nullopt if there is no such opposite lanelet)
98+
*/
99+
std::optional<lanelet::ConstLanelet> right_opposite_lanelet(
100+
const lanelet::ConstLanelet & lanelet, const lanelet::LaneletMapConstPtr lanelet_map);
101+
102+
/**
103+
* @brief get the leftmost same_direction lanelet if exists
104+
* @param [in] lanelet input lanelet
105+
* @param [in] routing_graph routing_graph containing `lanelet`
106+
* @return optional of such lanelet(nullopt if there is no such adjacent lanelet)
107+
*/
108+
std::optional<lanelet::ConstLanelet> leftmost_lanelet(
109+
const lanelet::ConstLanelet & lanelet,
110+
const lanelet::routing::RoutingGraphConstPtr routing_graph);
111+
112+
std::optional<lanelet::ConstLanelet> rightmost_lanelet(
113+
const lanelet::ConstLanelet & lanelet,
114+
const lanelet::routing::RoutingGraphConstPtr routing_graph);
115+
116+
/**
117+
* @brief get the left lanelets which are adjacent to `lanelet`
118+
* @param [in] lanelet input lanelet
119+
* @param [in] routing_graph routing_graph containing `lanelet`
120+
* @param [in] include_opposite flag if opposite_direction lanelet is included
121+
* @param [in] invert_opposite_lanelet flag if the opposite lanelet in the output is `.inverted()`
122+
* or not
123+
* @return the list of lanelets excluding `lanelet` which is ordered in the *hopping* number from
124+
* `lanelet`
125+
*/
126+
lanelet::ConstLanelets left_lanelets(
127+
const lanelet::ConstLanelet & lanelet, const lanelet::LaneletMapConstPtr lanelet_map,
128+
const lanelet::routing::RoutingGraphConstPtr routing_graph, const bool include_opposite = false,
129+
const bool invert_opposite_lane = false);
130+
131+
/**
132+
* @brief get the right lanelets which are adjacent to `lanelet`
133+
* @param [in] lanelet input lanelet
134+
* @param [in] routing_graph routing_graph containing `lanelet`
135+
* @param [in] include_opposite flag if opposite_direction lanelet is included
136+
* @param [in] invert_opposite_lanelet flag if the opposite lanelet in the output is `.inverted()`
137+
* or not
138+
* @return the list of lanelets excluding `lanelet` which is ordered in the *hopping* number from
139+
* `lanelet`
140+
*/
141+
lanelet::ConstLanelets right_lanelets(
142+
const lanelet::ConstLanelet & lanelet, const lanelet::LaneletMapConstPtr lanelet_map,
143+
const lanelet::routing::RoutingGraphConstPtr routing_graph, const bool include_opposite = false,
144+
const bool invert_opposite_lane = false);
145+
146+
/**
147+
* @brief get the following lanelets
148+
* @param [in] lanelet input lanelet
149+
* @param [in] routing_graph routing_graph containing `lanelet`
150+
* @return the following lanelets
151+
*/
152+
lanelet::ConstLanelets following_lanelets(
153+
const lanelet::ConstLanelet & lanelet,
154+
const lanelet::routing::RoutingGraphConstPtr routing_graph);
155+
156+
/**
157+
* @brief get the previous lanelets
158+
* @param [in] lanelet input lanelet
159+
* @param [in] routing_graph routing_graph containing `lanelet`
160+
* @return the previous lanelets
161+
*/
162+
lanelet::ConstLanelets previous_lanelets(
163+
const lanelet::ConstLanelet & lanelet,
164+
const lanelet::routing::RoutingGraphConstPtr routing_graph);
165+
166+
/**
167+
* @brief get the sibling lanelets
168+
* @param [in] lanelet input lanelet
169+
* @param [in] routing_graph routing_graph containing `lanelet`
170+
* @return the sibling lanelets excluding `lanelet`
171+
*/
172+
lanelet::ConstLanelets sibling_lanelets(
173+
const lanelet::ConstLanelet & lanelet,
174+
const lanelet::routing::RoutingGraphConstPtr routing_graph);
175+
176+
/**
177+
* @brief get Lanelet instances of the designated ids
178+
* @param [in] lanelet input lanelet
179+
* @param [in] routing_graph routing_graph containing `lanelet`
180+
* @return the list of Lanelets in the same order as `ids`
181+
*/
182+
lanelet::ConstLanelets from_ids(
183+
const lanelet::LaneletMapConstPtr lanelet_map, const std::vector<lanelet::Id> & ids);
184+
} // namespace autoware::lanelet2_utils
185+
186+
#endif // AUTOWARE_LANELET2_UTILS__TOPOLOGY_HPP_

0 commit comments

Comments
 (0)