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

Commit

Permalink
feat!(lanelet2_extension): introduce API versioning along with format…
Browse files Browse the repository at this point in the history
…_version

Signed-off-by: Mamoru Sobue <[email protected]>
  • Loading branch information
soblin committed May 20, 2024
1 parent b92f64f commit 3a0d2bf
Show file tree
Hide file tree
Showing 16 changed files with 748 additions and 657 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@

namespace lanelet::projection
{

inline namespace v1
{
class MGRSProjector : public Projector
{
public:
Expand Down Expand Up @@ -108,6 +111,7 @@ class MGRSProjector : public Projector
*/
mutable std::string projected_grid_;
};
} // namespace v1

} // namespace lanelet::projection

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@

namespace lanelet::projection
{

inline namespace v1
{
class TransverseMercatorProjector : public Projector
{
public:
Expand All @@ -53,6 +56,7 @@ class TransverseMercatorProjector : public Projector
double origin_y_;
double central_meridian_;
};
} // namespace v1

} // namespace lanelet::projection

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
namespace lanelet::autoware
{

inline namespace v1
{
class AutowareTrafficLight;
class Crosswalk;
class DetectionArea;
Expand All @@ -33,11 +35,15 @@ class NoStoppingArea;
class RoadMarking;
class SpeedBump;
class VirtualTrafficLight;
} // namespace v1

} // namespace lanelet::autoware

namespace lanelet
{

inline namespace v1
{
using TrafficSignConstPtr = std::shared_ptr<const lanelet::TrafficSign>;
using TrafficLightConstPtr = std::shared_ptr<const lanelet::TrafficLight>;
using AutowareTrafficLightConstPtr = std::shared_ptr<const lanelet::autoware::AutowareTrafficLight>;
Expand All @@ -47,6 +53,8 @@ using NoStoppingAreaConstPtr = std::shared_ptr<const lanelet::autoware::NoStoppi
using NoParkingAreaConstPtr = std::shared_ptr<const lanelet::autoware::NoParkingArea>;
using SpeedBumpConstPtr = std::shared_ptr<const lanelet::autoware::SpeedBump>;
using CrosswalkConstPtr = std::shared_ptr<const lanelet::autoware::Crosswalk>;
} // namespace v1

} // namespace lanelet

// NOLINTEND(readability-identifier-naming)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@

namespace lanelet::autoware
{

inline namespace v1
{
class AutowareTrafficLight : public lanelet::TrafficLight
{
public:
Expand Down Expand Up @@ -83,6 +86,7 @@ class AutowareTrafficLight : public lanelet::TrafficLight
friend class RegisterRegulatoryElement<AutowareTrafficLight>;
explicit AutowareTrafficLight(const lanelet::RegulatoryElementDataPtr & data);
};
} // namespace v1

} // namespace lanelet::autoware

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@

namespace lanelet::autoware
{

inline namespace v1
{
class Crosswalk : public lanelet::RegulatoryElement
{
public:
Expand Down Expand Up @@ -84,6 +87,7 @@ class Crosswalk : public lanelet::RegulatoryElement
friend class RegisterRegulatoryElement<Crosswalk>;
explicit Crosswalk(const lanelet::RegulatoryElementDataPtr & data);
};
} // namespace v1

} // namespace lanelet::autoware

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@

namespace lanelet::autoware
{

inline namespace v1
{
class DetectionArea : public lanelet::RegulatoryElement
{
public:
Expand Down Expand Up @@ -88,6 +91,7 @@ class DetectionArea : public lanelet::RegulatoryElement
friend class RegisterRegulatoryElement<DetectionArea>;
explicit DetectionArea(const lanelet::RegulatoryElementDataPtr & data);
};
} // namespace v1

} // namespace lanelet::autoware

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@

namespace lanelet::autoware
{

inline namespace v1
{
class NoParkingArea : public lanelet::RegulatoryElement
{
public:
Expand Down Expand Up @@ -64,6 +67,7 @@ class NoParkingArea : public lanelet::RegulatoryElement
friend class RegisterRegulatoryElement<NoParkingArea>;
explicit NoParkingArea(const lanelet::RegulatoryElementDataPtr & data);
};
} // namespace v1

} // namespace lanelet::autoware

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@

namespace lanelet::autoware
{

inline namespace v1
{
class NoStoppingArea : public lanelet::RegulatoryElement
{
public:
Expand Down Expand Up @@ -86,6 +89,7 @@ class NoStoppingArea : public lanelet::RegulatoryElement
friend class RegisterRegulatoryElement<NoStoppingArea>;
explicit NoStoppingArea(const lanelet::RegulatoryElementDataPtr & data);
};
} // namespace v1

} // namespace lanelet::autoware

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@

namespace lanelet::autoware
{

inline namespace v1
{
class RoadMarking : public lanelet::RegulatoryElement
{
public:
Expand Down Expand Up @@ -64,6 +67,7 @@ class RoadMarking : public lanelet::RegulatoryElement
friend class RegisterRegulatoryElement<RoadMarking>;
explicit RoadMarking(const lanelet::RegulatoryElementDataPtr & data);
};
} // namespace v1

} // namespace lanelet::autoware

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@

namespace lanelet::autoware
{

inline namespace v1
{
class SpeedBump : public lanelet::RegulatoryElement
{
public:
Expand Down Expand Up @@ -66,6 +69,7 @@ class SpeedBump : public lanelet::RegulatoryElement
friend class RegisterRegulatoryElement<SpeedBump>;
explicit SpeedBump(const lanelet::RegulatoryElementDataPtr & data);
};
} // namespace v1

} // namespace lanelet::autoware

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@

