CARLA
Toggle main menu visibility
Loading...
Searching...
No Matches
LibCarla
source
osm2odr
Profiles.h
Go to the documentation of this file.
1
// Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma
2
// de Barcelona (UAB).
3
//
4
// This work is licensed under the terms of the MIT license.
5
// For a copy, see <https://opensource.org/licenses/MIT>.
6
7
#pragma once
8
9
#include <optional>
10
#include <string>
11
12
#include "
Model.h
"
13
14
namespace
twinmodel
{
15
16
/// Per highway class defaults, ported from profiles.py's _EU_CLASSES. The
17
/// urban classes sit at 3.5-3.6 m because CARLA's fire truck is 2.90 m wide.
18
struct
ClassDefaults
{
19
double
lane_width
= 3.5;
20
int
lanes
= 2;
21
std::optional<double>
sidewalk_width
;
22
std::optional<double>
shoulder
;
23
std::optional<double>
shoulder_inner
;
24
};
25
26
/// The lane layout an OSM way resolves to, before it is cut at junctions.
27
struct
LaneProfile
{
28
int
forward_lanes
= 1;
29
int
backward_lanes
= 1;
30
double
lane_width
= 3.5;
31
std::optional<double>
sidewalk_width
;
32
std::optional<double>
shoulder
;
33
std::optional<double>
shoulder_inner
;
34
std::optional<double>
speed_limit
;
35
bool
oneway
=
false
;
36
};
37
38
/// True when the way carries motor traffic and should become a Road.
39
bool
IsDrivable
(
const
std::string &highway);
40
41
const
ClassDefaults
*
FindClassDefaults
(
const
std::string &highway);
42
43
/// Resolve the lane layout from the way's tags, falling back to the class
44
/// defaults. Honours lanes, lanes:forward/backward, oneway, width, maxspeed.
45
LaneProfile
ResolveProfile
(
const
std::string &highway,
const
Tags
&tags);
46
47
/// Parse an OSM maxspeed value into m/s; "50", "50 km/h" and "30 mph".
48
std::optional<double>
ParseMaxSpeed
(
const
std::string &value);
49
50
}
// namespace twinmodel
Model.h
twinmodel
Definition
Frame.cpp:12
twinmodel::ParseMaxSpeed
std::optional< double > ParseMaxSpeed(const std::string &value)
Parse an OSM maxspeed value into m/s; "50", "50 km/h" and "30 mph".
Definition
Profiles.cpp:84
twinmodel::Tags
std::map< std::string, std::string > Tags
Definition
Model.h:18
twinmodel::ResolveProfile
LaneProfile ResolveProfile(const std::string &highway, const Tags &tags)
Resolve the lane layout from the way's tags, falling back to the class defaults.
Definition
Profiles.cpp:96
twinmodel::IsDrivable
bool IsDrivable(const std::string &highway)
True when the way carries motor traffic and should become a Road.
Definition
Profiles.cpp:70
twinmodel::FindClassDefaults
const ClassDefaults * FindClassDefaults(const std::string &highway)
Definition
Profiles.cpp:78
twinmodel::ClassDefaults
Per highway class defaults, ported from profiles.py's _EU_CLASSES.
Definition
Profiles.h:18
twinmodel::ClassDefaults::lanes
int lanes
Definition
Profiles.h:20
twinmodel::ClassDefaults::shoulder
std::optional< double > shoulder
Definition
Profiles.h:22
twinmodel::ClassDefaults::sidewalk_width
std::optional< double > sidewalk_width
Definition
Profiles.h:21
twinmodel::ClassDefaults::shoulder_inner
std::optional< double > shoulder_inner
Definition
Profiles.h:23
twinmodel::ClassDefaults::lane_width
double lane_width
Definition
Profiles.h:19
twinmodel::LaneProfile
The lane layout an OSM way resolves to, before it is cut at junctions.
Definition
Profiles.h:27
twinmodel::LaneProfile::oneway
bool oneway
Definition
Profiles.h:35
twinmodel::LaneProfile::speed_limit
std::optional< double > speed_limit
Definition
Profiles.h:34
twinmodel::LaneProfile::backward_lanes
int backward_lanes
Definition
Profiles.h:29
twinmodel::LaneProfile::shoulder_inner
std::optional< double > shoulder_inner
Definition
Profiles.h:33
twinmodel::LaneProfile::sidewalk_width
std::optional< double > sidewalk_width
Definition
Profiles.h:31
twinmodel::LaneProfile::shoulder
std::optional< double > shoulder
Definition
Profiles.h:32
twinmodel::LaneProfile::forward_lanes
int forward_lanes
Definition
Profiles.h:28
twinmodel::LaneProfile::lane_width
double lane_width
Definition
Profiles.h:30
Generated by
1.18.0