14#include <util/ue-header-guard-begin.h>
16#define LIBCARLA_SENSOR_REGISTRY_WITH_SENSOR_INCLUDES
18#undef LIBCARLA_SENSOR_REGISTRY_WITH_SENSOR_INCLUDES
19#include <util/ue-header-guard-end.h>
25#define CARLA_CHECK_ROS2_SENSOR_TYPE(SensorT, Enum) \
26 static_assert(carla::sensor::SensorRegistry::get<SensorT *>::index == carla::ros2::ESensors::Enum, \
27 "carla::ros2::ESensors::" #Enum " does not match the SensorRegistry position of " #SensorT)
60 "carla::ros2::ESensors needs one entry per SensorRegistry item");
61#undef CARLA_CHECK_ROS2_SENSOR_TYPE
85 TArray<FActorDefinition> Definitions;
98 template<
typename T,
typename =
void>
106 template <
typename SensorType>
107 static typename std::enable_if<is_spawnable<SensorType>::value,
void>::type
110 auto Def = SensorType::GetSensorDefinition();
112 Def.Class = SensorType::StaticClass();
113 Definitions.Emplace(Def);
116 template <
typename SensorType>
117 static typename std::enable_if<!is_spawnable<SensorType>::value,
void>::type
120 template <
size_t Index>
124 using SensorType =
typename std::remove_pointer<SensorPtrType>::type;
128 template <
size_t... Is>
130 TArray<FActorDefinition> &Definitions,
131 std::index_sequence<Is...>)
150 auto *World = GetWorld();
151 if (World ==
nullptr)
153 UE_LOG(LogCarla, Error, TEXT(
"ASensorFactory: cannot spawn sensor into an empty world."));
158 if (GameInstance ==
nullptr)
160 UE_LOG(LogCarla, Error, TEXT(
"ASensorFactory: cannot spawn sensor, incompatible game instance."));
164 auto *Sensor = World->SpawnActorDeferred<
ASensor>(
169 ESpawnActorCollisionHandlingMethod::AlwaysSpawn);
170 if (Sensor ==
nullptr)
172 UE_LOG(LogCarla, Error, TEXT(
"ASensorFactory: spawn sensor failed."));
177 check(Episode !=
nullptr);
179 Sensor->SetEpisode(*Episode);
180 Sensor->Set(Description);
200 UGameplayStatics::FinishSpawningActor(Sensor,
Transform);
#define CARLA_CHECK_ROS2_SENSOR_TYPE(SensorT, Enum)
Autoware GNSS sensor ("sensor.other.autoware_gnss"): streams GeoLocation to the client like the regul...
A sensor to register collisions.
Sensor that produce Dynamic Vision Events.
Sensor that produces "depth" images.
Sensor that produces "depth" images.
Gnss sensor representation The actual position calculation is done one server side.
A fixed-sweep ray-cast Lidar approximating a Hybrid Solid-State LiDAR (e.g.
Sensor that produces "Instance segmentation" images.
Sensor that produces "Instance segmentation" images.
LaneInvasion sensor representation The actual position calculation is done one client side.
Sensor that produces "normals" images.
A sensor to register collisions.
Sensor that produces "optical flow" images.
A ray-cast based Radar sensor.
A ray-cast based Lidar sensor.
A ray-cast based Lidar sensor.
A path-traced distance sensor ("sensor.camera.rt_lens_distance"): the geometric twin of sensor....
A path-traced instance/semantic sensor ("sensor.camera.rt_lens_instance"): the labelling twin of sens...
A path-traced camera sensor ("sensor.camera.rt_lens") that renders through a configurable lens model ...
A sensor that captures images from the scene.
A sensor that captures images from the scene.
Sensor that produces "semantic segmentation" images.
Sensor that produces "semantic segmentation" images.
FActorSpawnResult SpawnActor(const FTransform &SpawnAtTransform, const FActorDescription &ActorDescription) final
Spawn an actor based on ActorDescription and Transform.
TArray< FActorDefinition > GetDefinitions() final
Retrieve the definitions of all the sensors registered in the SensorRegistry.
Vehicle status sensor ("sensor.other.vehicle_status"): attached to a vehicle, streams a packed kinema...
FDataStream OpenStream() const
Retrieve the definitions of all the sensors registered in the SensorRegistry by calling their static ...
static auto GetSensorDefinitions()
static std::enable_if<!is_spawnable< SensorType >::value, void >::type AppendDefinitions(TArray< FActorDefinition > &)
static void AppendDefinitions(TArray< FActorDefinition > &Definitions)
static void AppendDefinitions(TArray< FActorDefinition > &Definitions, std::index_sequence< Is... >)
carla::sensor::SensorRegistry Registry
static std::enable_if< is_spawnable< SensorType >::value, void >::type AppendDefinitions(TArray< FActorDefinition > &Definitions)
Serializes and sends all the actors in the current UCarlaEpisode.
The game instance contains elements that must be kept alive in between levels.
const FCarlaServer & GetServer() const
UCarlaEpisode * GetCarlaEpisode()
static UCarlaGameInstance * GetGameInstance(const UObject *WorldContextObject)
CompositeSerializer< std::pair< ACollisionSensor *, s11n::CollisionEventSerializer >, std::pair< ADepthCamera *, s11n::ImageSerializer >, std::pair< ANormalsCamera *, s11n::NormalsImageSerializer >, std::pair< ADVSCamera *, s11n::DVSEventArraySerializer >, std::pair< AGnssSensor *, s11n::GnssSerializer >, std::pair< AInertialMeasurementUnit *, s11n::IMUSerializer >, std::pair< ALaneInvasionSensor *, s11n::NoopSerializer >, std::pair< AObstacleDetectionSensor *, s11n::ObstacleDetectionEventSerializer >, std::pair< AOpticalFlowCamera *, s11n::OpticalFlowImageSerializer >, std::pair< ARadar *, s11n::RadarSerializer >, std::pair< ARayCastSemanticLidar *, s11n::SemanticLidarSerializer >, std::pair< ARayCastLidar *, s11n::LidarSerializer >, std::pair< ARssSensor *, s11n::NoopSerializer >, std::pair< ASceneCaptureCamera *, s11n::ImageSerializer >, std::pair< ASceneCaptureCamera_RayTracedLens *, s11n::ImageSerializer >, std::pair< ASemanticSegmentationCamera *, s11n::ImageSerializer >, std::pair< AInstanceSegmentationCamera *, s11n::ImageSerializer >, std::pair< FWorldObserver *, s11n::EpisodeStateSerializer >, std::pair< ASceneCaptureCamera_WideAngleLens *, s11n::ImageSerializer >, std::pair< ADepthCamera_WideAngleLens *, s11n::ImageSerializer >, std::pair< AInstanceSegmentationCamera_WideAngleLens *, s11n::ImageSerializer >, std::pair< ASemanticSegmentationCamera_WideAngleLens *, s11n::ImageSerializer >, std::pair< FCameraGBufferUint8 *, s11n::GBufferUint8Serializer >, std::pair< FCameraGBufferFloat *, s11n::GBufferFloatSerializer >, std::pair< AHSSLidar *, s11n::LidarSerializer >, std::pair< AV2XSensor *, s11n::CAMDataSerializer >, std::pair< ACustomV2XSensor *, s11n::CustomV2XDataSerializer >, std::pair< AVehicleStatusSensor *, s11n::VehicleStatusSerializer >, std::pair< AAutowareGnssSensor *, s11n::GnssSerializer >, std::pair< ASceneCaptureCamera_RayTracedLensDistance *, s11n::DistanceImageSerializer >, std::pair< ASceneCaptureCamera_RayTracedLensInstance *, s11n::ImageSerializer > > SensorRegistry
Contains a registry of all the sensors available and allows serializing and deserializing sensor data...
A description of a Carla Actor with all its variation.
TSubclassOf< AActor > Class
Class of the actor to be spawned.
Result of an actor spawn function.
typename detail::CompileTimeTypeMapImpl< sizeof...(Items), Items... >::template get_by_index< Index > get_by_index
static constexpr size_t size()