namespace lanelet::autoware
{

inline namespace v1
{
class VirtualTrafficLight : public lanelet::RegulatoryElement
{
public:
Expand Down Expand Up @@ -71,6 +74,7 @@ class VirtualTrafficLight : public lanelet::RegulatoryElement
friend class RegisterRegulatoryElement<VirtualTrafficLight>;
explicit VirtualTrafficLight(const lanelet::RegulatoryElementDataPtr & data);
};
} // namespace v1

} // namespace lanelet::autoware

Expand Down
72 changes: 38 additions & 34 deletions tmp/lanelet2_extension/include/lanelet2_extension/utility/query.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,37 +39,9 @@

namespace lanelet::utils::query
{
/**
* [laneletLayer converts laneletLayer into lanelet vector]
* @param ll_Map [input lanelet map]
* @return [all lanelets in the map]
*/
lanelet::ConstLanelets laneletLayer(const lanelet::LaneletMapConstPtr & ll_Map);

/**
* [subtypeLanelets extracts Lanelet that has given subtype attribute]
* @param lls [input lanelets with various subtypes]
* @param subtype [subtype of lanelets to be retrieved (e.g.
* lanelet::AttributeValueString::Road)]
* @return [lanelets with given subtype]
*/
lanelet::ConstLanelets subtypeLanelets(const lanelet::ConstLanelets & lls, const char subtype[]);

/**
* [crosswalkLanelets extracts crosswalk lanelets]
* @param lls [input lanelets with various subtypes]
* @return [crosswalk lanelets]
*/
lanelet::ConstLanelets crosswalkLanelets(const lanelet::ConstLanelets & lls);
lanelet::ConstLanelets walkwayLanelets(const lanelet::ConstLanelets & lls);

/**
* [roadLanelets extracts road lanelets]
* @param lls [input lanelets with subtype road]
* @return [road lanelets]
*/
lanelet::ConstLanelets roadLanelets(const lanelet::ConstLanelets & lls);

inline namespace v1
{
/**
* [shoulderLanelets extracts shoulder lanelets]
* @param lls [input lanelets with subtype shoulder]
Expand Down Expand Up @@ -129,13 +101,17 @@ std::vector<lanelet::SpeedBumpConstPtr> speedBumps(const lanelet::ConstLanelets
*/
std::vector<lanelet::CrosswalkConstPtr> crosswalks(const lanelet::ConstLanelets & lanelets);

/**
* [crosswalkLanelets extracts crosswalk lanelets]
* @param lls [input lanelets with various subtypes]
* @return [crosswalk lanelets]
*/
lanelet::ConstLanelets crosswalkLanelets(const lanelet::ConstLanelets & lls);
lanelet::ConstLanelets walkwayLanelets(const lanelet::ConstLanelets & lls);

// query all curbstones in lanelet2 map
lanelet::ConstLineStrings3d curbstones(const lanelet::LaneletMapConstPtr & lanelet_map_ptr);

// query all polygons that has given type in lanelet2 map
lanelet::ConstPolygons3d getAllPolygonsByType(
const lanelet::LaneletMapConstPtr & lanelet_map_ptr, const std::string & polygon_type);

// query all obstacle polygons in lanelet2 map
lanelet::ConstPolygons3d getAllObstaclePolygons(
const lanelet::LaneletMapConstPtr & lanelet_map_ptr);
Expand Down Expand Up @@ -227,6 +203,34 @@ std::vector<lanelet::ConstLineString3d> stopLinesLanelet(const lanelet::ConstLan
*/
std::vector<lanelet::ConstLineString3d> stopSignStopLines(
const lanelet::ConstLanelets & lanelets, const std::string & stop_sign_id = "stop_sign");
} // namespace v1

/**
* [laneletLayer converts laneletLayer into lanelet vector]
* @param ll_Map [input lanelet map]
* @return [all lanelets in the map]
*/
lanelet::ConstLanelets laneletLayer(const lanelet::LaneletMapConstPtr & ll_Map);

/**
* [subtypeLanelets extracts Lanelet that has given subtype attribute]
* @param lls [input lanelets with various subtypes]
* @param subtype [subtype of lanelets to be retrieved (e.g.
* lanelet::AttributeValueString::Road)]
* @return [lanelets with given subtype]
*/
lanelet::ConstLanelets subtypeLanelets(const lanelet::ConstLanelets & lls, const char subtype[]);

/**
* [roadLanelets extracts road lanelets]
* @param lls [input lanelets with subtype road]
* @return [road lanelets]
*/
lanelet::ConstLanelets roadLanelets(const lanelet::ConstLanelets & lls);

// query all polygons that has given type in lanelet2 map
lanelet::ConstPolygons3d getAllPolygonsByType(
const lanelet::LaneletMapConstPtr & lanelet_map_ptr, const std::string & polygon_type);

ConstLanelets getLaneletsWithinRange(
const lanelet::ConstLanelets & lanelets, const lanelet::BasicPoint2d & search_point,
Expand Down
29 changes: 29 additions & 0 deletions tmp/lanelet2_extension/include/lanelet2_extension/version.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright 2015-2024 Autoware Foundation. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Authors: Mamoru Sobue

#ifndef LANELET2_EXTENSION__VERSION_HPP_
#define LANELET2_EXTENSION__VERSION_HPP_

// NOLINTBEGIN(readability-identifier-naming)

#include <string>

namespace lanelet::autoware
{
static constexpr std::string format_version = "1";
}

#endif // LANELET2_EXTENSION__VERSION_HPP_
Loading

0 comments on commit 3a0d2bf

Please sign in to comment.