CARLA
Loading...
Searching...
No Matches
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
8
9#include "Carla.h"
12
16
17AAutowareGameModeBase::AAutowareGameModeBase(const FObjectInitializer& ObjectInitializer)
18 : Super(ObjectInitializer)
19{
20}
21
22void AAutowareGameModeBase::InitGame(const FString& MapName, const FString& Options, FString& ErrorMessage)
23{
24 Super::InitGame(MapName, Options, ErrorMessage);
25}
26
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.
52 Data->GeoReference.Latitude,
53 Data->GeoReference.Longitude,
54 1.0, 0.0, 0.0,
56
57 UE_LOG(LogCarla, Log, TEXT("MGRS georeference loaded successfully."));
59}
static bool IsValid(const ACarlaWheeledVehicle *Vehicle)
virtual void LoadGeoReference() override
Loads the episode georeference (parsing the map's OpenDRIVE by default) and stores the recommended sp...
void InitGame(const FString &MapName, const FString &Options, FString &ErrorMessage) override
AAutowareGameModeBase(const FObjectInitializer &ObjectInitializer)
UCarlaEpisode * Episode
carla::geom::GeoProjection MapGeoProjection
static GeoProjection Make(T &&args)