26 bool AreValid(
const TArray<FActorDefinition> &ActorDefinitions)
28 return AreValid(TEXT(
"Actor Definition"), ActorDefinitions);
34 auto ScopeText = FString::Printf(TEXT(
"[Actor Definition : %s]"), *Definition.
Id);
43 template <
typename T,
typename ... ARGS>
54 Message += FString::Printf(Format, std::forward<ARGS>(Args) ...);
56 UE_LOG(LogCarla, Error, TEXT(
"%s"), *Message);
60 GEngine->AddOnScreenDebugMessage(42, 15.0f, FColor::Red, Message);
68 FString
GetDisplayId(
const FString &Type,
size_t Index,
const T &Item)
70 return FString::Printf(TEXT(
"[%s %d : %s]"), *Type, Index, *Item.Id);
73 FString
GetDisplayId(
const FString &Type,
size_t Index,
const FString &Item)
75 return FString::Printf(TEXT(
"[%s %d : %s]"), *Type, Index, *Item);
80 template <
typename T,
typename F>
81 bool ForEach(
const FString &Type,
const TArray<T> &Array, F Validator)
85 for (
const auto &Item : Array)
88 Result &= Validator(Item);
97 bool AreValid(
const FString &Type,
const TArray<T> &Array)
99 return ForEach(Type, Array, [
this](
const auto &Item) {
return IsValid(Item); });
105 return OnScreenAssert((!Id.IsEmpty() && Id != TEXT(
".")), TEXT(
"Id cannot be empty"));
111 return OnScreenAssert(!Tags.IsEmpty(), TEXT(
"Tags cannot be empty"));
158 template <
typename ... ARGS>
159 static FString
JoinStrings(
const FString &Separator, ARGS && ... Args)
161 return FString::Join(TArray<FString>{std::forward<ARGS>(Args) ...}, *Separator);
168 FString::FromInt(Color.R),
169 FString::FromInt(Color.G),
170 FString::FromInt(Color.B));
186 return Validator.
AreValid(ActorDefinitions);
193 template <
typename ... TStrs>
196 Def.
Id =
JoinStrings(TEXT(
"."), std::forward<TStrs>(Strings) ...).ToLower();
197 Def.
Tags =
JoinStrings(TEXT(
","), std::forward<TStrs>(Strings) ...).ToLower();
201 ActorRole.
Id = TEXT(
"role_name");
209 Var.
Id = TEXT(
"ros_name");
218 TArray<FString> &&RecommendedValues)
220 for (
auto &&ActorVariation: Definition.
Variations)
222 if (ActorVariation.Id ==
"role_name")
224 ActorVariation.RecommendedValues = RecommendedValues;
233 "right"), TEXT(
"front_left"), TEXT(
"front_right"), TEXT(
"back_left"), TEXT(
"back_right")});
240 Tick.
Id = TEXT(
"sensor_tick");
252 Friction.
Id = FString(
"friction");
259 FString Extent(
"extent");
260 FString Coordinates[3] = {FString(
"x"), FString(
"y"), FString(
"z")};
262 for (
auto Coordinate : Coordinates)
266 ExtentCoordinate.
Id =
JoinStrings(TEXT(
"_"), Extent, Coordinate);
276 const FString &Category,
289 auto Definition = MakeGenericDefinition(TEXT(
"sensor"), Type, Id);
296 const bool bEnableModifyingPostProcessEffects)
300 MakeCameraDefinition(Id, bEnableModifyingPostProcessEffects, Success, Definition);
307 const bool bEnableModifyingPostProcessEffects,
311 FillIdAndTags(Definition, TEXT(
"sensor"), TEXT(
"camera"), Id);
317 FOV.
Id = TEXT(
"fov");
324 ResX.
Id = TEXT(
"image_size_x");
330 ResY.
Id = TEXT(
"image_size_y");
337 LensCircleFalloff.
Id = TEXT(
"lens_circle_falloff");
343 LensCircleMultiplier.
Id = TEXT(
"lens_circle_multiplier");
349 LensK.
Id = TEXT(
"lens_k");
355 LensKcube.
Id = TEXT(
"lens_kcube");
361 LensXSize.
Id = TEXT(
"lens_x_size");
367 LensYSize.
Id = TEXT(
"lens_y_size");
377 LensCircleMultiplier,
383 if (bEnableModifyingPostProcessEffects)
386 PostProccess.
Id = TEXT(
"enable_postprocess_effects");
393 Gamma.
Id = TEXT(
"gamma");
400 MBIntesity.
Id = TEXT(
"motion_blur_intensity");
406 MBMaxDistortion.
Id = TEXT(
"motion_blur_max_distortion");
412 MBMinObjectScreenSize.
Id = TEXT(
"motion_blur_min_object_screen_size");
419 LensFlareIntensity.
Id = TEXT(
"lens_flare_intensity");
426 BloomIntensity.
Id = TEXT(
"bloom_intensity");
438 ExposureMode.
Id = TEXT(
"exposure_mode");
451 ExposureCompensation.
Id = TEXT(
"exposure_compensation");
463 ShutterSpeed.
Id = TEXT(
"shutter_speed");
470 ISO.
Id = TEXT(
"iso");
478 Aperture.
Id = TEXT(
"fstop");
488 ExposureMinBright.
Id = TEXT(
"exposure_min_bright");
496 ExposureMaxBright.
Id = TEXT(
"exposure_max_bright");
504 ExposureSpeedUp.
Id = TEXT(
"exposure_speed_up");
512 ExposureSpeedDown.
Id = TEXT(
"exposure_speed_down");
519 CalibrationConstant.
Id = TEXT(
"calibration_constant");
527 FocalDistance.
Id = TEXT(
"focal_distance");
534 DepthBlurAmount.
Id = TEXT(
"blur_amount");
541 DepthBlurRadius.
Id = TEXT(
"blur_radius");
550 MaxAperture.
Id = TEXT(
"min_fstop");
558 BladeCount.
Id = TEXT(
"blade_count");
567 FilmSlope.
Id = TEXT(
"slope");
573 FilmToe.
Id = TEXT(
"toe");
579 FilmShoulder.
Id = TEXT(
"shoulder");
585 FilmBlackClip.
Id = TEXT(
"black_clip");
591 FilmWhiteClip.
Id = TEXT(
"white_clip");
598 Temperature.
Id = TEXT(
"temp");
604 Tint.
Id = TEXT(
"tint");
610 ChromaticIntensity.
Id = TEXT(
"chromatic_aberration_intensity");
616 ChromaticOffset.
Id = TEXT(
"chromatic_aberration_offset");
623 ExposureCompensation,
633 MBMinObjectScreenSize,
655 Success = CheckActorDefinition(Definition);
662 MakeNormalsCameraDefinition(Success, Definition);
669 FillIdAndTags(Definition, TEXT(
"sensor"), TEXT(
"camera"), TEXT(
"normals"));
675 FOV.
Id = TEXT(
"fov");
682 ResX.
Id = TEXT(
"image_size_x");
688 ResY.
Id = TEXT(
"image_size_y");
695 LensCircleFalloff.
Id = TEXT(
"lens_circle_falloff");
701 LensCircleMultiplier.
Id = TEXT(
"lens_circle_multiplier");
707 LensK.
Id = TEXT(
"lens_k");
713 LensKcube.
Id = TEXT(
"lens_kcube");
719 LensXSize.
Id = TEXT(
"lens_x_size");
725 LensYSize.
Id = TEXT(
"lens_y_size");
735 LensCircleMultiplier,
741 Success = CheckActorDefinition(Definition);
748 MakeIMUDefinition(Success, Definition);
757 FillIdAndTags(Definition, TEXT(
"sensor"), TEXT(
"other"), TEXT(
"imu"));
762 NoiseSeed.
Id = TEXT(
"noise_seed");
770 StdDevAccelX.
Id = TEXT(
"noise_accel_stddev_x");
776 StdDevAccelY.
Id = TEXT(
"noise_accel_stddev_y");
782 StdDevAccelZ.
Id = TEXT(
"noise_accel_stddev_z");
790 StdDevGyroX.
Id = TEXT(
"noise_gyro_stddev_x");
796 StdDevGyroY.
Id = TEXT(
"noise_gyro_stddev_y");
802 StdDevGyroZ.
Id = TEXT(
"noise_gyro_stddev_z");
810 BiasGyroX.
Id = TEXT(
"noise_gyro_bias_x");
816 BiasGyroY.
Id = TEXT(
"noise_gyro_bias_y");
822 BiasGyroZ.
Id = TEXT(
"noise_gyro_bias_z");
839 Success = CheckActorDefinition(Definition);
846 MakeRadarDefinition(Success, Definition);
855 FillIdAndTags(Definition, TEXT(
"sensor"), TEXT(
"other"), TEXT(
"radar"));
859 HorizontalFOV.
Id = TEXT(
"horizontal_fov");
865 VerticalFOV.
Id = TEXT(
"vertical_fov");
871 Range.
Id = TEXT(
"range");
877 PointsPerSecond.
Id = TEXT(
"points_per_second");
884 NoiseSeed.
Id = TEXT(
"noise_seed");
896 Success = CheckActorDefinition(Definition);
904 MakeLidarDefinition(Id, Success, Definition);
914 FillIdAndTags(Definition, TEXT(
"sensor"), TEXT(
"lidar"), Id);
919 Channels.
Id = TEXT(
"channels");
924 Range.
Id = TEXT(
"range");
929 PointsPerSecond.
Id = TEXT(
"points_per_second");
934 Frequency.
Id = TEXT(
"rotation_frequency");
939 UpperFOV.
Id = TEXT(
"upper_fov");
944 LowerFOV.
Id = TEXT(
"lower_fov");
949 HorizontalFOV.
Id = TEXT(
"horizontal_fov");
954 AtmospAttenRate.
Id = TEXT(
"atmosphere_attenuation_rate");
959 NoiseSeed.
Id = TEXT(
"noise_seed");
965 DropOffGenRate.
Id = TEXT(
"dropoff_general_rate");
970 DropOffIntensityLimit.
Id = TEXT(
"dropoff_intensity_limit");
975 DropOffAtZeroIntensity.
Id = TEXT(
"dropoff_zero_intensity");
980 StdDevLidar.
Id = TEXT(
"noise_stddev");
984 if (Id ==
"ray_cast") {
995 DropOffIntensityLimit,
996 DropOffAtZeroIntensity,
1000 else if (Id ==
"ray_cast_semantic") {
1014 Success = CheckActorDefinition(Definition);
1021 MakeGnssDefinition(Success, Definition);
1030 FillIdAndTags(Definition, TEXT(
"sensor"), TEXT(
"other"), TEXT(
"gnss"));
1035 NoiseSeed.
Id = TEXT(
"noise_seed");
1042 StdDevLat.
Id = TEXT(
"noise_lat_stddev");
1047 BiasLat.
Id = TEXT(
"noise_lat_bias");
1054 StdDevLong.
Id = TEXT(
"noise_lon_stddev");
1059 BiasLong.
Id = TEXT(
"noise_lon_bias");
1066 StdDevAlt.
Id = TEXT(
"noise_alt_stddev");
1071 BiasAlt.
Id = TEXT(
"noise_alt_bias");
1085 Success = CheckActorDefinition(Definition);
1096 {TEXT(
"autopilot"), TEXT(
"scenario"), TEXT(
"ego_vehicle")});
1102 Colors.
Id = TEXT(
"color");
1115 Drivers.
Id = TEXT(
"driver_id");
1126 StickyControl.
Id = TEXT(
"sticky_control");
1130 Definition.
Variations.Emplace(StickyControl);
1133 TerramechanicsAttribute.
Id = TEXT(
"terramechanics");
1137 Definition.
Variations.Emplace(TerramechanicsAttribute);
1140 TEXT(
"object_type"),
1148 Success = CheckActorDefinition(Definition);
1151 TEXT(
"special_type"),
1154 Success = CheckActorDefinition(Definition);
1157 TEXT(
"number_of_wheels"),
1160 Success = CheckActorDefinition(Definition);
1166 Success = CheckActorDefinition(Definition);
1169 TEXT(
"has_dynamic_doors"),
1172 Success = CheckActorDefinition(Definition);
1177 Parameters.
HasLights ? TEXT(
"true") : TEXT(
"false")});
1178 Success = CheckActorDefinition(Definition);
1181 template <
typename T,
typename Functor>
1183 const TArray<T> &ParameterArray,
1184 TArray<FActorDefinition> &Definitions,
1187 for (
auto &Item : ParameterArray)
1191 Maker(Item, Success, Definition);
1194 Definitions.Emplace(std::move(Definition));
1200 const TArray<FVehicleParameters> &ParameterArray,
1201 TArray<FActorDefinition> &Definitions)
1212 FillIdAndTags(Definition, TEXT(
"walker"), TEXT(
"pedestrian"), Parameters.
Id);
1219 case EPedestrianGender::Female:
return TEXT(
"female");
1220 case EPedestrianGender::Male:
return TEXT(
"male");
1221 default:
return TEXT(
"other");
1228 case EPedestrianAge::Child:
return TEXT(
"child");
1229 case EPedestrianAge::Teenager:
return TEXT(
"teenager");
1230 case EPedestrianAge::Elderly:
return TEXT(
"elderly");
1231 default:
return TEXT(
"adult");
1238 GetGender(Parameters.
Gender)});
1248 GetAge(Parameters.
Age)});
1250 if (Parameters.
Speed.Num() > 0)
1253 Speed.
Id = TEXT(
"speed");
1255 for (
auto &Value : Parameters.
Speed)
1264 IsInvincible.
Id = TEXT(
"is_invincible");
1270 Success = CheckActorDefinition(Definition);
1274 const TArray<FPedestrianParameters> &ParameterArray,
1275 TArray<FActorDefinition> &Definitions)
1281 const TArray<FString> &ParameterArray,
1282 TArray<FActorDefinition> &Definitions)
1292 FillIdAndTags(Definition, TEXT(
"static"), TEXT(
"trigger"), Id);
1294 Success = CheckActorDefinition(Definition);
1310 case EPropSize::Tiny:
return TEXT(
"tiny");
1311 case EPropSize::Small:
return TEXT(
"small");
1312 case EPropSize::Medium:
return TEXT(
"medium");
1313 case EPropSize::Big:
return TEXT(
"big");
1314 case EPropSize::Huge:
return TEXT(
"huge");
1315 default:
return TEXT(
"unknown");
1324 Success = CheckActorDefinition(Definition);
1328 const TArray<FPropParameters> &ParameterArray,
1329 TArray<FActorDefinition> &Definitions)
1335 const FString &Type,
1339 Definition = MakeGenericSensorDefinition(TEXT(
"other"), TEXT(
"obstacle"));
1343 distance.
Id = TEXT(
"distance");
1349 hitradius.
Id = TEXT(
"hit_radius");
1355 onlydynamics.
Id = TEXT(
"only_dynamics");
1361 debuglinetrace.
Id = TEXT(
"debug_linetrace");
1384 UE_LOG(LogCarla, Error, TEXT(
"ActorAttribute '%s' is not a bool"), *ActorAttribute.
Id);
1387 return ActorAttribute.
Value.ToBool();
1396 UE_LOG(LogCarla, Error, TEXT(
"ActorAttribute '%s' is not an int"), *ActorAttribute.
Id);
1399 return FCString::Atoi(*ActorAttribute.
Value);
1408 UE_LOG(LogCarla, Error, TEXT(
"ActorAttribute '%s' is not a float"), *ActorAttribute.
Id);
1411 return FCString::Atof(*ActorAttribute.
Value);
1416 const FString &Default)
1420 UE_LOG(LogCarla, Error, TEXT(
"ActorAttribute '%s' is not a string"), *ActorAttribute.
Id);
1423 return ActorAttribute.
Value;
1428 const FColor &Default)
1432 UE_LOG(LogCarla, Error, TEXT(
"ActorAttribute '%s' is not a color"), *ActorAttribute.
Id);
1435 TArray<FString> Channels;
1436 ActorAttribute.
Value.ParseIntoArray(Channels, TEXT(
","),
false);
1437 if (Channels.Num() != 3)
1441 TEXT(
"ActorAttribute '%s': invalid color '%s'"),
1443 *ActorAttribute.
Value);
1446 TArray<uint8> Colors;
1447 for (
auto &Str : Channels)
1449 auto Val = FCString::Atoi(*Str);
1450 if ((Val < 0) || (Val > std::numeric_limits<uint8>::max()))
1454 TEXT(
"ActorAttribute '%s': invalid color '%s'"),
1456 *ActorAttribute.
Value);
1462 Color.R = Colors[0u];
1463 Color.G = Colors[1u];
1464 Color.B = Colors[2u];
1470 const TMap<FString, FActorAttribute> &
Attributes,
1473 return Attributes.Contains(Id) ?
1474 ActorAttributeToBool(Attributes[Id], Default) :
1480 const TMap<FString, FActorAttribute> &
Attributes,
1483 return Attributes.Contains(Id) ?
1484 ActorAttributeToInt(Attributes[Id], Default) :
1490 const TMap<FString, FActorAttribute> &
Attributes,
1493 return Attributes.Contains(Id) ?
1494 ActorAttributeToFloat(Attributes[Id], Default) :
1500 const TMap<FString, FActorAttribute> &
Attributes,
1501 const FString &Default)
1503 return Attributes.Contains(Id) ?
1504 ActorAttributeToString(Attributes[Id], Default) :
1510 const TMap<FString, FActorAttribute> &
Attributes,
1511 const FColor &Default)
1513 return Attributes.Contains(Id) ?
1514 ActorAttributeToColor(Attributes[Id], Default) :
1525 # define CARLA_ABFL_CHECK_ACTOR(ActorPtr) \ 1526 if ((ActorPtr == nullptr) || ActorPtr->IsPendingKill()) \ 1528 UE_LOG(LogCarla, Error, TEXT("Cannot set empty actor!")); \ 1532 # define CARLA_ABFL_CHECK_ACTOR(ActorPtr) \ 1533 check((ActorPtr != nullptr) && !ActorPtr->IsPendingKill()); 1534 #endif // WITH_EDITOR 1542 RetrieveActorAttributeToInt(
"image_size_x", Description.
Variations, 800),
1543 RetrieveActorAttributeToInt(
"image_size_y", Description.
Variations, 600));
1545 RetrieveActorAttributeToFloat(
"fov", Description.
Variations, 90.0f));
1546 if (Description.
Variations.Contains(
"enable_postprocess_effects"))
1549 ActorAttributeToBool(
1550 Description.
Variations[
"enable_postprocess_effects"],
1553 RetrieveActorAttributeToFloat(
"gamma", Description.
Variations, 2.2f));
1555 RetrieveActorAttributeToFloat(
"motion_blur_intensity", Description.
Variations, 0.5f));
1557 RetrieveActorAttributeToFloat(
"motion_blur_max_distortion", Description.
Variations, 5.0f));
1559 RetrieveActorAttributeToFloat(
"motion_blur_min_object_screen_size", Description.
Variations, 0.5f));
1561 RetrieveActorAttributeToFloat(
"lens_flare_intensity", Description.
Variations, 0.1f));
1563 RetrieveActorAttributeToFloat(
"bloom_intensity", Description.
Variations, 0.675f));
1565 if (RetrieveActorAttributeToString(
"exposure_mode", Description.
Variations,
"histogram") ==
"histogram")
1574 RetrieveActorAttributeToFloat(
"exposure_compensation", Description.
Variations, 0.0f));
1576 RetrieveActorAttributeToFloat(
"shutter_speed", Description.
Variations, 200.0f));
1578 RetrieveActorAttributeToFloat(
"iso", Description.
Variations, 100.0f));
1580 RetrieveActorAttributeToFloat(
"fstop", Description.
Variations, 1.4f));
1583 RetrieveActorAttributeToFloat(
"exposure_min_bright", Description.
Variations, 7.0f));
1585 RetrieveActorAttributeToFloat(
"exposure_max_bright", Description.
Variations, 9.0f));
1587 RetrieveActorAttributeToFloat(
"exposure_speed_up", Description.
Variations, 3.0f));
1589 RetrieveActorAttributeToFloat(
"exposure_speed_down", Description.
Variations, 1.0f));
1591 RetrieveActorAttributeToFloat(
"calibration_constant", Description.
Variations, 16.0f));
1594 RetrieveActorAttributeToFloat(
"focal_distance", Description.
Variations, 1000.0f));
1596 RetrieveActorAttributeToFloat(
"blur_amount", Description.
Variations, 1.0f));
1598 RetrieveActorAttributeToFloat(
"blur_radius", Description.
Variations, 0.0f));
1600 RetrieveActorAttributeToFloat(
"min_fstop", Description.
Variations, 1.2f));
1602 RetrieveActorAttributeToInt(
"blade_count", Description.
Variations, 5));
1605 RetrieveActorAttributeToFloat(
"slope", Description.
Variations, 0.88f));
1607 RetrieveActorAttributeToFloat(
"toe", Description.
Variations, 0.55f));
1609 RetrieveActorAttributeToFloat(
"shoulder", Description.
Variations, 0.26f));
1611 RetrieveActorAttributeToFloat(
"black_clip", Description.
Variations, 0.0f));
1613 RetrieveActorAttributeToFloat(
"white_clip", Description.
Variations, 0.04f));
1616 RetrieveActorAttributeToFloat(
"temp", Description.
Variations, 6500.0f));
1618 RetrieveActorAttributeToFloat(
"tint", Description.
Variations, 0.0f));
1621 RetrieveActorAttributeToFloat(
"chromatic_aberration_intensity", Description.
Variations, 0.0f));
1623 RetrieveActorAttributeToFloat(
"chromatic_aberration_offset", Description.
Variations, 0.0f));
1633 RetrieveActorAttributeToFloat(
"lens_circle_falloff", Description.
Variations, 5.0f));
1635 RetrieveActorAttributeToFloat(
"lens_circle_multiplier", Description.
Variations, 0.0f));
1637 RetrieveActorAttributeToFloat(
"lens_k", Description.
Variations, -1.0f));
1639 RetrieveActorAttributeToFloat(
"lens_kcube", Description.
Variations, 0.0f));
1641 RetrieveActorAttributeToFloat(
"lens_x_size", Description.
Variations, 0.08f));
1643 RetrieveActorAttributeToFloat(
"lens_y_size", Description.
Variations, 0.08f));
1650 constexpr
float TO_CENTIMETERS = 1e2;
1654 RetrieveActorAttributeToFloat(
"range", Description.
Variations, 10.0f) * TO_CENTIMETERS;
1684 if (Description.
Variations.Contains(
"noise_seed"))
1687 RetrieveActorAttributeToInt(
"noise_seed", Description.
Variations, 0));
1695 RetrieveActorAttributeToFloat(
"noise_lat_stddev", Description.
Variations, 0.0f));
1697 RetrieveActorAttributeToFloat(
"noise_lon_stddev", Description.
Variations, 0.0f));
1699 RetrieveActorAttributeToFloat(
"noise_alt_stddev", Description.
Variations, 0.0f));
1701 RetrieveActorAttributeToFloat(
"noise_lat_bias", Description.
Variations, 0.0f));
1703 RetrieveActorAttributeToFloat(
"noise_lon_bias", Description.
Variations, 0.0f));
1705 RetrieveActorAttributeToFloat(
"noise_alt_bias", Description.
Variations, 0.0f));
1713 if (Description.
Variations.Contains(
"noise_seed"))
1716 RetrieveActorAttributeToInt(
"noise_seed", Description.
Variations, 0));
1724 RetrieveActorAttributeToFloat(
"noise_accel_stddev_x", Description.
Variations, 0.0f),
1725 RetrieveActorAttributeToFloat(
"noise_accel_stddev_y", Description.
Variations, 0.0f),
1726 RetrieveActorAttributeToFloat(
"noise_accel_stddev_z", Description.
Variations, 0.0f)});
1729 RetrieveActorAttributeToFloat(
"noise_gyro_stddev_x", Description.
Variations, 0.0f),
1730 RetrieveActorAttributeToFloat(
"noise_gyro_stddev_y", Description.
Variations, 0.0f),
1731 RetrieveActorAttributeToFloat(
"noise_gyro_stddev_z", Description.
Variations, 0.0f)});
1734 RetrieveActorAttributeToFloat(
"noise_gyro_bias_x", Description.
Variations, 0.0f),
1735 RetrieveActorAttributeToFloat(
"noise_gyro_bias_y", Description.
Variations, 0.0f),
1736 RetrieveActorAttributeToFloat(
"noise_gyro_bias_z", Description.
Variations, 0.0f)});
1744 constexpr
float TO_CENTIMETERS = 1e2;
1746 if (Description.
Variations.Contains(
"noise_seed"))
1749 RetrieveActorAttributeToInt(
"noise_seed", Description.
Variations, 0));
1757 RetrieveActorAttributeToFloat(
"horizontal_fov", Description.
Variations, 30.0f));
1759 RetrieveActorAttributeToFloat(
"vertical_fov", Description.
Variations, 30.0f));
1761 RetrieveActorAttributeToFloat(
"range", Description.
Variations, 100.0f) * TO_CENTIMETERS);
1763 RetrieveActorAttributeToInt(
"points_per_second", Description.
Variations, 1500));
1766 #undef CARLA_ABFL_CHECK_ACTOR FScopedStack< FString > Stack
float DropOffGenRate
General drop off rate.
void SetFilmToe(float Toe)
void SetFilmWhiteClip(float WhiteClip)
void SetHorizontalFOV(float NewHorizontalFOV)
void SetLatitudeBias(float Value)
void SetMotionBlurIntensity(float Intensity)
static FActorDefinition MakeLidarDefinition(const FString &Id)
void SetExposureMethod(EAutoExposureMethod Method)
static void AddRecommendedValuesForActorRoleName(FActorDefinition &Definition, TArray< FString > &&RecommendedValues)
bool IsValid(const FActorVariation &Variation)
static void FillActorDefinitionArray(const TArray< T > &ParameterArray, TArray< FActorDefinition > &Definitions, Functor Maker)
TSubclassOf< ACharacter > Class
float DropOffIntensityLimit
General drop off rate.
bool AreTagsValid(const FString &Tags)
void SetLensFlareIntensity(float Intensity)
bool AreValid(const TArray< FActorDefinition > &ActorDefinitions)
Iterate all actor definitions and their properties and display messages on error. ...
void SetChromAberrIntensity(float Intensity)
bool ForEach(const FString &Type, const TArray< T > &Array, F Validator)
Applies Validator to each item in Array.
void SetWhiteTint(float Tint)
void SetFOVAngle(float FOVAngle)
sensor::data::Color Color
FString ObjectType
(OPTIONAL) Use for custom classification of vehicles.
void SetChromAberrOffset(float ChromAberrOffset)
static FActorDefinition MakeNormalsCameraDefinition()
static int32 ActorAttributeToInt(const FActorAttribute &ActorAttribute, int32 Default)
static const FString SIZE
bool IsValid(const FActorDefinition &ActorDefinition)
static bool ActorAttributeToBool(const FActorAttribute &ActorAttribute, bool Default)
============================================================================ – Helpers to retrieve a...
TArray< int32 > SupportedDrivers
List of IDs of the drivers (pedestrians) supported by this vehicle, leave empty if no driver is suppo...
EActorAttributeType
List of valid types for actor attributes.
static float ActorAttributeToFloat(const FActorAttribute &ActorAttribute, float Default)
void SetSeed(int32 InSeed)
static void AddRecommendedValuesForSensorRoleNames(FActorDefinition &Definition)
float Range
Measure distance in centimeters.
void SetFloatShaderParameter(uint8_t ShaderIndex, const FName &ParameterName, float Value)
void SetRange(float NewRange)
FString GetDisplayId(const FString &Type, size_t Index, const T &Item)
static void MakeObstacleDetectorDefinitions(const FString &Type, const FString &Id, FActorDefinition &Definition)
void SetFilmSlope(float Slope)
A sensor that produces data by applying post-process materials (shaders) to a scene capture image...
static bool CheckActorDefinitions(const TArray< FActorDefinition > &ActorDefinitions)
Return whether the list of actor definitions is valid.
Definition of an actor variation.
void SetFocalDistance(float Distance)
bool SingleIsValid(const FActorDefinition &Definition)
Validate ActorDefinition and display messages on error.
TArray< FString > RecommendedValues
URandomEngine * GetRandomEngine()
static FString ActorAttributeToString(const FActorAttribute &ActorAttribute, const FString &Default)
static void MakePropDefinitions(const TArray< FPropParameters > &ParameterArray, TArray< FActorDefinition > &Definitions)
void SetBladeCount(int Count)
static float RetrieveActorAttributeToFloat(const FString &Id, const TMap< FString, FActorAttribute > &Attributes, float Default)
auto PushScope(V &&Value)
Push this scope into the stack.
float LowerFovLimit
Lower laser angle, counts from horizontal, negative values means under horizontal line...
A definition of a Carla Actor with all the variation and attributes.
A ray-cast based Radar sensor.
bool IsValid(const FActorAttribute &Attribute)
bool OnScreenAssert(bool Predicate, const T &Format, ARGS &&... Args) const
If Predicate is false, print an error message.
static void MakeTriggerDefinitions(const TArray< FString > &ParameterArray, TArray< FActorDefinition > &Definitions)
#define CARLA_ABFL_CHECK_ACTOR(ActorPtr)
============================================================================ – Helpers to set Actors...
void SetAltitudeDeviation(float Value)
FString Tags
A list of comma-separated tags.
static void SetRadar(const FActorDescription &Description, ARadar *Radar)
static void SetIMU(const FActorDescription &Description, AInertialMeasurementUnit *IMU)
#define DEBUG_ASSERT(predicate)
static FColor RetrieveActorAttributeToColor(const FString &Id, const TMap< FString, FActorAttribute > &Attributes, const FColor &Default)
static bool CheckActorDefinition(const FActorDefinition &ActorDefinitions)
Return whether the actor definition is valid. Prints all the errors found.
void SetLongitudeBias(float Value)
TMap< FString, FActorAttribute > Variations
User selected variations of the actor.
static FString ColorToFString(const FColor &Color)
static void MakeTriggerDefinition(const FString &Id, bool &Success, FActorDefinition &Definition)
void SetAltitudeBias(float Value)
void SetDepthBlurRadius(float Radius)
static void SetCamera(const FActorDescription &Description, ASceneCaptureSensor *Camera)
MessageTmpl< 2u > Message
A TCP message containing a maximum of 2 buffers.
static void SetGnss(const FActorDescription &Description, AGnssSensor *Gnss)
static void AddVariationsForTrigger(FActorDefinition &Def)
TArray< FColor > RecommendedColors
static int32 RetrieveActorAttributeToInt(const FString &Id, const TMap< FString, FActorAttribute > &Attributes, int32 Default)
static void MakeVehicleDefinition(const FVehicleParameters &Parameters, bool &Success, FActorDefinition &Definition)
FString BaseType
(OPTIONAL) Use for a base classification of vehicles (car / truck / van / bycicle / motorcycle)...
float RotationFrequency
Lidar rotation frequency.
static FActorDefinition MakeGenericSensorDefinition(const FString &Type, const FString &Id)
bool AreValid(const FString &Type, const TArray< T > &Array)
Applies IsValid to each item in Array.
static void SetLidar(const FActorDescription &Description, FLidarDescription &Lidar)
bool ValueIsValid(const EActorAttributeType Type, const FString &Value)
TArray< FActorVariation > Variations
Variations represent variables the user can modify to generate variations of the actor.
A description of a Carla Actor with all its variation.
void SetExposureMinBrightness(float Brightness)
void SetMotionBlurMaxDistortion(float MaxDistortion)
Gnss sensor representation The actual position calculation is done one server side.
void SetGyroscopeBias(const FVector &Vec)
Checks validity of FActorDefinition.
float AtmospAttenRate
Attenuation Rate in the atmosphere in m^-1.
void EnablePostProcessingEffects(bool Enable=true)
static FActorDefinition MakeIMUDefinition()
uint32 Channels
Number of lasers.
static FString JoinStrings(const FString &Separator, ARGS &&... Args)
bool IsIdValid(const FString &Id)
float DropOffAtZeroIntensity
General drop off rate.
float UpperFovLimit
Upper laser angle, counts from horizontal, positive values means above horizontal line...
static void MakeVehicleDefinitions(const TArray< FVehicleParameters > &ParameterArray, TArray< FActorDefinition > &Definitions)
static FActorDefinition MakeGenericDefinition(const FString &Category, const FString &Type, const FString &Id)
Base class for sensors using a USceneCaptureComponent2D for rendering the scene.
void SetFilmShoulder(float Shoulder)
void SetBloomIntensity(float Intensity)
void SetGyroscopeStandardDeviation(const FVector &Vec)
void SetExposureSpeedDown(float Speed)
void SetLongitudeDeviation(float Value)
void SetWhiteTemp(float Temp)
float HorizontalFov
Horizontal field of view.
static void AddVariationsForSensor(FActorDefinition &Def)
FString Id
Display ID that identifies the actor.
static FActorDefinition MakeRadarDefinition()
void SetLatitudeDeviation(float Value)
void SetImageSize(uint32 Width, uint32 Height)
void SetExposureMaxBrightness(float Brightness)
static void MakePropDefinition(const FPropParameters &Parameters, bool &Success, FActorDefinition &Definition)
int RandomSeed
Random seed for the noise/dropoff used by this sensor.
TSubclassOf< ACarlaWheeledVehicle > Class
static bool RetrieveActorAttributeToBool(const FString &Id, const TMap< FString, FActorAttribute > &Attributes, bool Default)
TSubclassOf< AActor > Class
Class of the actor to be spawned (Optional).
void SetAccelerationStandardDeviation(const FVector &Vec)
void SetExposureCompensation(float Compensation)
void SetExposureSpeedUp(float Speed)
bool bRestrictToRecommended
void SetDepthBlurAmount(float Amount)
void SetFilmBlackClip(float BlackClip)
TArray< FActorAttribute > Attributes
Attributes represent non-modifiable properties of the actor that might help the user identifying and ...
static void MakePedestrianDefinition(const FPedestrianParameters &Parameters, bool &Success, FActorDefinition &Definition)
uint32 PointsPerSecond
Points generated by all lasers per second.
static FString RetrieveActorAttributeToString(const FString &Id, const TMap< FString, FActorAttribute > &Attributes, const FString &Default)
FString SpecialType
(OPTIONAL) Use for a more in-depth classification of vehicles (electric / emergency / taxi ...
void SetTargetGamma(float InTargetGamma)
static FActorDefinition MakeCameraDefinition(const FString &Id, bool bEnableModifyingPostProcessEffects=false)
static void FillIdAndTags(FActorDefinition &Def, TStrs &&... Strings)
============================================================================ – Helpers to create act...
void SetAperture(float Aperture)
An actor attribute, may be an intrinsic (non-modifiable) attribute of the actor or an user-defined ac...
void SetDepthOfFieldMinFstop(float MinFstop)
static void MakePedestrianDefinitions(const TArray< FPedestrianParameters > &ParameterArray, TArray< FActorDefinition > &Definitions)
void SetShutterSpeed(float Speed)
static int32 GenerateRandomSeed()
Generate a non-deterministic random seed.
static auto GetSize(const RangeT &Range)
void SetVerticalFOV(float NewVerticalFOV)
FString GetDisplayId(const FString &Type, size_t Index, const FString &Item)
static FActorDefinition MakeGnssDefinition()
void SetPointsPerSecond(int NewPointsPerSecond)
bool IsValid(const EActorAttributeType Type)
void SetExposureCalibrationConstant(float Constant)
void SetMotionBlurMinObjectScreenSize(float ScreenSize)
static FColor ActorAttributeToColor(const FActorAttribute &ActorAttribute, const FColor &Default)