CARLA
 
载入中...
搜索中...
未找到
ActorBlueprintFunctionLibrary.cpp
浏览该文件的文档.
1// Copyright (c) 2019 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
7#include "Carla.h"
9
15
16#include <algorithm>
17#include <limits>
18#include <stack>
19
20/// Checks validity of FActorDefinition.
22{
23public:
24
25 /// Iterate all actor definitions and their properties and display messages on
26 /// error.
27 bool AreValid(const TArray<FActorDefinition> &ActorDefinitions)
28 {
29 return AreValid(TEXT("Actor Definition"), ActorDefinitions);
30 }
31
32 /// Validate @a ActorDefinition and display messages on error.
33 bool SingleIsValid(const FActorDefinition &Definition)
34 {
35 auto ScopeText = FString::Printf(TEXT("[Actor Definition : %s]"), *Definition.Id);
36 auto Scope = Stack.PushScope(ScopeText);
37 return IsValid(Definition);
38 }
39
40private:
41
42 /// If @a Predicate is false, print an error message. If possible the message
43 /// is printed to the editor window.
44 template <typename T, typename ... ARGS>
45 bool OnScreenAssert(bool Predicate, const T &Format, ARGS && ... Args) const
46 {
47 if (!Predicate)
48 {
49 FString Message;
50 for (auto &String : Stack)
51 {
52 Message += String;
53 }
54 Message += TEXT(" ");
55 Message += FString::Printf(Format, std::forward<ARGS>(Args) ...);
56
57 UE_LOG(LogCarla, Error, TEXT("%s"), *Message);
58#if WITH_EDITOR
59 if (GEngine)
60 {
61 GEngine->AddOnScreenDebugMessage(42, 15.0f, FColor::Red, Message);
62 }
63#endif // WITH_EDITOR
64 }
65 return Predicate;
66 }
67
68 template <typename T>
69 FString GetDisplayId(const FString &Type, size_t Index, const T &Item)
70 {
71 return FString::Printf(TEXT("[%s %d : %s]"), *Type, Index, *Item.Id);
72 }
73
74 FString GetDisplayId(const FString &Type, size_t Index, const FString &Item)
75 {
76 return FString::Printf(TEXT("[%s %d : %s]"), *Type, Index, *Item);
77 }
78
79 /// Applies @a Validator to each item in @a Array. Pushes a new context to the
80 /// stack for each item.
81 template <typename T, typename F>
82 bool ForEach(const FString &Type, const TArray<T> &Array, F Validator)
83 {
84 bool Result = true;
85 auto Counter = 0u;
86 for (const auto &Item : Array)
87 {
88 auto Scope = Stack.PushScope(GetDisplayId(Type, Counter, Item));
89 Result &= Validator(Item);
90 ++Counter;
91 }
92 return Result;
93 }
94
95 /// Applies @a IsValid to each item in @a Array. Pushes a new context to the
96 /// stack for each item.
97 template <typename T>
98 bool AreValid(const FString &Type, const TArray<T> &Array)
99 {
100 return ForEach(Type, Array, [this](const auto &Item) { return IsValid(Item); });
101 }
102
103 bool IsIdValid(const FString &Id)
104 {
105 /// @todo Do more checks.
106 return OnScreenAssert((!Id.IsEmpty() && Id != TEXT(".")), TEXT("Id cannot be empty"));
107 }
108
109 bool AreTagsValid(const FString &Tags)
110 {
111 /// @todo Do more checks.
112 return OnScreenAssert(!Tags.IsEmpty(), TEXT("Tags cannot be empty"));
113 }
114
116 {
117 /// @todo Do more checks.
118 return OnScreenAssert(Type < EActorAttributeType::SIZE, TEXT("Invalid type"));
119 }
120
121 bool ValueIsValid(const EActorAttributeType Type, const FString &Value)
122 {
123 /// @todo Do more checks.
124 return true;
125 }
126
127 bool IsValid(const FActorVariation &Variation)
128 {
129 return
130 IsIdValid(Variation.Id) &&
131 IsValid(Variation.Type) &&
132 OnScreenAssert(Variation.RecommendedValues.Num() > 0, TEXT("Recommended values cannot be empty")) &&
133 ForEach(TEXT("Recommended Value"), Variation.RecommendedValues, [&](auto &Value) {
134 return ValueIsValid(Variation.Type, Value);
135 });
136 }
137
138 bool IsValid(const FActorAttribute &Attribute)
139 {
140 return
141 IsIdValid(Attribute.Id) &&
142 IsValid(Attribute.Type) &&
143 ValueIsValid(Attribute.Type, Attribute.Value);
144 }
145
146 bool IsValid(const FActorDefinition &ActorDefinition)
147 {
148 /// @todo Validate Class and make sure IDs are not repeated.
149 return
150 IsIdValid(ActorDefinition.Id) &&
151 AreTagsValid(ActorDefinition.Tags) &&
152 AreValid(TEXT("Variation"), ActorDefinition.Variations) &&
153 AreValid(TEXT("Attribute"), ActorDefinition.Attributes);
154 }
155
157};
158
159template <typename ... ARGS>
160static FString JoinStrings(const FString &Separator, ARGS && ... Args)
161{
162 return FString::Join(TArray<FString>{std::forward<ARGS>(Args) ...}, *Separator);
163}
164
165static FString ColorToFString(const FColor &Color)
166{
167 return JoinStrings(
168 TEXT(","),
169 FString::FromInt(Color.R),
170 FString::FromInt(Color.G),
171 FString::FromInt(Color.B));
172}
173
174/// ============================================================================
175/// -- Actor definition validators ---------------------------------------------
176/// ============================================================================
177
179{
181 return Validator.SingleIsValid(ActorDefinition);
182}
183
184bool UActorBlueprintFunctionLibrary::CheckActorDefinitions(const TArray<FActorDefinition> &ActorDefinitions)
185{
187 return Validator.AreValid(ActorDefinitions);
188}
189
190/// ============================================================================
191/// -- Helpers to create actor definitions -------------------------------------
192/// ============================================================================
193
194template <typename ... TStrs>
195static void FillIdAndTags(FActorDefinition &Def, TStrs && ... Strings)
196{
197 Def.Id = JoinStrings(TEXT("."), std::forward<TStrs>(Strings) ...).ToLower();
198 Def.Tags = JoinStrings(TEXT(","), std::forward<TStrs>(Strings) ...).ToLower();
199
200 // each actor gets an actor role name attribute (empty by default)
201 FActorVariation ActorRole;
202 ActorRole.Id = TEXT("role_name");
204 ActorRole.RecommendedValues = { TEXT("default") };
205 ActorRole.bRestrictToRecommended = false;
206 Def.Variations.Emplace(ActorRole);
207
208 // ROS2
209 FActorVariation Var;
210 Var.Id = TEXT("ros_name");
212 Var.RecommendedValues = { Def.Id };
213 Var.bRestrictToRecommended = false;
214 Def.Variations.Emplace(Var);
215}
216
218 FActorDefinition &Definition,
219 TArray<FString> &&RecommendedValues)
220{
221 for (auto &&ActorVariation: Definition.Variations)
222 {
223 if (ActorVariation.Id == "role_name")
224 {
225 ActorVariation.RecommendedValues = RecommendedValues;
226 return;
227 }
228 }
229}
230
232{
233 AddRecommendedValuesForActorRoleName(Definition, {TEXT("front"), TEXT("back"), TEXT("left"), TEXT(
234 "right"), TEXT("front_left"), TEXT("front_right"), TEXT("back_left"), TEXT("back_right")});
235}
236
238{
239 FActorVariation Tick;
240
241 Tick.Id = TEXT("sensor_tick");
243 Tick.RecommendedValues = { TEXT("0.0") };
244 Tick.bRestrictToRecommended = false;
245
246 Def.Variations.Emplace(Tick);
247}
248
250{
251 // Friction
252 FActorVariation Friction;
253 Friction.Id = FString("friction");
255 Friction.RecommendedValues = { TEXT("3.5f") };
256 Friction.bRestrictToRecommended = false;
257 Def.Variations.Emplace(Friction);
258
259 // Extent
260 FString Extent("extent");
261 FString Coordinates[3] = {FString("x"), FString("y"), FString("z")};
262
263 for (auto Coordinate : Coordinates)
264 {
265 FActorVariation ExtentCoordinate;
266
267 ExtentCoordinate.Id = JoinStrings(TEXT("_"), Extent, Coordinate);
268 ExtentCoordinate.Type = EActorAttributeType::Float;
269 ExtentCoordinate.RecommendedValues = { TEXT("1.0f") };
270 ExtentCoordinate.bRestrictToRecommended = false;
271
272 Def.Variations.Emplace(ExtentCoordinate);
273 }
274}
275
277 const FString &Category,
278 const FString &Type,
279 const FString &Id)
280{
281 FActorDefinition Definition;
282 FillIdAndTags(Definition, Category, Type, Id);
283 return Definition;
284}
285
287 const FString &Type,
288 const FString &Id)
289{
290 auto Definition = MakeGenericDefinition(TEXT("sensor"), Type, Id);
292 return Definition;
293}
294
296 const FString &Id,
297 const bool bEnableModifyingPostProcessEffects)
298{
299 FActorDefinition Definition;
300 bool Success;
301 MakeCameraDefinition(Id, bEnableModifyingPostProcessEffects, Success, Definition);
302 check(Success);
303 return Definition;
304}
305
307 const FString &Id,
308 const bool bEnableModifyingPostProcessEffects,
309 bool &Success,
310 FActorDefinition &Definition)
311{
312 FillIdAndTags(Definition, TEXT("sensor"), TEXT("camera"), Id);
314 AddVariationsForSensor(Definition);
315
316 // FOV
317 FActorVariation FOV;
318 FOV.Id = TEXT("fov");
320 FOV.RecommendedValues = { TEXT("90.0") };
321 FOV.bRestrictToRecommended = false;
322
323 // Resolution
324 FActorVariation ResX;
325 ResX.Id = TEXT("image_size_x");
327 ResX.RecommendedValues = { TEXT("800") };
328 ResX.bRestrictToRecommended = false;
329
330 FActorVariation ResY;
331 ResY.Id = TEXT("image_size_y");
333 ResY.RecommendedValues = { TEXT("600") };
334 ResY.bRestrictToRecommended = false;
335
336 // Lens parameters
337 FActorVariation LensCircleFalloff;
338 LensCircleFalloff.Id = TEXT("lens_circle_falloff");
339 LensCircleFalloff.Type = EActorAttributeType::Float;
340 LensCircleFalloff.RecommendedValues = { TEXT("5.0") };
341 LensCircleFalloff.bRestrictToRecommended = false;
342
343 FActorVariation LensCircleMultiplier;
344 LensCircleMultiplier.Id = TEXT("lens_circle_multiplier");
345 LensCircleMultiplier.Type = EActorAttributeType::Float;
346 LensCircleMultiplier.RecommendedValues = { TEXT("0.0") };
347 LensCircleMultiplier.bRestrictToRecommended = false;
348
349 FActorVariation LensK;
350 LensK.Id = TEXT("lens_k");
352 LensK.RecommendedValues = { TEXT("-1.0") };
353 LensK.bRestrictToRecommended = false;
354
355 FActorVariation LensKcube;
356 LensKcube.Id = TEXT("lens_kcube");
358 LensKcube.RecommendedValues = { TEXT("0.0") };
359 LensKcube.bRestrictToRecommended = false;
360
361 FActorVariation LensXSize;
362 LensXSize.Id = TEXT("lens_x_size");
364 LensXSize.RecommendedValues = { TEXT("0.08") };
365 LensXSize.bRestrictToRecommended = false;
366
367 FActorVariation LensYSize;
368 LensYSize.Id = TEXT("lens_y_size");
370 LensYSize.RecommendedValues = { TEXT("0.08") };
371 LensYSize.bRestrictToRecommended = false;
372
373 Definition.Variations.Append({
374 ResX,
375 ResY,
376 FOV,
377 LensCircleFalloff,
378 LensCircleMultiplier,
379 LensK,
380 LensKcube,
381 LensXSize,
382 LensYSize});
383
384 if (bEnableModifyingPostProcessEffects)
385 {
386 FActorVariation PostProccess;
387 PostProccess.Id = TEXT("enable_postprocess_effects");
388 PostProccess.Type = EActorAttributeType::Bool;
389 PostProccess.RecommendedValues = { TEXT("true") };
390 PostProccess.bRestrictToRecommended = false;
391
392 // Gamma
393 FActorVariation Gamma;
394 Gamma.Id = TEXT("gamma");
396 Gamma.RecommendedValues = { TEXT("2.2") };
397 Gamma.bRestrictToRecommended = false;
398
399 // Motion Blur
400 FActorVariation MBIntesity;
401 MBIntesity.Id = TEXT("motion_blur_intensity");
402 MBIntesity.Type = EActorAttributeType::Float;
403 MBIntesity.RecommendedValues = { TEXT("0.45") };
404 MBIntesity.bRestrictToRecommended = false;
405
406 FActorVariation MBMaxDistortion;
407 MBMaxDistortion.Id = TEXT("motion_blur_max_distortion");
408 MBMaxDistortion.Type = EActorAttributeType::Float;
409 MBMaxDistortion.RecommendedValues = { TEXT("0.35") };
410 MBMaxDistortion.bRestrictToRecommended = false;
411
412 FActorVariation MBMinObjectScreenSize;
413 MBMinObjectScreenSize.Id = TEXT("motion_blur_min_object_screen_size");
414 MBMinObjectScreenSize.Type = EActorAttributeType::Float;
415 MBMinObjectScreenSize.RecommendedValues = { TEXT("0.1") };
416 MBMinObjectScreenSize.bRestrictToRecommended = false;
417
418 // Lens Flare
419 FActorVariation LensFlareIntensity;
420 LensFlareIntensity.Id = TEXT("lens_flare_intensity");
421 LensFlareIntensity.Type = EActorAttributeType::Float;
422 LensFlareIntensity.RecommendedValues = { TEXT("0.1") };
423 LensFlareIntensity.bRestrictToRecommended = false;
424
425 // Bloom
426 FActorVariation BloomIntensity;
427 BloomIntensity.Id = TEXT("bloom_intensity");
428 BloomIntensity.Type = EActorAttributeType::Float;
429 BloomIntensity.RecommendedValues = { TEXT("0.675") };
430 BloomIntensity.bRestrictToRecommended = false;
431
432 // More info at:
433 // https://docs.unrealengine.com/en-US/Engine/Rendering/PostProcessEffects/AutomaticExposure/index.html
434 // https://docs.unrealengine.com/en-US/Engine/Rendering/PostProcessEffects/DepthOfField/CinematicDOFMethods/index.html
435 // https://docs.unrealengine.com/en-US/Engine/Rendering/PostProcessEffects/ColorGrading/index.html
436
437 // Exposure
438 FActorVariation ExposureMode;
439 ExposureMode.Id = TEXT("exposure_mode");
440 ExposureMode.Type = EActorAttributeType::String;
441 ExposureMode.RecommendedValues = { TEXT("histogram"), TEXT("manual") };
442 ExposureMode.bRestrictToRecommended = true;
443
444 // Logarithmic adjustment for the exposure. Only used if a tonemapper is
445 // specified.
446 // 0 : no adjustment
447 // -1 : 2x darker
448 // -2 : 4x darker
449 // 1 : 2x brighter
450 // 2 : 4x brighter.
451 FActorVariation ExposureCompensation;
452 ExposureCompensation.Id = TEXT("exposure_compensation");
453 ExposureCompensation.Type = EActorAttributeType::Float;
454 ExposureCompensation.RecommendedValues = { TEXT("0.0") };
455 ExposureCompensation.bRestrictToRecommended = false;
456
457 // - Manual ------------------------------------------------
458
459 // The formula used to compute the camera exposure scale is:
460 // Exposure = 1 / (1.2 * 2^(log2( N²/t * 100/S )))
461
462 // The camera shutter speed in seconds.
463 FActorVariation ShutterSpeed; // (1/t)
464 ShutterSpeed.Id = TEXT("shutter_speed");
465 ShutterSpeed.Type = EActorAttributeType::Float;
466 ShutterSpeed.RecommendedValues = { TEXT("200.0") };
467 ShutterSpeed.bRestrictToRecommended = false;
468
469 // The camera sensor sensitivity.
470 FActorVariation ISO; // S
471 ISO.Id = TEXT("iso");
473 ISO.RecommendedValues = { TEXT("100.0") };
474 ISO.bRestrictToRecommended = false;
475
476 // Defines the size of the opening for the camera lens.
477 // Using larger numbers will reduce the DOF effect.
478 FActorVariation Aperture; // N
479 Aperture.Id = TEXT("fstop");
481 Aperture.RecommendedValues = { TEXT("1.4") };
482 Aperture.bRestrictToRecommended = false;
483
484 // - Histogram ---------------------------------------------
485
486 // The minimum brightness for auto exposure that limits the lower
487 // brightness the eye can adapt within
488 FActorVariation ExposureMinBright;
489 ExposureMinBright.Id = TEXT("exposure_min_bright");
490 ExposureMinBright.Type = EActorAttributeType::Float;
491 ExposureMinBright.RecommendedValues = { TEXT("10.0") };
492 ExposureMinBright.bRestrictToRecommended = false;
493
494 // The maximum brightness for auto exposure that limits the upper
495 // brightness the eye can adapt within
496 FActorVariation ExposureMaxBright;
497 ExposureMaxBright.Id = TEXT("exposure_max_bright");
498 ExposureMaxBright.Type = EActorAttributeType::Float;
499 ExposureMaxBright.RecommendedValues = { TEXT("12.0") };
500 ExposureMaxBright.bRestrictToRecommended = false;
501
502 // The speed at which the adaptation occurs from a dark environment
503 // to a bright environment.
504 FActorVariation ExposureSpeedUp;
505 ExposureSpeedUp.Id = TEXT("exposure_speed_up");
506 ExposureSpeedUp.Type = EActorAttributeType::Float;
507 ExposureSpeedUp.RecommendedValues = { TEXT("3.0") };
508 ExposureSpeedUp.bRestrictToRecommended = false;
509
510 // The speed at which the adaptation occurs from a bright environment
511 // to a dark environment.
512 FActorVariation ExposureSpeedDown;
513 ExposureSpeedDown.Id = TEXT("exposure_speed_down");
514 ExposureSpeedDown.Type = EActorAttributeType::Float;
515 ExposureSpeedDown.RecommendedValues = { TEXT("1.0") };
516 ExposureSpeedDown.bRestrictToRecommended = false;
517
518 // Calibration constant for 18% Albedo.
519 FActorVariation CalibrationConstant;
520 CalibrationConstant.Id = TEXT("calibration_constant");
521 CalibrationConstant.Type = EActorAttributeType::Float;
522 CalibrationConstant.RecommendedValues = { TEXT("16.0") };
523 CalibrationConstant.bRestrictToRecommended = false;
524
525 // Distance in which the Depth of Field effect should be sharp,
526 // in unreal units (cm)
527 FActorVariation FocalDistance;
528 FocalDistance.Id = TEXT("focal_distance");
529 FocalDistance.Type = EActorAttributeType::Float;
530 FocalDistance.RecommendedValues = { TEXT("1000.0") };
531 FocalDistance.bRestrictToRecommended = false;
532
533 // Depth blur km for 50%
534 FActorVariation DepthBlurAmount;
535 DepthBlurAmount.Id = TEXT("blur_amount");
536 DepthBlurAmount.Type = EActorAttributeType::Float;
537 DepthBlurAmount.RecommendedValues = { TEXT("1.0") };
538 DepthBlurAmount.bRestrictToRecommended = false;
539
540 // Depth blur radius in pixels at 1920x
541 FActorVariation DepthBlurRadius;
542 DepthBlurRadius.Id = TEXT("blur_radius");
543 DepthBlurRadius.Type = EActorAttributeType::Float;
544 DepthBlurRadius.RecommendedValues = { TEXT("0.0") };
545 DepthBlurRadius.bRestrictToRecommended = false;
546
547 // Defines the opening of the camera lens, Aperture is 1.0/fstop,
548 // typical lens go down to f/1.2 (large opening),
549 // larger numbers reduce the DOF effect
550 FActorVariation MaxAperture;
551 MaxAperture.Id = TEXT("min_fstop");
552 MaxAperture.Type = EActorAttributeType::Float;
553 MaxAperture.RecommendedValues = { TEXT("1.2") };
554 MaxAperture.bRestrictToRecommended = false;
555
556 // Defines the number of blades of the diaphragm within the
557 // lens (between 4 and 16)
558 FActorVariation BladeCount;
559 BladeCount.Id = TEXT("blade_count");
560 BladeCount.Type = EActorAttributeType::Int;
561 BladeCount.RecommendedValues = { TEXT("5") };
562 BladeCount.bRestrictToRecommended = false;
563
564 // - Tonemapper Settings -----------------------------------
565 // You can adjust these tonemapper controls to emulate other
566 // types of film stock for your project
567 FActorVariation FilmSlope;
568 FilmSlope.Id = TEXT("slope");
570 FilmSlope.RecommendedValues = { TEXT("0.88") };
571 FilmSlope.bRestrictToRecommended = false;
572
573 FActorVariation FilmToe;
574 FilmToe.Id = TEXT("toe");
576 FilmToe.RecommendedValues = { TEXT("0.55") };
577 FilmToe.bRestrictToRecommended = false;
578
579 FActorVariation FilmShoulder;
580 FilmShoulder.Id = TEXT("shoulder");
581 FilmShoulder.Type = EActorAttributeType::Float;
582 FilmShoulder.RecommendedValues = { TEXT("0.26") };
583 FilmShoulder.bRestrictToRecommended = false;
584
585 FActorVariation FilmBlackClip;
586 FilmBlackClip.Id = TEXT("black_clip");
587 FilmBlackClip.Type = EActorAttributeType::Float;
588 FilmBlackClip.RecommendedValues = { TEXT("0.0") };
589 FilmBlackClip.bRestrictToRecommended = false;
590
591 FActorVariation FilmWhiteClip;
592 FilmWhiteClip.Id = TEXT("white_clip");
593 FilmWhiteClip.Type = EActorAttributeType::Float;
594 FilmWhiteClip.RecommendedValues = { TEXT("0.04") };
595 FilmWhiteClip.bRestrictToRecommended = false;
596
597 // Color
598 FActorVariation Temperature;
599 Temperature.Id = TEXT("temp");
600 Temperature.Type = EActorAttributeType::Float;
601 Temperature.RecommendedValues = { TEXT("6500.0") };
602 Temperature.bRestrictToRecommended = false;
603
604 FActorVariation Tint;
605 Tint.Id = TEXT("tint");
607 Tint.RecommendedValues = { TEXT("0.0") };
608 Tint.bRestrictToRecommended = false;
609
610 FActorVariation ChromaticIntensity;
611 ChromaticIntensity.Id = TEXT("chromatic_aberration_intensity");
612 ChromaticIntensity.Type = EActorAttributeType::Float;
613 ChromaticIntensity.RecommendedValues = { TEXT("0.0") };
614 ChromaticIntensity.bRestrictToRecommended = false;
615
616 FActorVariation ChromaticOffset;
617 ChromaticOffset.Id = TEXT("chromatic_aberration_offset");
618 ChromaticOffset.Type = EActorAttributeType::Float;
619 ChromaticOffset.RecommendedValues = { TEXT("0.0") };
620 ChromaticOffset.bRestrictToRecommended = false;
621
622 Definition.Variations.Append({
623 ExposureMode,
624 ExposureCompensation,
625 ShutterSpeed,
626 ISO,
627 Aperture,
628 PostProccess,
629 Gamma,
630 MBIntesity,
631 MBMaxDistortion,
632 LensFlareIntensity,
633 BloomIntensity,
634 MBMinObjectScreenSize,
635 ExposureMinBright,
636 ExposureMaxBright,
637 ExposureSpeedUp,
638 ExposureSpeedDown,
639 CalibrationConstant,
640 FocalDistance,
641 MaxAperture,
642 BladeCount,
643 DepthBlurAmount,
644 DepthBlurRadius,
645 FilmSlope,
646 FilmToe,
647 FilmShoulder,
648 FilmBlackClip,
649 FilmWhiteClip,
650 Temperature,
651 Tint,
652 ChromaticIntensity,
653 ChromaticOffset});
654 }
655
656 Success = CheckActorDefinition(Definition);
657}
658
660{
661 FActorDefinition Definition;
662 bool Success;
664 check(Success);
665 return Definition;
666}
667
669{
670 FillIdAndTags(Definition, TEXT("sensor"), TEXT("camera"), TEXT("normals"));
672 AddVariationsForSensor(Definition);
673
674 // FOV
675 FActorVariation FOV;
676 FOV.Id = TEXT("fov");
678 FOV.RecommendedValues = { TEXT("90.0") };
679 FOV.bRestrictToRecommended = false;
680
681 // Resolution
682 FActorVariation ResX;
683 ResX.Id = TEXT("image_size_x");
685 ResX.RecommendedValues = { TEXT("800") };
686 ResX.bRestrictToRecommended = false;
687
688 FActorVariation ResY;
689 ResY.Id = TEXT("image_size_y");
691 ResY.RecommendedValues = { TEXT("600") };
692 ResY.bRestrictToRecommended = false;
693
694 // Lens parameters
695 FActorVariation LensCircleFalloff;
696 LensCircleFalloff.Id = TEXT("lens_circle_falloff");
697 LensCircleFalloff.Type = EActorAttributeType::Float;
698 LensCircleFalloff.RecommendedValues = { TEXT("5.0") };
699 LensCircleFalloff.bRestrictToRecommended = false;
700
701 FActorVariation LensCircleMultiplier;
702 LensCircleMultiplier.Id = TEXT("lens_circle_multiplier");
703 LensCircleMultiplier.Type = EActorAttributeType::Float;
704 LensCircleMultiplier.RecommendedValues = { TEXT("0.0") };
705 LensCircleMultiplier.bRestrictToRecommended = false;
706
707 FActorVariation LensK;
708 LensK.Id = TEXT("lens_k");
710 LensK.RecommendedValues = { TEXT("-1.0") };
711 LensK.bRestrictToRecommended = false;
712
713 FActorVariation LensKcube;
714 LensKcube.Id = TEXT("lens_kcube");
716 LensKcube.RecommendedValues = { TEXT("0.0") };
717 LensKcube.bRestrictToRecommended = false;
718
719 FActorVariation LensXSize;
720 LensXSize.Id = TEXT("lens_x_size");
722 LensXSize.RecommendedValues = { TEXT("0.08") };
723 LensXSize.bRestrictToRecommended = false;
724
725 FActorVariation LensYSize;
726 LensYSize.Id = TEXT("lens_y_size");
728 LensYSize.RecommendedValues = { TEXT("0.08") };
729 LensYSize.bRestrictToRecommended = false;
730
731 Definition.Variations.Append({
732 ResX,
733 ResY,
734 FOV,
735 LensCircleFalloff,
736 LensCircleMultiplier,
737 LensK,
738 LensKcube,
739 LensXSize,
740 LensYSize});
741
742 Success = CheckActorDefinition(Definition);
743}
744
746{
747 FActorDefinition Definition;
748 bool Success;
749 MakeIMUDefinition(Success, Definition);
750 check(Success);
751 return Definition;
752}
753
755 bool &Success,
756 FActorDefinition &Definition)
757{
758 FillIdAndTags(Definition, TEXT("sensor"), TEXT("other"), TEXT("imu"));
759 AddVariationsForSensor(Definition);
760
761 // - Noise seed --------------------------------
762 FActorVariation NoiseSeed;
763 NoiseSeed.Id = TEXT("noise_seed");
764 NoiseSeed.Type = EActorAttributeType::Int;
765 NoiseSeed.RecommendedValues = { TEXT("0") };
766 NoiseSeed.bRestrictToRecommended = false;
767
768 // - Accelerometer Standard Deviation ----------
769 // X Component
770 FActorVariation StdDevAccelX;
771 StdDevAccelX.Id = TEXT("noise_accel_stddev_x");
772 StdDevAccelX.Type = EActorAttributeType::Float;
773 StdDevAccelX.RecommendedValues = { TEXT("0.0") };
774 StdDevAccelX.bRestrictToRecommended = false;
775 // Y Component
776 FActorVariation StdDevAccelY;
777 StdDevAccelY.Id = TEXT("noise_accel_stddev_y");
778 StdDevAccelY.Type = EActorAttributeType::Float;
779 StdDevAccelY.RecommendedValues = { TEXT("0.0") };
780 StdDevAccelY.bRestrictToRecommended = false;
781 // Z Component
782 FActorVariation StdDevAccelZ;
783 StdDevAccelZ.Id = TEXT("noise_accel_stddev_z");
784 StdDevAccelZ.Type = EActorAttributeType::Float;
785 StdDevAccelZ.RecommendedValues = { TEXT("0.0") };
786 StdDevAccelZ.bRestrictToRecommended = false;
787
788 // - Gyroscope Standard Deviation --------------
789 // X Component
790 FActorVariation StdDevGyroX;
791 StdDevGyroX.Id = TEXT("noise_gyro_stddev_x");
792 StdDevGyroX.Type = EActorAttributeType::Float;
793 StdDevGyroX.RecommendedValues = { TEXT("0.0") };
794 StdDevGyroX.bRestrictToRecommended = false;
795 // Y Component
796 FActorVariation StdDevGyroY;
797 StdDevGyroY.Id = TEXT("noise_gyro_stddev_y");
798 StdDevGyroY.Type = EActorAttributeType::Float;
799 StdDevGyroY.RecommendedValues = { TEXT("0.0") };
800 StdDevGyroY.bRestrictToRecommended = false;
801 // Z Component
802 FActorVariation StdDevGyroZ;
803 StdDevGyroZ.Id = TEXT("noise_gyro_stddev_z");
804 StdDevGyroZ.Type = EActorAttributeType::Float;
805 StdDevGyroZ.RecommendedValues = { TEXT("0.0") };
806 StdDevGyroZ.bRestrictToRecommended = false;
807
808 // - Gyroscope Bias ----------------------------
809 // X Component
810 FActorVariation BiasGyroX;
811 BiasGyroX.Id = TEXT("noise_gyro_bias_x");
813 BiasGyroX.RecommendedValues = { TEXT("0.0") };
814 BiasGyroX.bRestrictToRecommended = false;
815 // Y Component
816 FActorVariation BiasGyroY;
817 BiasGyroY.Id = TEXT("noise_gyro_bias_y");
819 BiasGyroY.RecommendedValues = { TEXT("0.0") };
820 BiasGyroY.bRestrictToRecommended = false;
821 // Z Component
822 FActorVariation BiasGyroZ;
823 BiasGyroZ.Id = TEXT("noise_gyro_bias_z");
825 BiasGyroZ.RecommendedValues = { TEXT("0.0") };
826 BiasGyroZ.bRestrictToRecommended = false;
827
828 Definition.Variations.Append({
829 NoiseSeed,
830 StdDevAccelX,
831 StdDevAccelY,
832 StdDevAccelZ,
833 StdDevGyroX,
834 StdDevGyroY,
835 StdDevGyroZ,
836 BiasGyroX,
837 BiasGyroY,
838 BiasGyroZ});
839
840 Success = CheckActorDefinition(Definition);
841}
842
844{
845 FActorDefinition Definition;
846 bool Success;
847 MakeRadarDefinition(Success, Definition);
848 check(Success);
849 return Definition;
850}
851
853 bool &Success,
854 FActorDefinition &Definition)
855{
856 FillIdAndTags(Definition, TEXT("sensor"), TEXT("other"), TEXT("radar"));
857 AddVariationsForSensor(Definition);
858
859 FActorVariation HorizontalFOV;
860 HorizontalFOV.Id = TEXT("horizontal_fov");
861 HorizontalFOV.Type = EActorAttributeType::Float;
862 HorizontalFOV.RecommendedValues = { TEXT("30") };
863 HorizontalFOV.bRestrictToRecommended = false;
864
865 FActorVariation VerticalFOV;
866 VerticalFOV.Id = TEXT("vertical_fov");
867 VerticalFOV.Type = EActorAttributeType::Float;
868 VerticalFOV.RecommendedValues = { TEXT("30") };
869 VerticalFOV.bRestrictToRecommended = false;
870
871 FActorVariation Range;
872 Range.Id = TEXT("range");
874 Range.RecommendedValues = { TEXT("100") };
875 Range.bRestrictToRecommended = false;
876
877 FActorVariation PointsPerSecond;
878 PointsPerSecond.Id = TEXT("points_per_second");
879 PointsPerSecond.Type = EActorAttributeType::Int;
880 PointsPerSecond.RecommendedValues = { TEXT("1500") };
881 PointsPerSecond.bRestrictToRecommended = false;
882
883 // Noise seed
884 FActorVariation NoiseSeed;
885 NoiseSeed.Id = TEXT("noise_seed");
886 NoiseSeed.Type = EActorAttributeType::Int;
887 NoiseSeed.RecommendedValues = { TEXT("0") };
888 NoiseSeed.bRestrictToRecommended = false;
889
890 Definition.Variations.Append({
891 HorizontalFOV,
892 VerticalFOV,
893 Range,
894 PointsPerSecond,
895 NoiseSeed});
896
897 Success = CheckActorDefinition(Definition);
898}
899
901 const FString &Id)
902{
903 FActorDefinition Definition;
904 bool Success;
905 MakeLidarDefinition(Id, Success, Definition);
906 check(Success);
907 return Definition;
908}
909
911 const FString &Id,
912 bool &Success,
913 FActorDefinition &Definition)
914{
915 FillIdAndTags(Definition, TEXT("sensor"), TEXT("lidar"), Id);
917 AddVariationsForSensor(Definition);
918 // Number of channels.
919 FActorVariation Channels;
920 Channels.Id = TEXT("channels");
922 Channels.RecommendedValues = { TEXT("32") };
923 // Range.
924 FActorVariation Range;
925 Range.Id = TEXT("range");
927 Range.RecommendedValues = { TEXT("10.0") }; // 10 meters
928 // Points per second.
929 FActorVariation PointsPerSecond;
930 PointsPerSecond.Id = TEXT("points_per_second");
931 PointsPerSecond.Type = EActorAttributeType::Int;
932 PointsPerSecond.RecommendedValues = { TEXT("56000") };
933 // Frequency.
934 FActorVariation Frequency;
935 Frequency.Id = TEXT("rotation_frequency");
937 Frequency.RecommendedValues = { TEXT("10.0") };
938 // Upper FOV limit.
939 FActorVariation UpperFOV;
940 UpperFOV.Id = TEXT("upper_fov");
942 UpperFOV.RecommendedValues = { TEXT("10.0") };
943 // Lower FOV limit.
944 FActorVariation LowerFOV;
945 LowerFOV.Id = TEXT("lower_fov");
947 LowerFOV.RecommendedValues = { TEXT("-30.0") };
948 // Horizontal FOV.
949 FActorVariation HorizontalFOV;
950 HorizontalFOV.Id = TEXT("horizontal_fov");
951 HorizontalFOV.Type = EActorAttributeType::Float;
952 HorizontalFOV.RecommendedValues = { TEXT("360.0") };
953 // Atmospheric Attenuation Rate.
954 FActorVariation AtmospAttenRate;
955 AtmospAttenRate.Id = TEXT("atmosphere_attenuation_rate");
956 AtmospAttenRate.Type = EActorAttributeType::Float;
957 AtmospAttenRate.RecommendedValues = { TEXT("0.004") };
958 // Noise seed
959 FActorVariation NoiseSeed;
960 NoiseSeed.Id = TEXT("noise_seed");
961 NoiseSeed.Type = EActorAttributeType::Int;
962 NoiseSeed.RecommendedValues = { TEXT("0") };
963 NoiseSeed.bRestrictToRecommended = false;
964 // Dropoff General Rate
965 FActorVariation DropOffGenRate;
966 DropOffGenRate.Id = TEXT("dropoff_general_rate");
967 DropOffGenRate.Type = EActorAttributeType::Float;
968 DropOffGenRate.RecommendedValues = { TEXT("0.45") };
969 // Dropoff intensity limit.
970 FActorVariation DropOffIntensityLimit;
971 DropOffIntensityLimit.Id = TEXT("dropoff_intensity_limit");
972 DropOffIntensityLimit.Type = EActorAttributeType::Float;
973 DropOffIntensityLimit.RecommendedValues = { TEXT("0.8") };
974 // Dropoff at zero intensity.
975 FActorVariation DropOffAtZeroIntensity;
976 DropOffAtZeroIntensity.Id = TEXT("dropoff_zero_intensity");
977 DropOffAtZeroIntensity.Type = EActorAttributeType::Float;
978 DropOffAtZeroIntensity.RecommendedValues = { TEXT("0.4") };
979 // Noise in lidar cloud points.
980 FActorVariation StdDevLidar;
981 StdDevLidar.Id = TEXT("noise_stddev");
982 StdDevLidar.Type = EActorAttributeType::Float;
983 StdDevLidar.RecommendedValues = { TEXT("0.0") };
984
985 if (Id == "ray_cast") {
986 Definition.Variations.Append({
987 Channels,
988 Range,
989 PointsPerSecond,
990 Frequency,
991 UpperFOV,
992 LowerFOV,
993 AtmospAttenRate,
994 NoiseSeed,
995 DropOffGenRate,
996 DropOffIntensityLimit,
997 DropOffAtZeroIntensity,
998 StdDevLidar,
999 HorizontalFOV});
1000 }
1001 else if (Id == "ray_cast_semantic") {
1002 Definition.Variations.Append({
1003 Channels,
1004 Range,
1005 PointsPerSecond,
1006 Frequency,
1007 UpperFOV,
1008 LowerFOV,
1009 HorizontalFOV});
1010 }
1011 else {
1012 DEBUG_ASSERT(false);
1013 }
1014
1015 Success = CheckActorDefinition(Definition);
1016}
1017
1019{
1020 FActorDefinition Definition;
1021 bool Success;
1022 MakeV2XDefinition(Success, Definition);
1023 check(Success);
1024 return Definition;
1025}
1026
1028 bool &Success,
1029 FActorDefinition &Definition)
1030{
1031 FillIdAndTags(Definition, TEXT("sensor"), TEXT("other"), TEXT("v2x"));
1032 AddVariationsForSensor(Definition);
1033
1034 // - Noise seed --------------------------------
1035 FActorVariation NoiseSeed;
1036 NoiseSeed.Id = TEXT("noise_seed");
1037 NoiseSeed.Type = EActorAttributeType::Int;
1038 NoiseSeed.RecommendedValues = { TEXT("0") };
1039 NoiseSeed.bRestrictToRecommended = false;
1040
1041 //Frequency
1042 FActorVariation Frequency;
1043 Frequency.Id = TEXT("frequency_ghz");
1044 Frequency.Type = EActorAttributeType::Float;
1045 Frequency.RecommendedValues = { TEXT("5.9")};
1046
1047 //TransmitPower
1048 FActorVariation TransmitPower;
1049 TransmitPower.Id = TEXT("transmit_power");
1050 TransmitPower.Type = EActorAttributeType::Float;
1051 TransmitPower.RecommendedValues = { TEXT("21.5")};
1052
1053 //ReceiveSensitivity
1054 FActorVariation ReceiverSensitivity;
1055 ReceiverSensitivity.Id = TEXT("receiver_sensitivity");
1056 ReceiverSensitivity.Type = EActorAttributeType::Float;
1057 ReceiverSensitivity.RecommendedValues = { TEXT("-99.0")};
1058
1059 //Combined Antenna Gain in dBi
1060 FActorVariation CombinedAntennaGain;
1061 CombinedAntennaGain.Id = TEXT("combined_antenna_gain");
1062 CombinedAntennaGain.Type = EActorAttributeType::Float;
1063 CombinedAntennaGain.RecommendedValues = { TEXT("10.0")};
1064
1065 //Scenario
1066 FActorVariation Scenario;
1067 Scenario.Id = TEXT("scenario");
1069 Scenario.RecommendedValues = { TEXT("highway"), TEXT("rural"), TEXT("urban")};
1070 Scenario.bRestrictToRecommended = true;
1071
1072 //Path loss exponent
1073 FActorVariation PLE;
1074 PLE.Id = TEXT("path_loss_exponent");
1076 PLE.RecommendedValues = { TEXT("2.7")};
1077
1078
1079 //FSPL reference distance for LDPL calculation
1080 FActorVariation FSPL_RefDistance;
1081 FSPL_RefDistance.Id = TEXT("d_ref");
1082 FSPL_RefDistance.Type = EActorAttributeType::Float;
1083 FSPL_RefDistance.RecommendedValues = { TEXT("1.0")};
1084
1085 //filter distance to speed up calculation
1086 FActorVariation FilterDistance;
1087 FilterDistance.Id = TEXT("filter_distance");
1088 FilterDistance.Type = EActorAttributeType::Float;
1089 FilterDistance.RecommendedValues = { TEXT("500.0")};
1090
1091 //etsi fading
1092 FActorVariation EtsiFading;
1093 EtsiFading.Id = TEXT("use_etsi_fading");
1094 EtsiFading.Type = EActorAttributeType::Bool;
1095 EtsiFading.RecommendedValues = { TEXT("true")};
1096
1097 //custom fading std deviation
1098 FActorVariation CustomFadingStddev;
1099 CustomFadingStddev.Id = TEXT("custom_fading_stddev");
1100 CustomFadingStddev.Type = EActorAttributeType::Float;
1101 CustomFadingStddev.RecommendedValues = { TEXT("0.0")};
1102
1103 // Min Cam Generation
1104 FActorVariation GenCamMin;
1105 GenCamMin.Id = TEXT("gen_cam_min");
1106 GenCamMin.Type = EActorAttributeType::Float;
1107 GenCamMin.RecommendedValues = { TEXT("0.1")};
1108
1109 // Max Cam Generation
1110 FActorVariation GenCamMax;
1111 GenCamMax.Id = TEXT("gen_cam_max");
1112 GenCamMax.Type = EActorAttributeType::Float;
1113 GenCamMax.RecommendedValues = { TEXT("1.0")};
1114
1115 //Fixed Rate
1116 FActorVariation FixedRate;
1117 FixedRate.Id = TEXT("fixed_rate");
1118 FixedRate.Type = EActorAttributeType::Bool;
1119 FixedRate.RecommendedValues = { TEXT("false")};
1120
1121 //path loss model
1122 FActorVariation PLModel;
1123 PLModel.Id = TEXT("path_loss_model");
1125 PLModel.RecommendedValues = { TEXT("winner"), TEXT("geometric")};
1126 PLModel.bRestrictToRecommended = true;
1127
1128 //V2x Sensor sends GNSS position in CAM messages
1129 // - Latitude ----------------------------------
1130 FActorVariation StdDevLat;
1131 StdDevLat.Id = TEXT("noise_lat_stddev");
1132 StdDevLat.Type = EActorAttributeType::Float;
1133 StdDevLat.RecommendedValues = { TEXT("0.0") };
1134 StdDevLat.bRestrictToRecommended = false;
1135 FActorVariation BiasLat;
1136 BiasLat.Id = TEXT("noise_lat_bias");
1138 BiasLat.RecommendedValues = { TEXT("0.0") };
1139 BiasLat.bRestrictToRecommended = false;
1140
1141 // - Longitude ---------------------------------
1142 FActorVariation StdDevLong;
1143 StdDevLong.Id = TEXT("noise_lon_stddev");
1144 StdDevLong.Type = EActorAttributeType::Float;
1145 StdDevLong.RecommendedValues = { TEXT("0.0") };
1146 StdDevLong.bRestrictToRecommended = false;
1147 FActorVariation BiasLong;
1148 BiasLong.Id = TEXT("noise_lon_bias");
1150 BiasLong.RecommendedValues = { TEXT("0.0") };
1151 BiasLong.bRestrictToRecommended = false;
1152
1153 // - Altitude ----------------------------------
1154 FActorVariation StdDevAlt;
1155 StdDevAlt.Id = TEXT("noise_alt_stddev");
1156 StdDevAlt.Type = EActorAttributeType::Float;
1157 StdDevAlt.RecommendedValues = { TEXT("0.0") };
1158 StdDevAlt.bRestrictToRecommended = false;
1159 FActorVariation BiasAlt;
1160 BiasAlt.Id = TEXT("noise_alt_bias");
1162 BiasAlt.RecommendedValues = { TEXT("0.0") };
1163 BiasAlt.bRestrictToRecommended = false;
1164
1165 // - Heading ----------------------------------
1166 FActorVariation StdDevHeading;
1167 StdDevHeading.Id = TEXT("noise_head_stddev");
1168 StdDevHeading.Type = EActorAttributeType::Float;
1169 StdDevHeading.RecommendedValues = { TEXT("0.0") };
1170 StdDevHeading.bRestrictToRecommended = false;
1171 FActorVariation BiasHeading;
1172 BiasHeading.Id = TEXT("noise_head_bias");
1173 BiasHeading.Type = EActorAttributeType::Float;
1174 BiasHeading.RecommendedValues = { TEXT("0.0") };
1175 BiasHeading.bRestrictToRecommended = false;
1176
1177 //V2x Sensor sends acceleration in CAM messages
1178 // - Accelerometer Standard Deviation ----------
1179 // X Component
1180 FActorVariation StdDevAccelX;
1181 StdDevAccelX.Id = TEXT("noise_accel_stddev_x");
1182 StdDevAccelX.Type = EActorAttributeType::Float;
1183 StdDevAccelX.RecommendedValues = { TEXT("0.0") };
1184 StdDevAccelX.bRestrictToRecommended = false;
1185 // Y Component
1186 FActorVariation StdDevAccelY;
1187 StdDevAccelY.Id = TEXT("noise_accel_stddev_y");
1188 StdDevAccelY.Type = EActorAttributeType::Float;
1189 StdDevAccelY.RecommendedValues = { TEXT("0.0") };
1190 StdDevAccelY.bRestrictToRecommended = false;
1191 // Z Component
1192 FActorVariation StdDevAccelZ;
1193 StdDevAccelZ.Id = TEXT("noise_accel_stddev_z");
1194 StdDevAccelZ.Type = EActorAttributeType::Float;
1195 StdDevAccelZ.RecommendedValues = { TEXT("0.0") };
1196 StdDevAccelZ.bRestrictToRecommended = false;
1197
1198 // Yaw rate
1199 FActorVariation StdDevYawrate;
1200 StdDevYawrate.Id = TEXT("noise_yawrate_stddev");
1201 StdDevYawrate.Type = EActorAttributeType::Float;
1202 StdDevYawrate.RecommendedValues = { TEXT("0.0") };
1203 StdDevYawrate.bRestrictToRecommended = false;
1204 FActorVariation BiasYawrate;
1205 BiasYawrate.Id = TEXT("noise_yawrate_bias");
1206 BiasYawrate.Type = EActorAttributeType::Float;
1207 BiasYawrate.RecommendedValues = { TEXT("0.0") };
1208 BiasYawrate.bRestrictToRecommended = false;
1209
1210 //V2x Sensor sends speed in CAM messages
1211 // X Component
1212 FActorVariation StdDevVelX;
1213 StdDevVelX.Id = TEXT("noise_vel_stddev_x");
1214 StdDevVelX.Type = EActorAttributeType::Float;
1215 StdDevVelX.RecommendedValues = { TEXT("0.0") };
1216 StdDevVelX.bRestrictToRecommended = false;
1217
1218 Definition.Variations.Append({
1219 NoiseSeed,
1220 TransmitPower,
1221 ReceiverSensitivity,
1222 Frequency,
1223 CombinedAntennaGain,
1224 Scenario,
1225 PLModel,
1226 PLE,
1227 FSPL_RefDistance,
1228 FilterDistance,
1229 EtsiFading,
1230 CustomFadingStddev,
1231 GenCamMin,
1232 GenCamMax,
1233 FixedRate,
1234 StdDevLat,
1235 BiasLat,
1236 StdDevLong,
1237 BiasLong,
1238 StdDevAlt,
1239 BiasAlt,
1240 StdDevHeading,
1241 BiasHeading,
1242 StdDevAccelX,
1243 StdDevAccelY,
1244 StdDevAccelZ,
1245 StdDevYawrate,
1246 BiasYawrate,
1247 StdDevVelX});
1248 Success = CheckActorDefinition(Definition);
1249}
1250
1252{
1253 FActorDefinition Definition;
1254 bool Success;
1255 MakeCustomV2XDefinition(Success, Definition);
1256 check(Success);
1257 return Definition;
1258}
1259
1261 bool &Success,
1262 FActorDefinition &Definition)
1263{
1264 FillIdAndTags(Definition, TEXT("sensor"), TEXT("other"), TEXT("v2x_custom"));
1265 AddVariationsForSensor(Definition);
1266
1267 // - Noise seed --------------------------------
1268 FActorVariation NoiseSeed;
1269 NoiseSeed.Id = TEXT("noise_seed");
1270 NoiseSeed.Type = EActorAttributeType::Int;
1271 NoiseSeed.RecommendedValues = { TEXT("0") };
1272 NoiseSeed.bRestrictToRecommended = false;
1273
1274 //TransmitPower
1275 FActorVariation TransmitPower;
1276 TransmitPower.Id = TEXT("transmit_power");
1277 TransmitPower.Type = EActorAttributeType::Float;
1278 TransmitPower.RecommendedValues = { TEXT("21.5")};
1279
1280 //ReceiveSensitivity
1281 FActorVariation ReceiverSensitivity;
1282 ReceiverSensitivity.Id = TEXT("receiver_sensitivity");
1283 ReceiverSensitivity.Type = EActorAttributeType::Float;
1284 ReceiverSensitivity.RecommendedValues = { TEXT("-99.0")};
1285
1286 //Frequency
1287 FActorVariation Frequency;
1288 Frequency.Id = TEXT("frequency_ghz");
1289 Frequency.Type = EActorAttributeType::Float;
1290 Frequency.RecommendedValues = { TEXT("5.9")};
1291
1292 //Combined Antenna Gain in dBi
1293 FActorVariation CombinedAntennaGain;
1294 CombinedAntennaGain.Id = TEXT("combined_antenna_gain");
1295 CombinedAntennaGain.Type = EActorAttributeType::Float;
1296 CombinedAntennaGain.RecommendedValues = { TEXT("10.0")};
1297
1298 //Scenario
1299 FActorVariation Scenario;
1300 Scenario.Id = TEXT("scenario");
1302 Scenario.RecommendedValues = { TEXT("highway"), TEXT("rural"), TEXT("urban")};
1303 Scenario.bRestrictToRecommended = true;
1304
1305 //Path loss exponent
1306 FActorVariation PLE;
1307 PLE.Id = TEXT("path_loss_exponent");
1309 PLE.RecommendedValues = { TEXT("2.7")};
1310
1311
1312 //FSPL reference distance for LDPL calculation
1313 FActorVariation FSPL_RefDistance;
1314 FSPL_RefDistance.Id = TEXT("d_ref");
1315 FSPL_RefDistance.Type = EActorAttributeType::Float;
1316 FSPL_RefDistance.RecommendedValues = { TEXT("1.0")};
1317
1318 //filter distance to speed up calculation
1319 FActorVariation FilterDistance;
1320 FilterDistance.Id = TEXT("filter_distance");
1321 FilterDistance.Type = EActorAttributeType::Float;
1322 FilterDistance.RecommendedValues = { TEXT("500.0")};
1323
1324 //etsi fading
1325 FActorVariation EtsiFading;
1326 EtsiFading.Id = TEXT("use_etsi_fading");
1327 EtsiFading.Type = EActorAttributeType::Bool;
1328 EtsiFading.RecommendedValues = { TEXT("true")};
1329
1330 //custom fading std deviation
1331 FActorVariation CustomFadingStddev;
1332 CustomFadingStddev.Id = TEXT("custom_fading_stddev");
1333 CustomFadingStddev.Type = EActorAttributeType::Float;
1334 CustomFadingStddev.RecommendedValues = { TEXT("0.0")};
1335
1336 //path loss model
1337 FActorVariation PLModel;
1338 PLModel.Id = TEXT("path_loss_model");
1340 PLModel.RecommendedValues = { TEXT("winner"), TEXT("geometric")};
1341 PLModel.bRestrictToRecommended = true;
1342
1343
1344 Definition.Variations.Append({
1345 NoiseSeed,
1346 TransmitPower,
1347 ReceiverSensitivity,
1348 Frequency,
1349 CombinedAntennaGain,
1350 Scenario,
1351 PLModel,
1352 PLE,
1353 FSPL_RefDistance,
1354 FilterDistance,
1355 EtsiFading,
1356 CustomFadingStddev
1357});
1358
1359 Success = CheckActorDefinition(Definition);
1360}
1361
1362
1364{
1365 FActorDefinition Definition;
1366 bool Success;
1367 MakeGnssDefinition(Success, Definition);
1368 check(Success);
1369 return Definition;
1370}
1371
1373 bool &Success,
1374 FActorDefinition &Definition)
1375{
1376 FillIdAndTags(Definition, TEXT("sensor"), TEXT("other"), TEXT("gnss"));
1377 AddVariationsForSensor(Definition);
1378
1379 // - Noise seed --------------------------------
1380 FActorVariation NoiseSeed;
1381 NoiseSeed.Id = TEXT("noise_seed");
1382 NoiseSeed.Type = EActorAttributeType::Int;
1383 NoiseSeed.RecommendedValues = { TEXT("0") };
1384 NoiseSeed.bRestrictToRecommended = false;
1385
1386 // - Latitude ----------------------------------
1387 FActorVariation StdDevLat;
1388 StdDevLat.Id = TEXT("noise_lat_stddev");
1389 StdDevLat.Type = EActorAttributeType::Float;
1390 StdDevLat.RecommendedValues = { TEXT("0.0") };
1391 StdDevLat.bRestrictToRecommended = false;
1392 FActorVariation BiasLat;
1393 BiasLat.Id = TEXT("noise_lat_bias");
1395 BiasLat.RecommendedValues = { TEXT("0.0") };
1396 BiasLat.bRestrictToRecommended = false;
1397
1398 // - Longitude ---------------------------------
1399 FActorVariation StdDevLong;
1400 StdDevLong.Id = TEXT("noise_lon_stddev");
1401 StdDevLong.Type = EActorAttributeType::Float;
1402 StdDevLong.RecommendedValues = { TEXT("0.0") };
1403 StdDevLong.bRestrictToRecommended = false;
1404 FActorVariation BiasLong;
1405 BiasLong.Id = TEXT("noise_lon_bias");
1407 BiasLong.RecommendedValues = { TEXT("0.0") };
1408 BiasLong.bRestrictToRecommended = false;
1409
1410 // - Altitude ----------------------------------
1411 FActorVariation StdDevAlt;
1412 StdDevAlt.Id = TEXT("noise_alt_stddev");
1413 StdDevAlt.Type = EActorAttributeType::Float;
1414 StdDevAlt.RecommendedValues = { TEXT("0.0") };
1415 StdDevAlt.bRestrictToRecommended = false;
1416 FActorVariation BiasAlt;
1417 BiasAlt.Id = TEXT("noise_alt_bias");
1419 BiasAlt.RecommendedValues = { TEXT("0.0") };
1420 BiasAlt.bRestrictToRecommended = false;
1421
1422 Definition.Variations.Append({
1423 NoiseSeed,
1424 StdDevLat,
1425 BiasLat,
1426 StdDevLong,
1427 BiasLong,
1428 StdDevAlt,
1429 BiasAlt});
1430
1431 Success = CheckActorDefinition(Definition);
1432}
1433
1435 const FVehicleParameters &Parameters,
1436 bool &Success,
1437 FActorDefinition &Definition)
1438{
1439 /// @todo We need to validate here the params.
1440 FillIdAndTags(Definition, TEXT("vehicle"), Parameters.Make, Parameters.Model);
1442 {TEXT("autopilot"), TEXT("scenario"), TEXT("ego_vehicle")});
1443 Definition.Class = Parameters.Class;
1444
1445 if (Parameters.RecommendedColors.Num() > 0)
1446 {
1447 FActorVariation Colors;
1448 Colors.Id = TEXT("color");
1450 Colors.bRestrictToRecommended = false;
1451 for (auto &Color : Parameters.RecommendedColors)
1452 {
1453 Colors.RecommendedValues.Emplace(ColorToFString(Color));
1454 }
1455 Definition.Variations.Emplace(Colors);
1456 }
1457
1458 if (Parameters.SupportedDrivers.Num() > 0)
1459 {
1460 FActorVariation Drivers;
1461 Drivers.Id = TEXT("driver_id");
1463 Drivers.bRestrictToRecommended = true;
1464 for (auto &Id : Parameters.SupportedDrivers)
1465 {
1466 Drivers.RecommendedValues.Emplace(FString::FromInt(Id));
1467 }
1468 Definition.Variations.Emplace(Drivers);
1469 }
1470
1471 FActorVariation StickyControl;
1472 StickyControl.Id = TEXT("sticky_control");
1473 StickyControl.Type = EActorAttributeType::Bool;
1474 StickyControl.bRestrictToRecommended = false;
1475 StickyControl.RecommendedValues.Emplace(TEXT("true"));
1476 Definition.Variations.Emplace(StickyControl);
1477
1478 FActorVariation TerramechanicsAttribute;
1479 TerramechanicsAttribute.Id = TEXT("terramechanics");
1480 TerramechanicsAttribute.Type = EActorAttributeType::Bool;
1481 TerramechanicsAttribute.bRestrictToRecommended = false;
1482 TerramechanicsAttribute.RecommendedValues.Emplace(TEXT("false"));
1483 Definition.Variations.Emplace(TerramechanicsAttribute);
1484
1485 Definition.Attributes.Emplace(FActorAttribute{
1486 TEXT("object_type"),
1488 Parameters.ObjectType});
1489
1490 Definition.Attributes.Emplace(FActorAttribute{
1491 TEXT("base_type"),
1493 Parameters.BaseType});
1494 Success = CheckActorDefinition(Definition);
1495
1496 Definition.Attributes.Emplace(FActorAttribute{
1497 TEXT("special_type"),
1499 Parameters.SpecialType});
1500 Success = CheckActorDefinition(Definition);
1501
1502 Definition.Attributes.Emplace(FActorAttribute{
1503 TEXT("number_of_wheels"),
1505 FString::FromInt(Parameters.NumberOfWheels)});
1506 Success = CheckActorDefinition(Definition);
1507
1508 Definition.Attributes.Emplace(FActorAttribute{
1509 TEXT("generation"),
1511 FString::FromInt(Parameters.Generation)});
1512 Success = CheckActorDefinition(Definition);
1513
1514 Definition.Attributes.Emplace(FActorAttribute{
1515 TEXT("has_dynamic_doors"),
1517 Parameters.HasDynamicDoors ? TEXT("true") : TEXT("false")});
1518 Success = CheckActorDefinition(Definition);
1519
1520 Definition.Attributes.Emplace(FActorAttribute{
1521 TEXT("has_lights"),
1523 Parameters.HasLights ? TEXT("true") : TEXT("false")});
1524 Success = CheckActorDefinition(Definition);
1525}
1526
1527template <typename T, typename Functor>
1529 const TArray<T> &ParameterArray,
1530 TArray<FActorDefinition> &Definitions,
1531 Functor Maker)
1532{
1533 for (auto &Item : ParameterArray)
1534 {
1535 FActorDefinition Definition;
1536 bool Success = false;
1537 Maker(Item, Success, Definition);
1538 if (Success)
1539 {
1540 Definitions.Emplace(std::move(Definition));
1541 }
1542 }
1543}
1544
1546 const TArray<FVehicleParameters> &ParameterArray,
1547 TArray<FActorDefinition> &Definitions)
1548{
1549 FillActorDefinitionArray(ParameterArray, Definitions, &MakeVehicleDefinition);
1550}
1551
1553 const FPedestrianParameters &Parameters,
1554 bool &Success,
1555 FActorDefinition &Definition)
1556{
1557 /// @todo We need to validate here the params.
1558 FillIdAndTags(Definition, TEXT("walker"), TEXT("pedestrian"), Parameters.Id);
1559 AddRecommendedValuesForActorRoleName(Definition, {TEXT("pedestrian")});
1560 Definition.Class = Parameters.Class;
1561
1562 auto GetGender = [](EPedestrianGender Value) {
1563 switch (Value)
1564 {
1565 case EPedestrianGender::Female: return TEXT("female");
1566 case EPedestrianGender::Male: return TEXT("male");
1567 default: return TEXT("other");
1568 }
1569 };
1570
1571 auto GetAge = [](EPedestrianAge Value) {
1572 switch (Value)
1573 {
1574 case EPedestrianAge::Child: return TEXT("child");
1575 case EPedestrianAge::Teenager: return TEXT("teenager");
1576 case EPedestrianAge::Elderly: return TEXT("elderly");
1577 default: return TEXT("adult");
1578 }
1579 };
1580
1581 Definition.Attributes.Emplace(FActorAttribute{
1582 TEXT("gender"),
1584 GetGender(Parameters.Gender)});
1585
1586 Definition.Attributes.Emplace(FActorAttribute{
1587 TEXT("generation"),
1589 FString::FromInt(Parameters.Generation)});
1590
1591 Definition.Attributes.Emplace(FActorAttribute{
1592 TEXT("age"),
1594 GetAge(Parameters.Age)});
1595
1596
1597 Definition.Attributes.Emplace(FActorAttribute{
1598 TEXT("can_use_wheelchair"),
1600 Parameters.bCanUseWheelChair ? TEXT("true") : TEXT("false") });
1601
1602 if (Parameters.Speed.Num() > 0)
1603 {
1604 FActorVariation Speed;
1605 Speed.Id = TEXT("speed");
1606 Speed.Type = EActorAttributeType::Float;
1607 for (auto &Value : Parameters.Speed)
1608 {
1609 Speed.RecommendedValues.Emplace(FString::SanitizeFloat(Value));
1610 }
1611 Speed.bRestrictToRecommended = false;
1612 Definition.Variations.Emplace(Speed);
1613 }
1614
1615 bool bCanUseWheelChair = Parameters.bCanUseWheelChair;
1616
1617 FActorVariation IsInvincible;
1618 IsInvincible.Id = TEXT("is_invincible");
1619 IsInvincible.Type = EActorAttributeType::Bool;
1620 IsInvincible.RecommendedValues = { TEXT("true") };
1621 IsInvincible.bRestrictToRecommended = false;
1622 Definition.Variations.Emplace(IsInvincible);
1623
1624 FActorVariation WheelChairVariation;
1625 WheelChairVariation.Id = TEXT("use_wheelchair");
1626 WheelChairVariation.Type = EActorAttributeType::Bool;
1627 if(bCanUseWheelChair)
1628 {
1629 WheelChairVariation.RecommendedValues = { TEXT("false"), TEXT("true") };
1630 }
1631 else
1632 {
1633 WheelChairVariation.RecommendedValues = { TEXT("false") };
1634 }
1635 WheelChairVariation.bRestrictToRecommended = true;
1636 Definition.Variations.Emplace(WheelChairVariation);
1637
1638 Success = CheckActorDefinition(Definition);
1639}
1640
1642 const TArray<FPedestrianParameters> &ParameterArray,
1643 TArray<FActorDefinition> &Definitions)
1644{
1645 FillActorDefinitionArray(ParameterArray, Definitions, &MakePedestrianDefinition);
1646}
1647
1649 const TArray<FString> &ParameterArray,
1650 TArray<FActorDefinition> &Definitions)
1651{
1652 FillActorDefinitionArray(ParameterArray, Definitions, &MakeTriggerDefinition);
1653}
1654
1656 const FString &Id,
1657 bool &Success,
1658 FActorDefinition &Definition)
1659{
1660 FillIdAndTags(Definition, TEXT("static"), TEXT("trigger"), Id);
1661 AddVariationsForTrigger(Definition);
1662 Success = CheckActorDefinition(Definition);
1663 check(Success);
1664}
1665
1667 const FPropParameters &Parameters,
1668 bool &Success,
1669 FActorDefinition &Definition)
1670{
1671 /// @todo We need to validate here the params.
1672 FillIdAndTags(Definition, TEXT("static"), TEXT("prop"), Parameters.Name);
1673 AddRecommendedValuesForActorRoleName(Definition, {TEXT("prop")});
1674
1675 auto GetSize = [](EPropSize Value) {
1676 switch (Value)
1677 {
1678 case EPropSize::Tiny: return TEXT("tiny");
1679 case EPropSize::Small: return TEXT("small");
1680 case EPropSize::Medium: return TEXT("medium");
1681 case EPropSize::Big: return TEXT("big");
1682 case EPropSize::Huge: return TEXT("huge");
1683 default: return TEXT("unknown");
1684 }
1685 };
1686
1687 Definition.Attributes.Emplace(FActorAttribute{
1688 TEXT("size"),
1690 GetSize(Parameters.Size)});
1691
1692 Success = CheckActorDefinition(Definition);
1693}
1694
1696 const TArray<FPropParameters> &ParameterArray,
1697 TArray<FActorDefinition> &Definitions)
1698{
1699 FillActorDefinitionArray(ParameterArray, Definitions, &MakePropDefinition);
1700}
1701
1703 const FString &Type,
1704 const FString &Id,
1705 FActorDefinition &Definition)
1706{
1707 Definition = MakeGenericSensorDefinition(TEXT("other"), TEXT("obstacle"));
1708 AddVariationsForSensor(Definition);
1709 // Distance.
1710 FActorVariation distance;
1711 distance.Id = TEXT("distance");
1713 distance.RecommendedValues = { TEXT("5.0") };
1714 distance.bRestrictToRecommended = false;
1715 // HitRadius.
1716 FActorVariation hitradius;
1717 hitradius.Id = TEXT("hit_radius");
1718 hitradius.Type = EActorAttributeType::Float;
1719 hitradius.RecommendedValues = { TEXT("0.5") };
1720 hitradius.bRestrictToRecommended = false;
1721 // Only Dynamics
1722 FActorVariation onlydynamics;
1723 onlydynamics.Id = TEXT("only_dynamics");
1724 onlydynamics.Type = EActorAttributeType::Bool;
1725 onlydynamics.RecommendedValues = { TEXT("false") };
1726 onlydynamics.bRestrictToRecommended = false;
1727 // Debug Line Trace
1728 FActorVariation debuglinetrace;
1729 debuglinetrace.Id = TEXT("debug_linetrace");
1730 debuglinetrace.Type = EActorAttributeType::Bool;
1731 debuglinetrace.RecommendedValues = { TEXT("false") };
1732 debuglinetrace.bRestrictToRecommended = false;
1733
1734 Definition.Variations.Append({
1735 distance,
1736 hitradius,
1737 onlydynamics,
1738 debuglinetrace
1739 });
1740
1741}
1742/// ============================================================================
1743/// -- Helpers to retrieve attribute values ------------------------------------
1744/// ============================================================================
1745
1747 const FActorAttribute &ActorAttribute,
1748 bool Default)
1749{
1750 if (ActorAttribute.Type != EActorAttributeType::Bool)
1751 {
1752 UE_LOG(LogCarla, Error, TEXT("ActorAttribute '%s' is not a bool"), *ActorAttribute.Id);
1753 return Default;
1754 }
1755 return ActorAttribute.Value.ToBool();
1756}
1757
1759 const FActorAttribute &ActorAttribute,
1760 int32 Default)
1761{
1762 if (ActorAttribute.Type != EActorAttributeType::Int)
1763 {
1764 UE_LOG(LogCarla, Error, TEXT("ActorAttribute '%s' is not an int"), *ActorAttribute.Id);
1765 return Default;
1766 }
1767 return FCString::Atoi(*ActorAttribute.Value);
1768}
1769
1771 const FActorAttribute &ActorAttribute,
1772 float Default)
1773{
1774 if (ActorAttribute.Type != EActorAttributeType::Float)
1775 {
1776 UE_LOG(LogCarla, Error, TEXT("ActorAttribute '%s' is not a float"), *ActorAttribute.Id);
1777 return Default;
1778 }
1779 return FCString::Atof(*ActorAttribute.Value);
1780}
1781
1783 const FActorAttribute &ActorAttribute,
1784 const FString &Default)
1785{
1786 if (ActorAttribute.Type != EActorAttributeType::String)
1787 {
1788 UE_LOG(LogCarla, Error, TEXT("ActorAttribute '%s' is not a string"), *ActorAttribute.Id);
1789 return Default;
1790 }
1791 return ActorAttribute.Value;
1792}
1793
1795 const FActorAttribute &ActorAttribute,
1796 const FColor &Default)
1797{
1798 if (ActorAttribute.Type != EActorAttributeType::RGBColor)
1799 {
1800 UE_LOG(LogCarla, Error, TEXT("ActorAttribute '%s' is not a color"), *ActorAttribute.Id);
1801 return Default;
1802 }
1803 TArray<FString> Channels;
1804 ActorAttribute.Value.ParseIntoArray(Channels, TEXT(","), false);
1805 if (Channels.Num() != 3)
1806 {
1807 UE_LOG(LogCarla,
1808 Error,
1809 TEXT("ActorAttribute '%s': invalid color '%s'"),
1810 *ActorAttribute.Id,
1811 *ActorAttribute.Value);
1812 return Default;
1813 }
1814 TArray<uint8> Colors;
1815 for (auto &Str : Channels)
1816 {
1817 auto Val = FCString::Atoi(*Str);
1818 if ((Val < 0) || (Val > std::numeric_limits<uint8>::max()))
1819 {
1820 UE_LOG(LogCarla,
1821 Error,
1822 TEXT("ActorAttribute '%s': invalid color '%s'"),
1823 *ActorAttribute.Id,
1824 *ActorAttribute.Value);
1825 return Default;
1826 }
1827 Colors.Add(Val);
1828 }
1829 FColor Color;
1830 Color.R = Colors[0u];
1831 Color.G = Colors[1u];
1832 Color.B = Colors[2u];
1833 return Color;
1834}
1835
1837 const FString &Id,
1838 const TMap<FString, FActorAttribute> &Attributes,
1839 bool Default)
1840{
1841 return Attributes.Contains(Id) ?
1842 ActorAttributeToBool(Attributes[Id], Default) :
1843 Default;
1844}
1845
1847 const FString &Id,
1848 const TMap<FString, FActorAttribute> &Attributes,
1849 int32 Default)
1850{
1851 return Attributes.Contains(Id) ?
1852 ActorAttributeToInt(Attributes[Id], Default) :
1853 Default;
1854}
1855
1857 const FString &Id,
1858 const TMap<FString, FActorAttribute> &Attributes,
1859 float Default)
1860{
1861 return Attributes.Contains(Id) ?
1862 ActorAttributeToFloat(Attributes[Id], Default) :
1863 Default;
1864}
1865
1867 const FString &Id,
1868 const TMap<FString, FActorAttribute> &Attributes,
1869 const FString &Default)
1870{
1871 return Attributes.Contains(Id) ?
1872 ActorAttributeToString(Attributes[Id], Default) :
1873 Default;
1874}
1875
1877 const FString &Id,
1878 const TMap<FString, FActorAttribute> &Attributes,
1879 const FColor &Default)
1880{
1881 return Attributes.Contains(Id) ?
1882 ActorAttributeToColor(Attributes[Id], Default) :
1883 Default;
1884}
1885
1886/// ============================================================================
1887/// -- Helpers to set Actors ---------------------------------------------------
1888/// ============================================================================
1889
1890// Here we do different checks when we are in editor because we don't want the
1891// editor crashing while people are testing new actor definitions.
1892#if WITH_EDITOR
1893# define CARLA_ABFL_CHECK_ACTOR(ActorPtr) \
1894 if ((ActorPtr == nullptr) || ActorPtr->IsPendingKill()) \
1895 { \
1896 UE_LOG(LogCarla, Error, TEXT("Cannot set empty actor!")); \
1897 return; \
1898 }
1899#else
1900# define CARLA_ABFL_CHECK_ACTOR(ActorPtr) \
1901 check((ActorPtr != nullptr) && !ActorPtr->IsPendingKill());
1902#endif // WITH_EDITOR
1903
1905 const FActorDescription &Description,
1906 ASceneCaptureSensor *Camera)
1907{
1908 CARLA_ABFL_CHECK_ACTOR(Camera);
1909 Camera->SetImageSize(
1910 RetrieveActorAttributeToInt("image_size_x", Description.Variations, 800),
1911 RetrieveActorAttributeToInt("image_size_y", Description.Variations, 600));
1912 Camera->SetFOVAngle(
1913 RetrieveActorAttributeToFloat("fov", Description.Variations, 90.0f));
1914 if (Description.Variations.Contains("enable_postprocess_effects"))
1915 {
1918 Description.Variations["enable_postprocess_effects"],
1919 true));
1920 Camera->SetTargetGamma(
1921 RetrieveActorAttributeToFloat("gamma", Description.Variations, 2.2f));
1922 Camera->SetMotionBlurIntensity(
1923 RetrieveActorAttributeToFloat("motion_blur_intensity", Description.Variations, 0.5f));
1925 RetrieveActorAttributeToFloat("motion_blur_max_distortion", Description.Variations, 5.0f));
1927 RetrieveActorAttributeToFloat("motion_blur_min_object_screen_size", Description.Variations, 0.5f));
1928 Camera->SetLensFlareIntensity(
1929 RetrieveActorAttributeToFloat("lens_flare_intensity", Description.Variations, 0.1f));
1930 Camera->SetBloomIntensity(
1931 RetrieveActorAttributeToFloat("bloom_intensity", Description.Variations, 0.675f));
1932 // Exposure, histogram mode by default
1933 if (RetrieveActorAttributeToString("exposure_mode", Description.Variations, "histogram") == "histogram")
1934 {
1935 Camera->SetExposureMethod(EAutoExposureMethod::AEM_Histogram);
1936 }
1937 else
1938 {
1939 Camera->SetExposureMethod(EAutoExposureMethod::AEM_Manual);
1940 }
1942 RetrieveActorAttributeToFloat("exposure_compensation", Description.Variations, 0.0f));
1943 Camera->SetShutterSpeed(
1944 RetrieveActorAttributeToFloat("shutter_speed", Description.Variations, 200.0f));
1945 Camera->SetISO(
1946 RetrieveActorAttributeToFloat("iso", Description.Variations, 100.0f));
1947 Camera->SetAperture(
1948 RetrieveActorAttributeToFloat("fstop", Description.Variations, 1.4f));
1949
1951 RetrieveActorAttributeToFloat("exposure_min_bright", Description.Variations, 7.0f));
1953 RetrieveActorAttributeToFloat("exposure_max_bright", Description.Variations, 9.0f));
1954 Camera->SetExposureSpeedUp(
1955 RetrieveActorAttributeToFloat("exposure_speed_up", Description.Variations, 3.0f));
1956 Camera->SetExposureSpeedDown(
1957 RetrieveActorAttributeToFloat("exposure_speed_down", Description.Variations, 1.0f));
1959 RetrieveActorAttributeToFloat("calibration_constant", Description.Variations, 16.0f));
1960
1961 Camera->SetFocalDistance(
1962 RetrieveActorAttributeToFloat("focal_distance", Description.Variations, 1000.0f));
1963 Camera->SetDepthBlurAmount(
1964 RetrieveActorAttributeToFloat("blur_amount", Description.Variations, 1.0f));
1965 Camera->SetDepthBlurRadius(
1966 RetrieveActorAttributeToFloat("blur_radius", Description.Variations, 0.0f));
1968 RetrieveActorAttributeToFloat("min_fstop", Description.Variations, 1.2f));
1969 Camera->SetBladeCount(
1970 RetrieveActorAttributeToInt("blade_count", Description.Variations, 5));
1971
1972 Camera->SetFilmSlope(
1973 RetrieveActorAttributeToFloat("slope", Description.Variations, 0.88f));
1974 Camera->SetFilmToe(
1975 RetrieveActorAttributeToFloat("toe", Description.Variations, 0.55f));
1976 Camera->SetFilmShoulder(
1977 RetrieveActorAttributeToFloat("shoulder", Description.Variations, 0.26f));
1978 Camera->SetFilmBlackClip(
1979 RetrieveActorAttributeToFloat("black_clip", Description.Variations, 0.0f));
1980 Camera->SetFilmWhiteClip(
1981 RetrieveActorAttributeToFloat("white_clip", Description.Variations, 0.04f));
1982
1983 Camera->SetWhiteTemp(
1984 RetrieveActorAttributeToFloat("temp", Description.Variations, 6500.0f));
1985 Camera->SetWhiteTint(
1986 RetrieveActorAttributeToFloat("tint", Description.Variations, 0.0f));
1987
1988 Camera->SetChromAberrIntensity(
1989 RetrieveActorAttributeToFloat("chromatic_aberration_intensity", Description.Variations, 0.0f));
1990 Camera->SetChromAberrOffset(
1991 RetrieveActorAttributeToFloat("chromatic_aberration_offset", Description.Variations, 0.0f));
1992 }
1993}
1994
1996 const FActorDescription &Description,
1997 AShaderBasedSensor *Camera)
1998{
1999 CARLA_ABFL_CHECK_ACTOR(Camera);
2000 Camera->SetFloatShaderParameter(0, TEXT("CircleFalloff_NState"),
2001 RetrieveActorAttributeToFloat("lens_circle_falloff", Description.Variations, 5.0f));
2002 Camera->SetFloatShaderParameter(0, TEXT("CircleMultiplier_NState"),
2003 RetrieveActorAttributeToFloat("lens_circle_multiplier", Description.Variations, 0.0f));
2004 Camera->SetFloatShaderParameter(0, TEXT("K_NState"),
2005 RetrieveActorAttributeToFloat("lens_k", Description.Variations, -1.0f));
2006 Camera->SetFloatShaderParameter(0, TEXT("kcube"),
2007 RetrieveActorAttributeToFloat("lens_kcube", Description.Variations, 0.0f));
2008 Camera->SetFloatShaderParameter(0, TEXT("XSize_NState"),
2009 RetrieveActorAttributeToFloat("lens_x_size", Description.Variations, 0.08f));
2010 Camera->SetFloatShaderParameter(0, TEXT("YSize_NState"),
2011 RetrieveActorAttributeToFloat("lens_y_size", Description.Variations, 0.08f));
2012}
2013
2015 const FActorDescription &Description,
2016 FLidarDescription &Lidar)
2017{
2018 constexpr float TO_CENTIMETERS = 1e2;
2019 Lidar.Channels =
2020 RetrieveActorAttributeToInt("channels", Description.Variations, Lidar.Channels);
2021 Lidar.Range =
2022 RetrieveActorAttributeToFloat("range", Description.Variations, 10.0f) * TO_CENTIMETERS;
2023 Lidar.PointsPerSecond =
2024 RetrieveActorAttributeToInt("points_per_second", Description.Variations, Lidar.PointsPerSecond);
2025 Lidar.RotationFrequency =
2026 RetrieveActorAttributeToFloat("rotation_frequency", Description.Variations, Lidar.RotationFrequency);
2027 Lidar.UpperFovLimit =
2028 RetrieveActorAttributeToFloat("upper_fov", Description.Variations, Lidar.UpperFovLimit);
2029 Lidar.LowerFovLimit =
2030 RetrieveActorAttributeToFloat("lower_fov", Description.Variations, Lidar.LowerFovLimit);
2031 Lidar.HorizontalFov =
2032 RetrieveActorAttributeToFloat("horizontal_fov", Description.Variations, Lidar.HorizontalFov);
2033 Lidar.AtmospAttenRate =
2034 RetrieveActorAttributeToFloat("atmosphere_attenuation_rate", Description.Variations, Lidar.AtmospAttenRate);
2035 Lidar.RandomSeed =
2036 RetrieveActorAttributeToInt("noise_seed", Description.Variations, Lidar.RandomSeed);
2037 Lidar.DropOffGenRate =
2038 RetrieveActorAttributeToFloat("dropoff_general_rate", Description.Variations, Lidar.DropOffGenRate);
2039 Lidar.DropOffIntensityLimit =
2040 RetrieveActorAttributeToFloat("dropoff_intensity_limit", Description.Variations, Lidar.DropOffIntensityLimit);
2042 RetrieveActorAttributeToFloat("dropoff_zero_intensity", Description.Variations, Lidar.DropOffAtZeroIntensity);
2043 Lidar.NoiseStdDev =
2044 RetrieveActorAttributeToFloat("noise_stddev", Description.Variations, Lidar.NoiseStdDev);
2045}
2046
2048 const FActorDescription &Description,
2049 AGnssSensor *Gnss)
2050{
2052 if (Description.Variations.Contains("noise_seed"))
2053 {
2054 Gnss->SetSeed(
2055 RetrieveActorAttributeToInt("noise_seed", Description.Variations, 0));
2056 }
2057 else
2058 {
2059 Gnss->SetSeed(Gnss->GetRandomEngine()->GenerateRandomSeed());
2060 }
2061
2063 RetrieveActorAttributeToFloat("noise_lat_stddev", Description.Variations, 0.0f));
2065 RetrieveActorAttributeToFloat("noise_lon_stddev", Description.Variations, 0.0f));
2067 RetrieveActorAttributeToFloat("noise_alt_stddev", Description.Variations, 0.0f));
2068 Gnss->SetLatitudeBias(
2069 RetrieveActorAttributeToFloat("noise_lat_bias", Description.Variations, 0.0f));
2070 Gnss->SetLongitudeBias(
2071 RetrieveActorAttributeToFloat("noise_lon_bias", Description.Variations, 0.0f));
2072 Gnss->SetAltitudeBias(
2073 RetrieveActorAttributeToFloat("noise_alt_bias", Description.Variations, 0.0f));
2074}
2075
2077 const FActorDescription &Description,
2079{
2081 if (Description.Variations.Contains("noise_seed"))
2082 {
2083 IMU->SetSeed(
2084 RetrieveActorAttributeToInt("noise_seed", Description.Variations, 0));
2085 }
2086 else
2087 {
2089 }
2090
2092 RetrieveActorAttributeToFloat("noise_accel_stddev_x", Description.Variations, 0.0f),
2093 RetrieveActorAttributeToFloat("noise_accel_stddev_y", Description.Variations, 0.0f),
2094 RetrieveActorAttributeToFloat("noise_accel_stddev_z", Description.Variations, 0.0f)});
2095
2097 RetrieveActorAttributeToFloat("noise_gyro_stddev_x", Description.Variations, 0.0f),
2098 RetrieveActorAttributeToFloat("noise_gyro_stddev_y", Description.Variations, 0.0f),
2099 RetrieveActorAttributeToFloat("noise_gyro_stddev_z", Description.Variations, 0.0f)});
2100
2101 IMU->SetGyroscopeBias({
2102 RetrieveActorAttributeToFloat("noise_gyro_bias_x", Description.Variations, 0.0f),
2103 RetrieveActorAttributeToFloat("noise_gyro_bias_y", Description.Variations, 0.0f),
2104 RetrieveActorAttributeToFloat("noise_gyro_bias_z", Description.Variations, 0.0f)});
2105}
2106
2108 const FActorDescription &Description,
2109 ARadar *Radar)
2110{
2112 constexpr float TO_CENTIMETERS = 1e2;
2113
2114 if (Description.Variations.Contains("noise_seed"))
2115 {
2116 Radar->SetSeed(
2117 RetrieveActorAttributeToInt("noise_seed", Description.Variations, 0));
2118 }
2119 else
2120 {
2121 Radar->SetSeed(Radar->GetRandomEngine()->GenerateRandomSeed());
2122 }
2123
2124 Radar->SetHorizontalFOV(
2125 RetrieveActorAttributeToFloat("horizontal_fov", Description.Variations, 30.0f));
2126 Radar->SetVerticalFOV(
2127 RetrieveActorAttributeToFloat("vertical_fov", Description.Variations, 30.0f));
2128 Radar->SetRange(
2129 RetrieveActorAttributeToFloat("range", Description.Variations, 100.0f) * TO_CENTIMETERS);
2130 Radar->SetPointsPerSecond(
2131 RetrieveActorAttributeToInt("points_per_second", Description.Variations, 1500));
2132}
2133
2135 const FActorDescription &Description,
2136 AV2XSensor* V2X)
2137{
2139 if (Description.Variations.Contains("noise_seed"))
2140 {
2141 V2X->SetSeed(
2142 RetrieveActorAttributeToInt("noise_seed", Description.Variations, 0));
2143 }
2144 else
2145 {
2147 }
2148
2150 RetrieveActorAttributeToFloat("transmit_power", Description.Variations, 21.5),
2151 RetrieveActorAttributeToFloat("receiver_sensitivity", Description.Variations, -99.0),
2152 RetrieveActorAttributeToFloat("frequency_ghz", Description.Variations, 5.9),
2153 RetrieveActorAttributeToFloat("combined_antenna_gain", Description.Variations, 10.0),
2154 RetrieveActorAttributeToFloat("path_loss_exponent", Description.Variations, 2.7),
2155 RetrieveActorAttributeToFloat("d_ref", Description.Variations, 1.0),
2156 RetrieveActorAttributeToFloat("filter_distance", Description.Variations, 500.0),
2157 RetrieveActorAttributeToBool("use_etsi_fading", Description.Variations, true),
2158 RetrieveActorAttributeToFloat("custom_fading_stddev", Description.Variations, 0.0f)
2159 );
2160
2161 if (RetrieveActorAttributeToString("scenario", Description.Variations, "urban") == "urban")
2162 {
2164 }
2165 else if (RetrieveActorAttributeToString("scenario", Description.Variations, "urban") == "rural")
2166 {
2168 }
2169 else
2170 {
2172 }
2173
2174 V2X->SetCaServiceParams(
2175 RetrieveActorAttributeToFloat("gen_cam_min", Description.Variations, 0.1),
2176 RetrieveActorAttributeToFloat("gen_cam_max", Description.Variations, 1.0),
2177 RetrieveActorAttributeToBool("fixed_rate", Description.Variations, false));
2178
2180 RetrieveActorAttributeToFloat("noise_accel_stddev_x", Description.Variations, 0.0f),
2181 RetrieveActorAttributeToFloat("noise_accel_stddev_y", Description.Variations, 0.0f),
2182 RetrieveActorAttributeToFloat("noise_accel_stddev_z", Description.Variations, 0.0f)});
2183
2184 V2X->SetGNSSDeviation(
2185 RetrieveActorAttributeToFloat("noise_lat_stddev", Description.Variations, 0.0f),
2186 RetrieveActorAttributeToFloat("noise_lon_stddev", Description.Variations, 0.0f),
2187 RetrieveActorAttributeToFloat("noise_alt_stddev", Description.Variations, 0.0f),
2188 RetrieveActorAttributeToFloat("noise_head_stddev", Description.Variations, 0.0f),
2189 RetrieveActorAttributeToFloat("noise_lat_bias", Description.Variations, 0.0f),
2190 RetrieveActorAttributeToFloat("noise_lon_bias", Description.Variations, 0.0f),
2191 RetrieveActorAttributeToFloat("noise_alt_bias", Description.Variations, 0.0f),
2192 RetrieveActorAttributeToFloat("noise_head_bias", Description.Variations, 0.0f));
2193
2194 V2X->SetVelDeviation(
2195 RetrieveActorAttributeToFloat("noise_vel_stddev_x", Description.Variations, 0.0f)
2196 );
2198 RetrieveActorAttributeToFloat("noise_yawrate_stddev", Description.Variations, 0.0f),
2199 RetrieveActorAttributeToFloat("noise_yawrate_bias", Description.Variations, 0.0f)
2200 );
2201
2202 if (RetrieveActorAttributeToString("path_loss_model", Description.Variations, "geometric") == "winner")
2203 {
2205 }
2206 else if(RetrieveActorAttributeToString("path_loss_model", Description.Variations, "geometric") == "geometric")
2207 {
2209 }
2210
2211
2212}
2213
2215 const FActorDescription &Description,
2216 ACustomV2XSensor* V2X)
2217{
2219 if (Description.Variations.Contains("noise_seed"))
2220 {
2221 V2X->SetSeed(
2222 RetrieveActorAttributeToInt("noise_seed", Description.Variations, 0));
2223 }
2224 else
2225 {
2227 }
2228
2230 RetrieveActorAttributeToFloat("transmit_power", Description.Variations, 21.5),
2231 RetrieveActorAttributeToFloat("receiver_sensitivity", Description.Variations, -99.0),
2232 RetrieveActorAttributeToFloat("frequency_ghz", Description.Variations, 5.9),
2233 RetrieveActorAttributeToFloat("combined_antenna_gain", Description.Variations, 10.0),
2234 RetrieveActorAttributeToFloat("path_loss_exponent", Description.Variations, 2.7),
2235 RetrieveActorAttributeToFloat("d_ref", Description.Variations, 1.0),
2236 RetrieveActorAttributeToFloat("filter_distance", Description.Variations, 500.0),
2237 RetrieveActorAttributeToBool("use_etsi_fading", Description.Variations, true),
2238 RetrieveActorAttributeToFloat("custom_fading_stddev", Description.Variations, 0.0f)
2239 );
2240
2241 if (RetrieveActorAttributeToString("scenario", Description.Variations, "urban") == "urban")
2242 {
2244 }
2245 else if (RetrieveActorAttributeToString("scenario", Description.Variations, "urban") == "rural")
2246 {
2248 }
2249 else
2250 {
2252 }
2253
2254
2255 if (RetrieveActorAttributeToString("path_loss_model", Description.Variations, "geometric") == "winner")
2256 {
2258 }
2259 else if(RetrieveActorAttributeToString("path_loss_model", Description.Variations, "geometric") == "geometric")
2260 {
2262 }
2263
2264
2265}
2266#undef CARLA_ABFL_CHECK_ACTOR
static FString JoinStrings(const FString &Separator, ARGS &&... Args)
static void AddVariationsForTrigger(FActorDefinition &Def)
static void AddRecommendedValuesForSensorRoleNames(FActorDefinition &Definition)
#define CARLA_ABFL_CHECK_ACTOR(ActorPtr)
============================================================================
static void AddRecommendedValuesForActorRoleName(FActorDefinition &Definition, TArray< FString > &&RecommendedValues)
static void AddVariationsForSensor(FActorDefinition &Def)
static FString ColorToFString(const FColor &Color)
static void FillIdAndTags(FActorDefinition &Def, TStrs &&... Strings)
============================================================================
static void FillActorDefinitionArray(const TArray< T > &ParameterArray, TArray< FActorDefinition > &Definitions, Functor Maker)
#define DEBUG_ASSERT(predicate)
Definition Debug.h:66
@ Rural
@ Urban
@ Highway
@ Winner
@ Geometric
EPedestrianGender
EPropSize
EActorAttributeType
List of valid types for actor attributes.
void SetPathLossModel(const EPathLossModel path_loss_model)
void SetPropagationParams(const float TransmitPower, const float ReceiverSensitivity, const float Frequency, const float combined_antenna_gain, const float path_loss_exponent, const float reference_distance_fspl, const float filter_distance, const bool use_etsi_fading, const float custom_fading_stddev)
void SetScenario(EScenario scenario)
Gnss sensor representation The actual position calculation is done one server side
Definition GnssSensor.h:24
void SetLatitudeDeviation(float Value)
void SetLongitudeBias(float Value)
void SetLongitudeDeviation(float Value)
void SetAltitudeDeviation(float Value)
void SetAltitudeBias(float Value)
void SetLatitudeBias(float Value)
void SetGyroscopeBias(const FVector &Vec)
void SetAccelerationStandardDeviation(const FVector &Vec)
void SetGyroscopeStandardDeviation(const FVector &Vec)
A ray-cast based Radar sensor.
Definition Radar.h:22
Base class for sensors using a USceneCaptureComponent2D for rendering the scene.
void SetExposureMethod(EAutoExposureMethod Method)
void SetFOVAngle(float FOVAngle)
void SetShutterSpeed(float Speed)
void SetImageSize(uint32 Width, uint32 Height)
void SetChromAberrIntensity(float Intensity)
void SetMotionBlurMinObjectScreenSize(float ScreenSize)
void SetFilmShoulder(float Shoulder)
void SetExposureCompensation(float Compensation)
void SetMotionBlurMaxDistortion(float MaxDistortion)
void SetDepthBlurAmount(float Amount)
void SetExposureMaxBrightness(float Brightness)
void SetWhiteTemp(float Temp)
void SetFilmBlackClip(float BlackClip)
void SetExposureCalibrationConstant(float Constant)
void SetAperture(float Aperture)
void EnablePostProcessingEffects(bool Enable=true)
void SetDepthBlurRadius(float Radius)
void SetFocalDistance(float Distance)
void SetChromAberrOffset(float ChromAberrOffset)
void SetLensFlareIntensity(float Intensity)
void SetBladeCount(int Count)
void SetFilmWhiteClip(float WhiteClip)
void SetBloomIntensity(float Intensity)
void SetMotionBlurIntensity(float Intensity)
void SetTargetGamma(float InTargetGamma)
void SetDepthOfFieldMinFstop(float MinFstop)
void SetWhiteTint(float Tint)
void SetExposureSpeedDown(float Speed)
void SetFilmSlope(float Slope)
void SetExposureSpeedUp(float Speed)
void SetExposureMinBrightness(float Brightness)
void SetSeed(int32 InSeed)
Definition Sensor.cpp:87
A sensor that produces data by applying post-process materials (shaders) to a scene capture image.
void SetFloatShaderParameter(uint8_t ShaderIndex, const FName &ParameterName, float Value)
void SetPropagationParams(const float TransmitPower, const float ReceiverSensitivity, const float Frequency, const float combined_antenna_gain, const float path_loss_exponent, const float reference_distance_fspl, const float filter_distance, const bool use_etsi_fading, const float custom_fading_stddev)
Definition V2XSensor.cpp:75
void SetGNSSDeviation(const float noise_lat_stddev, const float noise_lon_stddev, const float noise_alt_stddev, const float noise_head_stddev, const float noise_lat_bias, const float noise_lon_bias, const float noise_alt_bias, const float noise_head_bias)
void SetAccelerationStandardDeviation(const FVector &Vec)
void SetPathLossModel(const EPathLossModel path_loss_model)
Definition V2XSensor.cpp:89
void SetScenario(EScenario scenario)
Definition V2XSensor.cpp:94
void SetYawrateDeviation(const float noise_yawrate_stddev, const float noise_yawrate_bias)
void SetCaServiceParams(const float GenCamMin, const float GenCamMax, const bool FixedRate)
Definition V2XSensor.cpp:69
void SetVelDeviation(const float noise_vel_stddev)
Checks validity of FActorDefinition.
bool IsValid(const FActorVariation &Variation)
bool OnScreenAssert(bool Predicate, const T &Format, ARGS &&... Args) const
If Predicate is false, print an error message.
FString GetDisplayId(const FString &Type, size_t Index, const T &Item)
bool SingleIsValid(const FActorDefinition &Definition)
Validate ActorDefinition and display messages on error.
bool IsValid(const EActorAttributeType Type)
bool AreValid(const FString &Type, const TArray< T > &Array)
Applies IsValid to each item in Array.
bool AreValid(const TArray< FActorDefinition > &ActorDefinitions)
Iterate all actor definitions and their properties and display messages on error.
bool ValueIsValid(const EActorAttributeType Type, const FString &Value)
bool IsValid(const FActorAttribute &Attribute)
bool ForEach(const FString &Type, const TArray< T > &Array, F Validator)
Applies Validator to each item in Array.
bool IsValid(const FActorDefinition &ActorDefinition)
FString GetDisplayId(const FString &Type, size_t Index, const FString &Item)
A stack to keep track of nested scopes.
Definition ScopedStack.h:14
auto PushScope(V &&Value)
Push this scope into the stack.
Definition ScopedStack.h:21
static void MakePropDefinitions(const TArray< FPropParameters > &ParameterArray, TArray< FActorDefinition > &Definitions)
static bool ActorAttributeToBool(const FActorAttribute &ActorAttribute, bool Default)
============================================================================
static void MakeTriggerDefinition(const FString &Id, bool &Success, FActorDefinition &Definition)
static void SetGnss(const FActorDescription &Description, AGnssSensor *Gnss)
static void SetLidar(const FActorDescription &Description, FLidarDescription &Lidar)
static void SetRadar(const FActorDescription &Description, ARadar *Radar)
static int32 RetrieveActorAttributeToInt(const FString &Id, const TMap< FString, FActorAttribute > &Attributes, int32 Default)
static float ActorAttributeToFloat(const FActorAttribute &ActorAttribute, float Default)
static FActorDefinition MakeLidarDefinition(const FString &Id)
static void MakeTriggerDefinitions(const TArray< FString > &ParameterArray, TArray< FActorDefinition > &Definitions)
static void MakeVehicleDefinition(const FVehicleParameters &Parameters, bool &Success, FActorDefinition &Definition)
static void SetV2X(const FActorDescription &Description, AV2XSensor *V2X)
static void MakePropDefinition(const FPropParameters &Parameters, bool &Success, FActorDefinition &Definition)
static FColor ActorAttributeToColor(const FActorAttribute &ActorAttribute, const FColor &Default)
static void SetCamera(const FActorDescription &Description, ASceneCaptureSensor *Camera)
static FActorDefinition MakeCameraDefinition(const FString &Id, bool bEnableModifyingPostProcessEffects=false)
static FString RetrieveActorAttributeToString(const FString &Id, const TMap< FString, FActorAttribute > &Attributes, const FString &Default)
static FString ActorAttributeToString(const FActorAttribute &ActorAttribute, const FString &Default)
static FColor RetrieveActorAttributeToColor(const FString &Id, const TMap< FString, FActorAttribute > &Attributes, const FColor &Default)
static FActorDefinition MakeNormalsCameraDefinition()
static float RetrieveActorAttributeToFloat(const FString &Id, const TMap< FString, FActorAttribute > &Attributes, float Default)
static void MakePedestrianDefinition(const FPedestrianParameters &Parameters, bool &Success, FActorDefinition &Definition)
static bool CheckActorDefinitions(const TArray< FActorDefinition > &ActorDefinitions)
Return whether the list of actor definitions is valid.
static FActorDefinition MakeGenericSensorDefinition(const FString &Type, const FString &Id)
static void SetCustomV2X(const FActorDescription &Description, ACustomV2XSensor *V2X)
static int32 ActorAttributeToInt(const FActorAttribute &ActorAttribute, int32 Default)
static FActorDefinition MakeGenericDefinition(const FString &Category, const FString &Type, const FString &Id)
static void MakePedestrianDefinitions(const TArray< FPedestrianParameters > &ParameterArray, TArray< FActorDefinition > &Definitions)
static bool RetrieveActorAttributeToBool(const FString &Id, const TMap< FString, FActorAttribute > &Attributes, bool Default)
static bool CheckActorDefinition(const FActorDefinition &ActorDefinitions)
Return whether the actor definition is valid. Prints all the errors found.
static void MakeObstacleDetectorDefinitions(const FString &Type, const FString &Id, FActorDefinition &Definition)
static void SetIMU(const FActorDescription &Description, AInertialMeasurementUnit *IMU)
static void MakeVehicleDefinitions(const TArray< FVehicleParameters > &ParameterArray, TArray< FActorDefinition > &Definitions)
static int32 GenerateRandomSeed()
Generate a non-deterministic random seed.
An actor attribute, may be an intrinsic (non-modifiable) attribute of the actor or an user-defined ac...
A definition of a Carla Actor with all the variation and attributes.
TArray< FActorVariation > Variations
Variations represent variables the user can modify to generate variations of the actor.
TArray< FActorAttribute > Attributes
Attributes represent non-modifiable properties of the actor that might help the user identifying and ...
TSubclassOf< AActor > Class
Class of the actor to be spawned (Optional).
A description of a Carla Actor with all its variation.
TMap< FString, FActorAttribute > Variations
User selected variations of the actor.
float DropOffAtZeroIntensity
General drop off rate.
float HorizontalFov
Horizontal field of view
int RandomSeed
Random seed for the noise/dropoff used by this sensor.
float LowerFovLimit
Lower laser angle, counts from horizontal, negative values means under horizontal line.
float Range
Measure distance in centimeters.
float DropOffGenRate
General drop off rate.
uint32 Channels
Number of lasers.
float DropOffIntensityLimit
General drop off rate.
uint32 PointsPerSecond
Points generated by all lasers per second.
float RotationFrequency
Lidar rotation frequency.
float AtmospAttenRate
Attenuation Rate in the atmosphere in m^-1.
float UpperFovLimit
Upper laser angle, counts from horizontal, positive values means above horizontal line.
TSubclassOf< ACharacter > Class
TArray< FColor > RecommendedColors
TArray< int32 > SupportedDrivers
List of IDs of the drivers (pedestrians) supported by this vehicle, leave empty if no driver is suppo...
TSubclassOf< ACarlaWheeledVehicle > Class
FString BaseType
(OPTIONAL) Use for a base classification of vehicles (car / truck / van / bycicle / motorcycle).
FString ObjectType
(OPTIONAL) Use for custom classification of vehicles.
FString SpecialType
(OPTIONAL) Use for a more in-depth classification of vehicles (electric / emergency / taxi ....