Skip to content
This repository was archived by the owner on Jul 1, 2024. It is now read-only.

Commit 4661d4f

Browse files
committed
feat!(lanelet2_extension): introduce API versioning along with format_version
Signed-off-by: Mamoru Sobue <mamoru.sobue@tier4.jp>
1 parent f01d31c commit 4661d4f

17 files changed

+751
-657
lines changed

tmp/lanelet2_extension/include/lanelet2_extension/io/autoware_osm_parser.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
// NOLINTBEGIN(readability-identifier-naming)
2121

22+
#include <lanelet2_extension/version.hpp>
23+
2224
#include <lanelet2_io/io_handlers/OsmHandler.h>
2325

2426
#include <memory>

tmp/lanelet2_extension/include/lanelet2_extension/projection/mgrs_projector.hpp

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030

3131
namespace lanelet::projection
3232
{
33+
34+
inline namespace v1
35+
{
3336
class MGRSProjector : public Projector
3437
{
3538
public:
@@ -108,6 +111,7 @@ class MGRSProjector : public Projector
108111
*/
109112
mutable std::string projected_grid_;
110113
};
114+
} // namespace v1
111115

112116
} // namespace lanelet::projection
113117

tmp/lanelet2_extension/include/lanelet2_extension/projection/transverse_mercator_projector.hpp

+4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727

2828
namespace lanelet::projection
2929
{
30+
31+
inline namespace v1
32+
{
3033
class TransverseMercatorProjector : public Projector
3134
{
3235
public:
@@ -53,6 +56,7 @@ class TransverseMercatorProjector : public Projector
5356
double origin_y_;
5457
double central_meridian_;
5558
};
59+
} // namespace v1
5660

5761
} // namespace lanelet::projection
5862

tmp/lanelet2_extension/include/lanelet2_extension/regulatory_elements/Forward.hpp

+8
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
namespace lanelet::autoware
2626
{
2727

28+
inline namespace v1
29+
{
2830
class AutowareTrafficLight;
2931
class Crosswalk;
3032
class DetectionArea;
@@ -33,11 +35,15 @@ class NoStoppingArea;
3335
class RoadMarking;
3436
class SpeedBump;
3537
class VirtualTrafficLight;
38+
} // namespace v1
3639

3740
} // namespace lanelet::autoware
3841

3942
namespace lanelet
4043
{
44+
45+
inline namespace v1
46+
{
4147
using TrafficSignConstPtr = std::shared_ptr<const lanelet::TrafficSign>;
4248
using TrafficLightConstPtr = std::shared_ptr<const lanelet::TrafficLight>;
4349
using AutowareTrafficLightConstPtr = std::shared_ptr<const lanelet::autoware::AutowareTrafficLight>;
@@ -47,6 +53,8 @@ using NoStoppingAreaConstPtr = std::shared_ptr<const lanelet::autoware::NoStoppi
4753
using NoParkingAreaConstPtr = std::shared_ptr<const lanelet::autoware::NoParkingArea>;
4854
using SpeedBumpConstPtr = std::shared_ptr<const lanelet::autoware::SpeedBump>;
4955
using CrosswalkConstPtr = std::shared_ptr<const lanelet::autoware::Crosswalk>;
56+
} // namespace v1
57+
5058
} // namespace lanelet
5159

5260
// NOLINTEND(readability-identifier-naming)

tmp/lanelet2_extension/include/lanelet2_extension/regulatory_elements/autoware_traffic_light.hpp

+4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828

2929
namespace lanelet::autoware
3030
{
31+
32+
inline namespace v1
33+
{
3134
class AutowareTrafficLight : public lanelet::TrafficLight
3235
{
3336
public:
@@ -83,6 +86,7 @@ class AutowareTrafficLight : public lanelet::TrafficLight
8386
friend class RegisterRegulatoryElement<AutowareTrafficLight>;
8487
explicit AutowareTrafficLight(const lanelet::RegulatoryElementDataPtr & data);
8588
};
89+
} // namespace v1
8690

8791
} // namespace lanelet::autoware
8892

tmp/lanelet2_extension/include/lanelet2_extension/regulatory_elements/crosswalk.hpp

+4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525

2626
namespace lanelet::autoware
2727
{
28+
29+
inline namespace v1
30+
{
2831
class Crosswalk : public lanelet::RegulatoryElement
2932
{
3033
public:
@@ -84,6 +87,7 @@ class Crosswalk : public lanelet::RegulatoryElement
8487
friend class RegisterRegulatoryElement<Crosswalk>;
8588
explicit Crosswalk(const lanelet::RegulatoryElementDataPtr & data);
8689
};
90+
} // namespace v1
8791

8892
} // namespace lanelet::autoware
8993

tmp/lanelet2_extension/include/lanelet2_extension/regulatory_elements/detection_area.hpp

+4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727

