Aaron/digital twins add local file (#7167)
* Added timers to setup.sh for downloading and unzipping * Adding support for local XODRs * Added allowtorendering to generate tile commandlet and make sure it works with local files * Update Changelog * Updated OpenDrive To Map
This commit is contained in:
parent
8430a5c33b
commit
c0abf59983
|
@ -2,6 +2,8 @@
|
|||
* Prevent from segfault on failing SignalReference identification when loading OpenDrive files
|
||||
* Added vehicle doors to the recorder
|
||||
* Added functions to get actor' components transform
|
||||
* Added posibility to Digital Twins to work with local files (osm and xodr)
|
||||
* Enable proper material merging for Building in Digital Twins
|
||||
* Added functions to get actor' bones transforms
|
||||
* Added functions to get actor' bones and components names
|
||||
* Added functions to get actor' sockets transforms
|
||||
|
|
|
@ -1238,7 +1238,11 @@ namespace road {
|
|||
geom::Transform lanetransform = lane->ComputeTransform(s_current);
|
||||
geom::Transform treeTransform(treeposition, lanetransform.rotation);
|
||||
const carla::road::element::RoadInfoSpeed* roadinfo = lane->GetInfo<carla::road::element::RoadInfoSpeed>(s_current);
|
||||
transforms.push_back(std::make_pair(treeTransform,roadinfo->GetType()));
|
||||
if(roadinfo){
|
||||
transforms.push_back(std::make_pair(treeTransform, roadinfo->GetType()));
|
||||
}else{
|
||||
transforms.push_back(std::make_pair(treeTransform, "urban"));
|
||||
}
|
||||
}
|
||||
s_current += distancebetweentrees;
|
||||
}
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -154,6 +154,8 @@ void UOpenDriveToMap::CreateMap()
|
|||
UE_LOG(LogCarlaToolsMapGenerator, Error, TEXT("Map Name Is Empty") );
|
||||
return;
|
||||
}
|
||||
|
||||
if( !Url.IsEmpty() ) {
|
||||
if ( !IsValid(FileDownloader) )
|
||||
{
|
||||
FileDownloader = NewObject<UCustomFileDownloader>();
|
||||
|
@ -164,6 +166,20 @@ void UOpenDriveToMap::CreateMap()
|
|||
|
||||
FileDownloader->DownloadDelegate.BindUObject( this, &UOpenDriveToMap::ConvertOSMInOpenDrive );
|
||||
FileDownloader->StartDownload();
|
||||
}
|
||||
else if(LocalFilePath.EndsWith(".xodr"))
|
||||
{
|
||||
ImportXODR();
|
||||
}
|
||||
else if(LocalFilePath.EndsWith(".osm"))
|
||||
{
|
||||
ImportOSM();
|
||||
}
|
||||
else
|
||||
{
|
||||
UE_LOG(LogCarlaToolsMapGenerator, Error, TEXT("URL and Local FilePath are Empty. URL: %s Local FilePath: %s"), *Url, *LocalFilePath );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void UOpenDriveToMap::CreateTerrain( const int MeshGridSize, const float MeshGridSectionSize)
|
||||
|
@ -490,7 +506,7 @@ void UOpenDriveToMap::GenerateAll(const boost::optional<carla::road::Map>& Param
|
|||
{
|
||||
GenerateRoadMesh(ParamCarlaMap, MinLocation, MaxLocation);
|
||||
GenerateLaneMarks(ParamCarlaMap, MinLocation, MaxLocation);
|
||||
//GenerateSpawnPoints(ParamCarlaMap);
|
||||
GenerateSpawnPoints(ParamCarlaMap, MinLocation, MaxLocation);
|
||||
CreateTerrain(12800, 256);
|
||||
GenerateTreePositions(ParamCarlaMap, MinLocation, MaxLocation);
|
||||
GenerationFinished(MinLocation, MaxLocation);
|
||||
|
@ -714,11 +730,15 @@ void UOpenDriveToMap::GenerateSpawnPoints( const boost::optional<carla::road::Ma
|
|||
for (const auto &Wp : Waypoints)
|
||||
{
|
||||
const FTransform Trans = ParamCarlaMap->ComputeTransform(Wp);
|
||||
if( Trans.GetLocation().X >= MinLocation.X && Trans.GetLocation().Y >= MinLocation.Y &&
|
||||
Trans.GetLocation().X <= MaxLocation.X && Trans.GetLocation().Y <= MaxLocation.Y)
|
||||
{
|
||||
AVehicleSpawnPoint *Spawner = UEditorLevelLibrary::GetEditorWorld()->SpawnActor<AVehicleSpawnPoint>();
|
||||
Spawner->SetActorRotation(Trans.GetRotation());
|
||||
Spawner->SetActorLocation(Trans.GetTranslation() + FVector(0.f, 0.f, SpawnersHeight));
|
||||
ActorsToMove.Add(Spawner);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UOpenDriveToMap::GenerateTreePositions( const boost::optional<carla::road::Map>& ParamCarlaMap, FVector MinLocation, FVector MaxLocation )
|
||||
|
@ -878,6 +898,41 @@ bool UOpenDriveToMap::IsInRoad(
|
|||
return false;
|
||||
}
|
||||
|
||||
void UOpenDriveToMap::ImportXODR(){
|
||||
IPlatformFile& FileManager = FPlatformFileManager::Get().GetPlatformFile();
|
||||
FString MyFileDestination = FPaths::ProjectContentDir() + "CustomMaps/" + MapName + "/OpenDrive/" + MapName + ".xodr";
|
||||
|
||||
if(FileManager.CopyFile( *MyFileDestination, *LocalFilePath,
|
||||
EPlatformFileRead::None,
|
||||
EPlatformFileWrite::None))
|
||||
{
|
||||
UE_LOG(LogCarlaToolsMapGenerator, Verbose, TEXT("FilePaths: File Copied!"));
|
||||
FilePath = MyFileDestination;
|
||||
LoadMap();
|
||||
}
|
||||
else
|
||||
{
|
||||
UE_LOG(LogCarlaToolsMapGenerator, Error, TEXT("FilePaths local xodr file not copied: File not Copied!"));
|
||||
}
|
||||
}
|
||||
|
||||
void UOpenDriveToMap::ImportOSM(){
|
||||
IPlatformFile& FileManager = FPlatformFileManager::Get().GetPlatformFile();
|
||||
FString MyFileDestination = FPaths::ProjectContentDir() + "CustomMaps/" + MapName + "/OpenDrive/" + MapName + ".osm";
|
||||
|
||||
if(FileManager.CopyFile( *MyFileDestination, *LocalFilePath,
|
||||
EPlatformFileRead::None,
|
||||
EPlatformFileWrite::None))
|
||||
{
|
||||
UE_LOG(LogCarlaToolsMapGenerator, Verbose, TEXT("FilePaths: File Copied!"));
|
||||
ConvertOSMInOpenDrive();
|
||||
}
|
||||
else
|
||||
{
|
||||
UE_LOG(LogCarlaToolsMapGenerator, Error, TEXT("FilePaths local osm file not copied: File not Copied!"));
|
||||
}
|
||||
}
|
||||
|
||||
void UOpenDriveToMap::MoveActorsToSubLevels(TArray<AActor*> ActorsToMove)
|
||||
{
|
||||
AActor* QueryActor = UGameplayStatics::GetActorOfClass(
|
||||
|
|
|
@ -91,6 +91,9 @@ public:
|
|||
UPROPERTY( EditAnywhere, BlueprintReadWrite, Category="Settings" )
|
||||
FString Url;
|
||||
|
||||
UPROPERTY( EditAnywhere, BlueprintReadWrite, Category="Settings" )
|
||||
FString LocalFilePath;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Settings")
|
||||
FVector2D OriginGeoCoordinates;
|
||||
|
||||
|
@ -213,6 +216,9 @@ private:
|
|||
|
||||
void InitTextureData();
|
||||
|
||||
void ImportXODR();
|
||||
void ImportOSM();
|
||||
|
||||
UPROPERTY()
|
||||
UCustomFileDownloader* FileDownloader;
|
||||
UPROPERTY()
|
||||
|
|
Loading…
Reference in New Issue