From 4617dc73f3e66671f8958a68c791e7d020297bcf Mon Sep 17 00:00:00 2001 From: Axel Date: Thu, 24 Nov 2022 16:37:14 +0100 Subject: [PATCH] Fix compilation error. Added rider tag to drivers --- .../Carla/Source/Carla/Game/Tagger.cpp | 25 +++++++++++++++---- .../Source/Carla/Util/ObjectRegister.cpp | 3 ++- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Game/Tagger.cpp b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Game/Tagger.cpp index 0b9755c63..3ee8c1ac5 100644 --- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Game/Tagger.cpp +++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Game/Tagger.cpp @@ -49,8 +49,8 @@ crp::CityObjectLabel ATagger::GetLabelByFolderName(const FString &String) { else if (String == "Truck") return crp::CityObjectLabel::Truck; else if (String == "Motorcycle") return crp::CityObjectLabel::Motorcycle; else if (String == "Bicycle") return crp::CityObjectLabel::Bicycle; - else if (String == "Bus") return crp::CityObjectLebel::Bus; - else if (String == "Rider") return crp::CityObjectLebel::Rider; + else if (String == "Bus") return crp::CityObjectLabel::Bus; + else if (String == "Rider") return crp::CityObjectLabel::Rider; else return crp::CityObjectLabel::None; } @@ -68,7 +68,12 @@ bool ATagger::IsThing(const crp::CityObjectLabel &Label) { return (Label == crp::CityObjectLabel::Pedestrians || Label == crp::CityObjectLabel::TrafficSigns || - Label == crp::CityObjectLabel::Vehicles || + Label == crp::CityObjectLabel::Car || + Label == crp::CityObjectLabel::Bicycle || + Label == crp::CityObjectLabel::Motorcycle || + Label == crp::CityObjectLabel::Bus || + Label == crp::CityObjectLabel::Rider || + Label == crp::CityObjectLabel::Truck || Label == crp::CityObjectLabel::TrafficLight); } @@ -102,7 +107,12 @@ void ATagger::TagActor(const AActor &Actor, bool bTagForSemanticSegmentation) TArray StaticMeshComponents; Actor.GetComponents(StaticMeshComponents); for (UStaticMeshComponent *Component : StaticMeshComponents) { - const auto Label = GetLabelByPath(Component->GetStaticMesh()); + auto Label = GetLabelByPath(Component->GetStaticMesh()); + if (Label == crp::CityObjectLabel::Pedestrians && + Cast(&Actor)) + { + Label = crp::CityObjectLabel::Rider; + } SetStencilValue(*Component, Label, bTagForSemanticSegmentation); #ifdef CARLA_TAGGER_EXTRA_LOG UE_LOG(LogCarla, Log, TEXT(" + StaticMeshComponent: %s"), *Component->GetName()); @@ -152,7 +162,12 @@ void ATagger::TagActor(const AActor &Actor, bool bTagForSemanticSegmentation) TArray SkeletalMeshComponents; Actor.GetComponents(SkeletalMeshComponents); for (USkeletalMeshComponent *Component : SkeletalMeshComponents) { - const auto Label = GetLabelByPath(Component->GetPhysicsAsset()); + auto Label = GetLabelByPath(Component->GetPhysicsAsset()); + if (Label == crp::CityObjectLabel::Pedestrians && + Cast(&Actor)) + { + Label = crp::CityObjectLabel::Rider; + } SetStencilValue(*Component, Label, bTagForSemanticSegmentation); #ifdef CARLA_TAGGER_EXTRA_LOG UE_LOG(LogCarla, Log, TEXT(" + SkeletalMeshComponent: %s"), *Component->GetName()); diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Util/ObjectRegister.cpp b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Util/ObjectRegister.cpp index eaef6d6c2..14a7a045e 100644 --- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Util/ObjectRegister.cpp +++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Util/ObjectRegister.cpp @@ -152,7 +152,8 @@ void UObjectRegister::RegisterVehicle(ACarlaWheeledVehicle* Vehicle) { check(Vehicle); FBoundingBox BB = UBoundingBoxCalculator::GetVehicleBoundingBox(Vehicle); - RegisterEnvironmentObject(Vehicle, BB, EnvironmentObjectType::Vehicle, static_cast(crp::CityObjectLabel::Vehicles)); + auto Tag = ATagger::GetTagOfTaggedComponent(*Vehicle->GetMesh()); + RegisterEnvironmentObject(Vehicle, BB, EnvironmentObjectType::Vehicle, static_cast(Tag)); } void UObjectRegister::RegisterCharacter(ACharacter* Character)