Skip to content
Snippets Groups Projects
Commit f72ba9f3 authored by Andreas Rauschert's avatar Andreas Rauschert
Browse files

Merge branch 'add_local_lane_id' into 'main'

Add local id member in lane data structure

See merge request !7
parents 46a43e64 28358f01
No related branches found
No related tags found
1 merge request!7Add local id member in lane data structure
.cache/ .cache/
.clwb/
.vscode/ .vscode/
bazel-*
build/ build/
compile_commands.json compile_commands.json
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2023, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * Copyright (c) 2023-2024, Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
* Copyright (C) 2023, ANSYS, Inc. * Copyright (C) 2023, ANSYS, Inc.
* *
* This program and the accompanying materials are made * This program and the accompanying materials are made
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#define MAPSDK_MAPAPI_COMMON_IDENTIFIER_H #define MAPSDK_MAPAPI_COMMON_IDENTIFIER_H
#include <cstdint> #include <cstdint>
#include <limits>
namespace map_api namespace map_api
{ {
......
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2023, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * Copyright (c) 2023-2024, Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
* Copyright (C) 2023, ANSYS, Inc. * Copyright (C) 2023, ANSYS, Inc.
* *
* This program and the accompanying materials are made * This program and the accompanying materials are made
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#ifndef MAPSDK_MAPAPI_LANE_H #ifndef MAPSDK_MAPAPI_LANE_H
#define MAPSDK_MAPAPI_LANE_H #define MAPSDK_MAPAPI_LANE_H
#include <limits>
#include <vector> #include <vector>
#include "Common/common.h" #include "Common/common.h"
...@@ -19,6 +20,9 @@ ...@@ -19,6 +20,9 @@
namespace map_api namespace map_api
{ {
using LocalLaneId = std::int64_t;
constexpr LocalLaneId UndefinedLocalLaneId{std::numeric_limits<LocalLaneId>::max()};
struct Lane; struct Lane;
struct RoadCondition struct RoadCondition
...@@ -80,6 +84,7 @@ struct Lane ...@@ -80,6 +84,7 @@ struct Lane
}; };
Identifier id{UndefinedId}; Identifier id{UndefinedId};
LocalLaneId local_id{UndefinedLocalLaneId};
Type type; Type type;
Subtype sub_type; Subtype sub_type;
...@@ -145,6 +150,7 @@ inline bool ShallowVectorLaneComparison(const std::vector<Lane>& lhs, const std: ...@@ -145,6 +150,7 @@ inline bool ShallowVectorLaneComparison(const std::vector<Lane>& lhs, const std:
inline bool operator==(const Lane& lhs, const Lane& rhs) noexcept inline bool operator==(const Lane& lhs, const Lane& rhs) noexcept
{ {
if (std::tie(lhs.id, if (std::tie(lhs.id,
lhs.local_id,
lhs.type, lhs.type,
lhs.sub_type, lhs.sub_type,
lhs.centerline, lhs.centerline,
...@@ -154,6 +160,7 @@ inline bool operator==(const Lane& lhs, const Lane& rhs) noexcept ...@@ -154,6 +160,7 @@ inline bool operator==(const Lane& lhs, const Lane& rhs) noexcept
lhs.road_condition, lhs.road_condition,
lhs.source_references) != lhs.source_references) !=
std::tie(rhs.id, std::tie(rhs.id,
rhs.local_id,
rhs.type, rhs.type,
rhs.sub_type, rhs.sub_type,
rhs.centerline, rhs.centerline,
......
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2023, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * Copyright (c) 2023-2024, Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
* Copyright (C) 2023, ANSYS, Inc. * Copyright (C) 2023, ANSYS, Inc.
* *
* This program and the accompanying materials are made * This program and the accompanying materials are made
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#ifndef MAPSDK_MAPAPI_MAP_H #ifndef MAPSDK_MAPAPI_MAP_H
#define MAPSDK_MAPAPI_MAP_H #define MAPSDK_MAPAPI_MAP_H
#include <limits>
#include <memory> #include <memory>
#include <string> #include <string>
#include <vector> #include <vector>
......
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2023, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * Copyright (c) 2023-2024, Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
* Copyright (C) 2023, ANSYS, Inc. * Copyright (C) 2023, ANSYS, Inc.
* *
* This program and the accompanying materials are made * This program and the accompanying materials are made
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#include <gmock/gmock.h> #include <gmock/gmock.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "MapAPI/map.h" #include <limits>
namespace namespace
{ {
...@@ -51,10 +51,11 @@ inline auto CreateLaneBoundary(Identifier id, const units::length::meter_t start ...@@ -51,10 +51,11 @@ inline auto CreateLaneBoundary(Identifier id, const units::length::meter_t start
return std::move(lane_boundary); return std::move(lane_boundary);
} }
inline auto CreateLane(Identifier id, const units::length::meter_t start_x, const units::length::meter_t y_offset) inline auto CreateLane(Identifier id, LocalLaneId local_id, const units::length::meter_t start_x, const units::length::meter_t y_offset)
{ {
auto lane = std::make_unique<Lane>(); auto lane = std::make_unique<Lane>();
lane->id = id; lane->id = id;
lane->local_id = local_id;
lane->type = Lane::Type::kDriving; lane->type = Lane::Type::kDriving;
lane->sub_type = Lane::Subtype::kUnknown; lane->sub_type = Lane::Subtype::kUnknown;
lane->centerline = Lane::Polyline{ lane->centerline = Lane::Polyline{
...@@ -76,10 +77,10 @@ inline Map CreateMapWithConnectedLanes() ...@@ -76,10 +77,10 @@ inline Map CreateMapWithConnectedLanes()
auto lane_boundary_104 = CreateLaneBoundary(104, 1000.0_m, 1.5_m); auto lane_boundary_104 = CreateLaneBoundary(104, 1000.0_m, 1.5_m);
auto lane_boundary_105 = CreateLaneBoundary(105, 1000.0_m, -1.5_m); auto lane_boundary_105 = CreateLaneBoundary(105, 1000.0_m, -1.5_m);
auto lane_0 = CreateLane(0, 0.0_m, 3.0_m); auto lane_0 = CreateLane(0, 4, 0.0_m, 3.0_m);
auto lane_1 = CreateLane(1, 0.0_m, 3.0_m); auto lane_1 = CreateLane(1, 5, 0.0_m, 3.0_m);
auto lane_2 = CreateLane(2, 1000.0_m, 3.0_m); auto lane_2 = CreateLane(2, 6, 1000.0_m, 3.0_m);
auto lane_3 = CreateLane(3, 1000.0_m, 0.0_m); auto lane_3 = CreateLane(3, 7, 1000.0_m, 0.0_m);
lane_0->left_lane_boundaries.push_back(*lane_boundary_100); lane_0->left_lane_boundaries.push_back(*lane_boundary_100);
lane_0->right_lane_boundaries.push_back(*lane_boundary_101); lane_0->right_lane_boundaries.push_back(*lane_boundary_101);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment