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

feat: Add local id member in lane data structure

parent 46a43e64
No related branches found
No related tags found
1 merge request!7Add local id member in lane data structure
.cache/
.clwb/
.vscode/
bazel-*
build/
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.
*
* This program and the accompanying materials are made
......@@ -13,6 +13,7 @@
#define MAPSDK_MAPAPI_COMMON_IDENTIFIER_H
#include <cstdint>
#include <limits>
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.
*
* This program and the accompanying materials are made
......@@ -12,6 +12,7 @@
#ifndef MAPSDK_MAPAPI_LANE_H
#define MAPSDK_MAPAPI_LANE_H
#include <limits>
#include <vector>
#include "Common/common.h"
......@@ -19,6 +20,9 @@
namespace map_api
{
using LocalLaneId = std::int64_t;
constexpr LocalLaneId UndefinedLocalLaneId{std::numeric_limits<LocalLaneId>::max()};
struct Lane;
struct RoadCondition
......@@ -80,6 +84,7 @@ struct Lane
};
Identifier id{UndefinedId};
LocalLaneId local_id{UndefinedLocalLaneId};
Type type;
Subtype sub_type;
......@@ -145,6 +150,7 @@ inline bool ShallowVectorLaneComparison(const std::vector<Lane>& lhs, const std:
inline bool operator==(const Lane& lhs, const Lane& rhs) noexcept
{
if (std::tie(lhs.id,
lhs.local_id,
lhs.type,
lhs.sub_type,
lhs.centerline,
......@@ -154,6 +160,7 @@ inline bool operator==(const Lane& lhs, const Lane& rhs) noexcept
lhs.road_condition,
lhs.source_references) !=
std::tie(rhs.id,
rhs.local_id,
rhs.type,
rhs.sub_type,
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.
*
* This program and the accompanying materials are made
......@@ -12,6 +12,7 @@
#ifndef MAPSDK_MAPAPI_MAP_H
#define MAPSDK_MAPAPI_MAP_H
#include <limits>
#include <memory>
#include <string>
#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.
*
* This program and the accompanying materials are made
......@@ -14,7 +14,7 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "MapAPI/map.h"
#include <limits>
namespace
{
......@@ -51,10 +51,11 @@ inline auto CreateLaneBoundary(Identifier id, const units::length::meter_t start
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>();
lane->id = id;
lane->local_id = local_id;
lane->type = Lane::Type::kDriving;
lane->sub_type = Lane::Subtype::kUnknown;
lane->centerline = Lane::Polyline{
......@@ -76,10 +77,10 @@ inline Map CreateMapWithConnectedLanes()
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_0 = CreateLane(0, 0.0_m, 3.0_m);
auto lane_1 = CreateLane(1, 0.0_m, 3.0_m);
auto lane_2 = CreateLane(2, 1000.0_m, 3.0_m);
auto lane_3 = CreateLane(3, 1000.0_m, 0.0_m);
auto lane_0 = CreateLane(0, 4, 0.0_m, 3.0_m);
auto lane_1 = CreateLane(1, 5, 0.0_m, 3.0_m);
auto lane_2 = CreateLane(2, 6, 1000.0_m, 3.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->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