21 : Super(ObjectInitializer)
23 PrimaryActorTick.bCanEverTick =
true;
24 RandomEngine = CreateDefaultSubobject<URandomEngine>(TEXT(
"RandomEngine"));
32 UE_LOG(LogCarla, Warning, TEXT(
"CustomV2XSensor: called setowner with %p"), Owner);
33 if (GetOwner() !=
nullptr)
36 UE_LOG(LogCarla, Warning, TEXT(
"CustomV2XSensor: removed old owner %p"), GetOwner());
39 Super::SetOwner(Owner);
56 if (CarlaActor !=
nullptr)
70 UE_LOG(LogCarla, Warning, TEXT(
"CustomV2XSensor: Set function called"));
71 Super::Set(ActorDescription);
76 const float ReceiverSensitivity,
77 const float Frequency,
78 const float combined_antenna_gain,
79 const float path_loss_exponent,
80 const float reference_distance_fspl,
81 const float filter_distance,
82 const bool use_etsi_fading,
83 const float custom_fading_stddev)
86 PathLossModelObj->
SetParams(TransmitPower, ReceiverSensitivity, Frequency, combined_antenna_gain, path_loss_exponent, reference_distance_fspl, filter_distance, use_etsi_fading, custom_fading_stddev);
105 Super::PrePhysTick(DeltaSeconds);
156 std::vector<ActorPowerPair> ActorPowerList;
159 if (pair.first != GetOwner())
162 actor_power_pair.first = pair.first;
164 actor_power_pair.second = pair.second.Power;
165 ActorPowerList.push_back(actor_power_pair);
170 if (!ActorPowerList.empty())
182 for (
const auto &pair : actor_receivepower_map)
189 received_msg_and_pw.
Power = pair.second;
191 msg_received_power_list.push_back(received_msg_and_pw);
201 DataStream.SerializeAndSend(*
this,
mV2XData, DataStream.PopBufferFromPool());
211 for (
const auto &elem : msg_received_power_list)
struct CustomV2XM CustomV2XM_t
std::pair< AActor *, float > ActorPowerPair
std::map< AActor *, float > ActorPowerMap
void Set(const FActorDescription &ActorDescription) override
void SetOwner(AActor *Owner) override
PathLossModel * PathLossModelObj
void Send(const FString message)
std::map< AActor *, carla::sensor::data::CustomV2XData > ActorV2XDataMap
void SetPathLossModel(const EPathLossModel path_loss_model)
void WriteMessageToV2XData(const ACustomV2XSensor::V2XDataList &msg_received_power_list)
CustomV2XM_t CreateCustomV2XMessage()
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)
virtual void PrePhysTick(float DeltaSeconds) override
void SetScenario(EScenario scenario)
static FActorDefinition GetSensorDefinition()
const long mProtocolVersion
virtual void PostPhysTick(UWorld *World, ELevelTick TickType, float DeltaTime) override
std::vector< carla::sensor::data::CustomV2XData > V2XDataList
ACustomV2XSensor(const FObjectInitializer &ObjectInitializer)
static std::list< AActor * > mV2XActorContainer
void CreateITSPduHeader(CustomV2XM_t &message)
static ACustomV2XSensor::ActorV2XDataMap mActorV2XDataMap
FAsyncDataStream GetDataStream(const SensorT &Self)
Return the FDataStream associated with this sensor.
URandomEngine * RandomEngine
Random Engine used to provide noise for sensor output.
A registry of all the Carla actors.
A view over an actor and its properties.
IdType GetActorId() const
ActorPowerMap GetReceiveActorPowerList()
void Simulate(const std::vector< ActorPowerPair > ActorList, UCarlaEpisode *CarlaEpisode, UWorld *World)
void SetScenario(EScenario scenario)
void SetPathLossModel(const EPathLossModel path_loss_model)
void SetParams(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 SetOwner(AActor *Owner)
static FActorDefinition MakeCustomV2XDefinition()
static void SetCustomV2X(const FActorDescription &Description, ACustomV2XSensor *V2X)
FCarlaActor * FindCarlaActor(FCarlaActor::IdType ActorId)
Find a Carla actor by id.
const FActorRegistry & GetActorRegistry() const
static UCarlaEpisode * GetCurrentEpisode(const UObject *WorldContextObject)
void WriteMessage(CustomV2XData message)
size_t GetMessageCount() const
ITSContainer::ItsPduHeader_t header
A definition of a Carla Actor with all the variation and attributes.
A description of a Carla Actor with all its variation.