2828
namespace lanelet::autoware
2929
{
30+
31+
inline namespace v1
32+
{
3033
class DetectionArea : public lanelet::RegulatoryElement
3134
{
3235
public:
@@ -88,6 +91,7 @@ class DetectionArea : public lanelet::RegulatoryElement
8891
friend class RegisterRegulatoryElement<DetectionArea>;
8992
explicit DetectionArea(const lanelet::RegulatoryElementDataPtr & data);
9093
};
94+
} // namespace v1
9195

9296
} // namespace lanelet::autoware
9397

tmp/lanelet2_extension/include/lanelet2_extension/regulatory_elements/no_parking_area.hpp

+4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525

2626
namespace lanelet::autoware
2727
{
28+
29+
inline namespace v1
30+
{
2831
class NoParkingArea : public lanelet::RegulatoryElement
2932
{
3033
public:
@@ -64,6 +67,7 @@ class NoParkingArea : public lanelet::RegulatoryElement
6467
friend class RegisterRegulatoryElement<NoParkingArea>;
6568
explicit NoParkingArea(const lanelet::RegulatoryElementDataPtr & data);
6669
};
70+
} // namespace v1
6771

6872
} // namespace lanelet::autoware
6973

tmp/lanelet2_extension/include/lanelet2_extension/regulatory_elements/no_stopping_area.hpp

+4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525

2626
namespace lanelet::autoware
2727
{
28+
29+
inline namespace v1
30+
{
2831
class NoStoppingArea : public lanelet::RegulatoryElement
2932
{
3033
public:
@@ -86,6 +89,7 @@ class NoStoppingArea : public lanelet::RegulatoryElement
8689
friend class RegisterRegulatoryElement<NoStoppingArea>;
8790
explicit NoStoppingArea(const lanelet::RegulatoryElementDataPtr & data);
8891
};
92+
} // namespace v1
8993

9094
} // namespace lanelet::autoware
9195

tmp/lanelet2_extension/include/lanelet2_extension/regulatory_elements/road_marking.hpp

+4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525

2626
namespace lanelet::autoware
2727
{
28+
29+
inline namespace v1
30+
{
2831
class RoadMarking : public lanelet::RegulatoryElement
2932
{
3033
public:
@@ -64,6 +67,7 @@ class RoadMarking : public lanelet::RegulatoryElement
6467
friend class RegisterRegulatoryElement<RoadMarking>;
6568
explicit RoadMarking(const lanelet::RegulatoryElementDataPtr & data);
6669
};
70+
} // namespace v1
6771

6872
} // namespace lanelet::autoware
6973

tmp/lanelet2_extension/include/lanelet2_extension/regulatory_elements/speed_bump.hpp

+4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727

2828
namespace lanelet::autoware
2929
{
30+
31+
inline namespace v1
32+
{
3033
class SpeedBump : public lanelet::RegulatoryElement
3134
{
3235
public:
@@ -66,6 +69,7 @@ class SpeedBump : public lanelet::RegulatoryElement
6669
friend class RegisterRegulatoryElement<SpeedBump>;
6770
explicit SpeedBump(const lanelet::RegulatoryElementDataPtr & data);
6871
};
72+
} // namespace v1
6973

7074
} // namespace lanelet::autoware
7175

tmp/lanelet2_extension/include/lanelet2_extension/regulatory_elements/virtual_traffic_light.hpp

+4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525

2626
namespace lanelet::autoware
2727
{
28+
29+
inline namespace v1
30+
{
2831
class VirtualTrafficLight : public lanelet::RegulatoryElement
2932
{
3033
public:
@@ -71,6 +74,7 @@ class VirtualTrafficLight : public lanelet::RegulatoryElement
7174
friend class RegisterRegulatoryElement<VirtualTrafficLight>;
7275
explicit VirtualTrafficLight(const lanelet::RegulatoryElementDataPtr & data);
7376
};
77+
} // namespace v1
7478

7579
} // namespace lanelet::autoware
7680

tmp/lanelet2_extension/include/lanelet2_extension/utility/query.hpp

+38-34
Original file line numberDiff line numberDiff line change
@@ -39,37 +39,9 @@
3939

