CARLA
Toggle main menu visibility
Loading...
Searching...
No Matches
LibCarla
source
osm2odr
OSM2ODR.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 <string>
10
#include <vector>
11
12
namespace
osm2odr
{
13
14
struct
OSM2ODRSettings
{
15
// Subtract the offset below from every projected coordinate.
16
bool
use_offsets
=
false
;
17
double
offset_x
= 0.0;
18
double
offset_y
= 0.0;
19
20
// Width of a driving lane, in metres. 0 keeps the converter's own table,
21
// which picks a width per highway type.
22
double
default_lane_width
= 0.0;
23
24
// Width of the sidewalk lane added to a way whose OSM tags declare one.
25
// 0 adds none.
26
double
default_sidewalk_width
= 0.0;
27
28
// Height one OSM layer is raised by, so a bridge clears what it crosses.
29
double
elevation_layer_height
= 0.0;
30
31
// Projection written as the <geoReference> of the OpenDRIVE header. A
32
// +lat_0/+lon_0 in it also becomes the origin of the local projection.
33
std::string
proj_string
=
"+proj=tmerc"
;
34
35
// Put the origin at the centre of the bounding box instead of its north
36
// west corner. CARLA's map generation expects the corner.
37
bool
center_map
=
false
;
38
39
// Emit a traffic light at junctions OSM tags highway=traffic_signals, or
40
// at every junction.
41
bool
generate_traffic_lights
=
false
;
42
bool
all_junctions_traffic_lights
=
false
;
43
44
// OSM highway types to keep. Empty keeps the converter's own drivable set.
45
std::vector<std::string>
osm_highways_types
;
46
47
// Highway types that get no traffic light even when one is generated.
48
std::vector<std::string>
tl_excluded_highways_types
;
49
};
50
51
// Convert the contents of an OSM XML file to an OpenDRIVE description.
52
// Throws std::runtime_error when the input cannot be parsed.
53
std::string
ConvertOSMToOpenDRIVE
(
54
std::string osm_file,
55
OSM2ODRSettings
settings =
OSM2ODRSettings
());
56
57
}
// namespace osm2odr
osm2odr
Definition
OSM2ODR.cpp:21
osm2odr::ConvertOSMToOpenDRIVE
std::string ConvertOSMToOpenDRIVE(std::string osm_file, OSM2ODRSettings settings)
Definition
OSM2ODR.cpp:55
osm2odr::OSM2ODRSettings
Definition
OSM2ODR.h:14
osm2odr::OSM2ODRSettings::proj_string
std::string proj_string
Definition
OSM2ODR.h:33
osm2odr::OSM2ODRSettings::osm_highways_types
std::vector< std::string > osm_highways_types
Definition
OSM2ODR.h:45
osm2odr::OSM2ODRSettings::all_junctions_traffic_lights
bool all_junctions_traffic_lights
Definition
OSM2ODR.h:42
osm2odr::OSM2ODRSettings::use_offsets
bool use_offsets
Definition
OSM2ODR.h:16
osm2odr::OSM2ODRSettings::elevation_layer_height
double elevation_layer_height
Definition
OSM2ODR.h:29
osm2odr::OSM2ODRSettings::default_lane_width
double default_lane_width
Definition
OSM2ODR.h:22
osm2odr::OSM2ODRSettings::offset_y
double offset_y
Definition
OSM2ODR.h:18
osm2odr::OSM2ODRSettings::default_sidewalk_width
double default_sidewalk_width
Definition
OSM2ODR.h:26
osm2odr::OSM2ODRSettings::generate_traffic_lights
bool generate_traffic_lights
Definition
OSM2ODR.h:41
osm2odr::OSM2ODRSettings::tl_excluded_highways_types
std::vector< std::string > tl_excluded_highways_types
Definition
OSM2ODR.h:48
osm2odr::OSM2ODRSettings::offset_x
double offset_x
Definition
OSM2ODR.h:17
osm2odr::OSM2ODRSettings::center_map
bool center_map
Definition
OSM2ODR.h:37
Generated by
1.18.0