Fix compilation error. Added rider tag to drivers

This commit is contained in:
Axel 2022-11-24 16:37:14 +01:00 committed by bernat
parent d4c1bfc672
commit 4617dc73f3
2 changed files with 22 additions and 6 deletions

View File

@ -49,8 +49,8 @@ crp::CityObjectLabel ATagger::GetLabelByFolderName(const FString &String) {
else if (String == "Truck") return crp::CityObjectLabel::Truck; else if (String == "Truck") return crp::CityObjectLabel::Truck;
else if (String == "Motorcycle") return crp::CityObjectLabel::Motorcycle; else if (String == "Motorcycle") return crp::CityObjectLabel::Motorcycle;
else if (String == "Bicycle") return crp::CityObjectLabel::Bicycle; else if (String == "Bicycle") return crp::CityObjectLabel::Bicycle;
else if (String == "Bus") return crp::CityObjectLebel::Bus; else if (String == "Bus") return crp::CityObjectLabel::Bus;
else if (String == "Rider") return crp::CityObjectLebel::Rider; else if (String == "Rider") return crp::CityObjectLabel::Rider;
else return crp::CityObjectLabel::None; else return crp::CityObjectLabel::None;
} }
@ -68,7 +68,12 @@ bool ATagger::IsThing(const crp::CityObjectLabel &Label)
{ {
return (Label == crp::CityObjectLabel::Pedestrians || return (Label == crp::CityObjectLabel::Pedestrians ||
Label == crp::CityObjectLabel::TrafficSigns || 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); Label == crp::CityObjectLabel::TrafficLight);
} }
@ -102,7 +107,12 @@ void ATagger::TagActor(const AActor &Actor, bool bTagForSemanticSegmentation)
TArray<UStaticMeshComponent *> StaticMeshComponents; TArray<UStaticMeshComponent *> StaticMeshComponents;
Actor.GetComponents<UStaticMeshComponent>(StaticMeshComponents); Actor.GetComponents<UStaticMeshComponent>(StaticMeshComponents);
for (UStaticMeshComponent *Component : StaticMeshComponents) { for (UStaticMeshComponent *Component : StaticMeshComponents) {
const auto Label = GetLabelByPath(Component->GetStaticMesh()); auto Label = GetLabelByPath(Component->GetStaticMesh());
if (Label == crp::CityObjectLabel::Pedestrians &&
Cast<ACarlaWheeledVehicle>(&Actor))
{
Label = crp::CityObjectLabel::Rider;
}
SetStencilValue(*Component, Label, bTagForSemanticSegmentation); SetStencilValue(*Component, Label, bTagForSemanticSegmentation);
#ifdef CARLA_TAGGER_EXTRA_LOG #ifdef CARLA_TAGGER_EXTRA_LOG
UE_LOG(LogCarla, Log, TEXT(" + StaticMeshComponent: %s"), *Component->GetName()); UE_LOG(LogCarla, Log, TEXT(" + StaticMeshComponent: %s"), *Component->GetName());
@ -152,7 +162,12 @@ void ATagger::TagActor(const AActor &Actor, bool bTagForSemanticSegmentation)
TArray<USkeletalMeshComponent *> SkeletalMeshComponents; TArray<USkeletalMeshComponent *> SkeletalMeshComponents;
Actor.GetComponents<USkeletalMeshComponent>(SkeletalMeshComponents); Actor.GetComponents<USkeletalMeshComponent>(SkeletalMeshComponents);
for (USkeletalMeshComponent *Component : SkeletalMeshComponents) { for (USkeletalMeshComponent *Component : SkeletalMeshComponents) {
const auto Label = GetLabelByPath(Component->GetPhysicsAsset()); auto Label = GetLabelByPath(Component->GetPhysicsAsset());
if (Label == crp::CityObjectLabel::Pedestrians &&
Cast<ACarlaWheeledVehicle>(&Actor))
{
Label = crp::CityObjectLabel::Rider;
}
SetStencilValue(*Component, Label, bTagForSemanticSegmentation); SetStencilValue(*Component, Label, bTagForSemanticSegmentation);
#ifdef CARLA_TAGGER_EXTRA_LOG #ifdef CARLA_TAGGER_EXTRA_LOG
UE_LOG(LogCarla, Log, TEXT(" + SkeletalMeshComponent: %s"), *Component->GetName()); UE_LOG(LogCarla, Log, TEXT(" + SkeletalMeshComponent: %s"), *Component->GetName());

View File

@ -152,7 +152,8 @@ void UObjectRegister::RegisterVehicle(ACarlaWheeledVehicle* Vehicle)
{ {
check(Vehicle); check(Vehicle);
FBoundingBox BB = UBoundingBoxCalculator::GetVehicleBoundingBox(Vehicle); FBoundingBox BB = UBoundingBoxCalculator::GetVehicleBoundingBox(Vehicle);
RegisterEnvironmentObject(Vehicle, BB, EnvironmentObjectType::Vehicle, static_cast<uint8>(crp::CityObjectLabel::Vehicles)); auto Tag = ATagger::GetTagOfTaggedComponent(*Vehicle->GetMesh());
RegisterEnvironmentObject(Vehicle, BB, EnvironmentObjectType::Vehicle, static_cast<uint8>(Tag));
} }
void UObjectRegister::RegisterCharacter(ACharacter* Character) void UObjectRegister::RegisterCharacter(ACharacter* Character)