4040
namespace lanelet::utils::query
4141
{
42-
/**
43-
* [laneletLayer converts laneletLayer into lanelet vector]
44-
* @param ll_Map [input lanelet map]
45-
* @return [all lanelets in the map]
46-
*/
47-
lanelet::ConstLanelets laneletLayer(const lanelet::LaneletMapConstPtr & ll_Map);
48-
49-
/**
50-
* [subtypeLanelets extracts Lanelet that has given subtype attribute]
51-
* @param lls [input lanelets with various subtypes]
52-
* @param subtype [subtype of lanelets to be retrieved (e.g.
53-
* lanelet::AttributeValueString::Road)]
54-
* @return [lanelets with given subtype]
55-
*/
56-
lanelet::ConstLanelets subtypeLanelets(const lanelet::ConstLanelets & lls, const char subtype[]);
57-
58-
/**
59-
* [crosswalkLanelets extracts crosswalk lanelets]
60-
* @param lls [input lanelets with various subtypes]
61-
* @return [crosswalk lanelets]
62-
*/
63-
lanelet::ConstLanelets crosswalkLanelets(const lanelet::ConstLanelets & lls);
64-
lanelet::ConstLanelets walkwayLanelets(const lanelet::ConstLanelets & lls);
65-
66-
/**
67-
* [roadLanelets extracts road lanelets]
68-
* @param lls [input lanelets with subtype road]
69-
* @return [road lanelets]
70-
*/
71-
lanelet::ConstLanelets roadLanelets(const lanelet::ConstLanelets & lls);
7242

43+
inline namespace v1
44+
{
7345
/**
7446
* [shoulderLanelets extracts shoulder lanelets]
7547
* @param lls [input lanelets with subtype shoulder]
@@ -129,13 +101,17 @@ std::vector<lanelet::SpeedBumpConstPtr> speedBumps(const lanelet::ConstLanelets
129101
*/
130102
std::vector<lanelet::CrosswalkConstPtr> crosswalks(const lanelet::ConstLanelets & lanelets);
131103

104+
/**
105+
* [crosswalkLanelets extracts crosswalk lanelets]
106+
* @param lls [input lanelets with various subtypes]
107+
* @return [crosswalk lanelets]
108+
*/
109+
lanelet::ConstLanelets crosswalkLanelets(const lanelet::ConstLanelets & lls);
110+
lanelet::ConstLanelets walkwayLanelets(const lanelet::ConstLanelets & lls);
111+
132112
// query all curbstones in lanelet2 map
133113
lanelet::ConstLineStrings3d curbstones(const lanelet::LaneletMapConstPtr & lanelet_map_ptr);
134114

135-
// query all polygons that has given type in lanelet2 map
136-
lanelet::ConstPolygons3d getAllPolygonsByType(
137-
const lanelet::LaneletMapConstPtr & lanelet_map_ptr, const std::string & polygon_type);
138-
139115
// query all obstacle polygons in lanelet2 map
140116
lanelet::ConstPolygons3d getAllObstaclePolygons(
141117
const lanelet::LaneletMapConstPtr & lanelet_map_ptr);
@@ -227,6 +203,34 @@ std::vector<lanelet::ConstLineString3d> stopLinesLanelet(const lanelet::ConstLan
227203
*/
228204
std::vector<lanelet::ConstLineString3d> stopSignStopLines(
229205
const lanelet::ConstLanelets & lanelets, const std::string & stop_sign_id = "stop_sign");
206+
} // namespace v1
207+
208+
/**
209+
* [laneletLayer converts laneletLayer into lanelet vector]
210+
* @param ll_Map [input lanelet map]
211+
* @return [all lanelets in the map]
212+
*/
213+
lanelet::ConstLanelets laneletLayer(const lanelet::LaneletMapConstPtr & ll_Map);
214+
215+
/**
216+
* [subtypeLanelets extracts Lanelet that has given subtype attribute]
217+
* @param lls [input lanelets with various subtypes]
218+
* @param subtype [subtype of lanelets to be retrieved (e.g.
219+
* lanelet::AttributeValueString::Road)]
220+
* @return [lanelets with given subtype]
221+
*/
222+
lanelet::ConstLanelets subtypeLanelets(const lanelet::ConstLanelets & lls, const char subtype[]);
223+
224+
/**
225+
* [roadLanelets extracts road lanelets]
226+
* @param lls [input lanelets with subtype road]
227+
* @return [road lanelets]
228+
*/
229+
lanelet::ConstLanelets roadLanelets(const lanelet::ConstLanelets & lls);
230+
231+
// query all polygons that has given type in lanelet2 map
232+
lanelet::ConstPolygons3d getAllPolygonsByType(
233+
const lanelet::LaneletMapConstPtr & lanelet_map_ptr, const std::string & polygon_type);
230234

231235
ConstLanelets getLaneletsWithinRange(
232236
const lanelet::ConstLanelets & lanelets, const lanelet::BasicPoint2d & search_point,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright 2015-2024 Autoware Foundation. All rights reserved.
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+
// Authors: Mamoru Sobue
16+
17+
#ifndef LANELET2_EXTENSION__VERSION_HPP_
18+
#define LANELET2_EXTENSION__VERSION_HPP_
19+
20+
// NOLINTBEGIN(readability-identifier-naming)
21+
22+
namespace lanelet::autoware
23+
{
24+
enum class Version : int {
25+
none = 0,
26+
v1,
27+
};
28+
29+
static constexpr Version version = Version::v1;
30+
} // namespace lanelet::autoware
31+
32+
#endif // LANELET2_EXTENSION__VERSION_HPP_

0 commit comments

Comments
 (0)