CARLA
Toggle main menu visibility
Loading...
Searching...
No Matches
Unreal
CarlaUnreal
Plugins
Carla
Source
Carla
Autoware
Game
AutowareGameModeBase.cpp
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
#include "
Carla/Autoware/Game/AutowareGameModeBase.h
"
8
9
#include "
Carla.h
"
10
#include "
Carla/Autoware/Game/AutowareWorldSettings.h
"
11
#include "
Carla/Game/CarlaEpisode.h
"
12
13
#include <
util/disable-ue4-macros.h
>
14
#include <
carla/geom/GeoProjection.h
>
15
#include <
util/enable-ue4-macros.h
>
16
17
AAutowareGameModeBase::AAutowareGameModeBase
(
const
FObjectInitializer& ObjectInitializer)
18
: Super(ObjectInitializer)
19
{
20
}
21
22
void
AAutowareGameModeBase::InitGame
(
const
FString& MapName,
const
FString& Options, FString& ErrorMessage)
23
{
24
Super::InitGame(MapName, Options, ErrorMessage);
25
}
26
27
void
AAutowareGameModeBase::LoadGeoReference
()
28
{
29
auto
* WS = Cast<AAutowareWorldSettings>(GetWorld()->GetWorldSettings());
30
31
if
(!IsValid(WS))
32
{
33
Super::LoadGeoReference();
// Fallback to ACarlaGameModeBase::LoadGeoReference default
34
return
;
35
}
36
37
UE_LOG(LogCarla, Log, TEXT(
"Autoware Settings fetch succeeded."
));
38
auto
* Data = WS->MgrsDataAssetSoftPtr.LoadSynchronous();
39
40
if
(!IsValid(Data))
41
{
42
return
;
43
}
44
45
// tier4 stored a plain GeoLocation reference on the episode; our branch
46
// migrated the georeference to carla::geom::GeoProjection. A Transverse
47
// Mercator projection centered on the asset's reference point over the
48
// default (spherical) ellipsoid reproduces the legacy GeoLocation::Transform
49
// behavior.
50
Episode
->
MapGeoProjection
=
carla::geom::GeoProjection::Make
(
51
carla::geom::TransverseMercatorParams
(
52
Data->GeoReference.Latitude,
53
Data->GeoReference.Longitude,
54
1.0, 0.0, 0.0,
55
carla::geom::Ellipsoid
()));
56
57
UE_LOG(LogCarla, Log, TEXT(
"MGRS georeference loaded successfully."
));
58
StoreSpawnPoints
();
59
}
AutowareGameModeBase.h
AutowareWorldSettings.h
CarlaEpisode.h
Carla.h
GeoProjection.h
AAutowareGameModeBase::LoadGeoReference
virtual void LoadGeoReference() override
Loads the episode georeference (parsing the map's OpenDRIVE by default) and stores the recommended sp...
Definition
AutowareGameModeBase.cpp:27
AAutowareGameModeBase::InitGame
void InitGame(const FString &MapName, const FString &Options, FString &ErrorMessage) override
Definition
AutowareGameModeBase.cpp:22
AAutowareGameModeBase::AAutowareGameModeBase
AAutowareGameModeBase(const FObjectInitializer &ObjectInitializer)
Definition
AutowareGameModeBase.cpp:17
ACarlaGameModeBase::StoreSpawnPoints
void StoreSpawnPoints()
Definition
CarlaGameModeBase.cpp:634
ACarlaGameModeBase::Episode
UCarlaEpisode * Episode
Definition
CarlaGameModeBase.h:173
UCarlaEpisode::MapGeoProjection
carla::geom::GeoProjection MapGeoProjection
Definition
CarlaEpisode.h:484
carla::geom::Ellipsoid
Definition
GeoProjectionsParams.h:32
carla::geom::TransverseMercatorParams
Definition
GeoProjectionsParams.h:120
disable-ue4-macros.h
enable-ue4-macros.h
carla::geom::GeoProjection::Make
static GeoProjection Make(T &&args)
Definition
GeoProjection.h:46
Generated by
1.18.0