CARLA
 
载入中...
搜索中...
未找到
CaService.h
浏览该文件的文档.
1// Copyright (c) 2024 Institut fuer Technik der Informationsverarbeitung (ITIV) at the
2// Karlsruhe Institute of Technology
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#pragma once
8
10
14#include "carla/geom/Math.h"
16#include <vector>
18#include <chrono>
19
21{
22public:
23 CaService(URandomEngine *random_engine);
24 void SetOwner(UWorld *world, AActor *Owner);
25
26 void SetParams(const float GenCamMin, const float GenCamMax, const bool FixedRate);
27 void SetVelDeviation(const float noise_vel_stddev_x);
28 void SetYawrateDeviation(const float noise_yawrate_stddev, const float noise_yawrate_bias);
29 void SetAccelerationStandardDeviation(const FVector &Vec);
30 void SetGNSSDeviation(const float noise_lat_stddev,
31 const float noise_lon_stddev,
32 const float noise_alt_stddev,
33 const float noise_head_stddev,
34 const float noise_lat_bias,
35 const float noise_lon_bias,
36 const float noise_alt_bias,
37 const float noise_head_bias);
38 bool Trigger(float DeltaSeconds);
40
41private:
45 UWorld *mWorld;
51 float mGenCam;
59
63
67 std::chrono::milliseconds mGenerationDelta0;
68
69 bool CheckTriggeringConditions(float DeltaSeconds);
70 bool CheckHeadingDelta(float DeltaSeconds);
71 bool CheckPositionDelta(float DeltaSeconds);
72 bool CheckSpeedDelta(float DeltaSeconds);
73 double GetFVectorAngle(const FVector &a, const FVector &b);
74 void GenerateCamMessage(float DeltaTime);
76
77 float GetHeading();
78 long GetVehicleRole();
79
80 /* Constant values for message*/
81 const long mProtocolVersion = 2;
85
86 carla::geom::Vector3D ComputeAccelerometer(const float DeltaTime);
87 const carla::geom::Vector3D ComputeAccelerometerNoise(const FVector &Accelerometer);
88 /// Standard deviation for acceleration settings.
89 FVector StdDevAccel;
90
91 /// Used to compute the acceleration
92 std::array<FVector, 2> PrevLocation;
93
94 /// Used to compute the acceleration
96
97 // GNSS reference position and heading
98 FVector GetReferencePosition();
104
109
110 // Velocity
111 float ComputeSpeed();
113
114 // Yaw rate
115 const float ComputeYawNoise(const FVector &Gyroscope);
116 float ComputeYawRate();
119
121 void CreateITSPduHeader(CAM_t &message);
122 void AddCooperativeAwarenessMessage(CAMContainer::CoopAwareness_t &CoopAwarenessMessage, float DeltaTime);
128
129 // random for noise
132};
Base class for CARLA wheeled vehicles.
float LongitudeBias
Definition CaService.h:106
void CreateITSPduHeader(CAM_t &message)
UWorld * mWorld
Definition CaService.h:45
const carla::geom::Vector3D ComputeAccelerometerNoise(const FVector &Accelerometer)
float AltitudeBias
Definition CaService.h:107
FVector GetReferencePosition()
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)
const long mMessageId
Definition CaService.h:82
UCarlaEpisode * mCarlaEpisode
Definition CaService.h:44
void SetVelDeviation(const float noise_vel_stddev_x)
float HeadingDeviation
Definition CaService.h:103
float LatitudeDeviation
Definition CaService.h:100
bool mDccRestriction
Definition CaService.h:54
float mGenerationInterval
Definition CaService.h:58
const long mProtocolVersion
Definition CaService.h:81
void SetOwner(UWorld *world, AActor *Owner)
Definition CaService.cpp:44
bool Trigger(float DeltaSeconds)
float YawrateDeviation
Definition CaService.h:117
void SetAccelerationStandardDeviation(const FVector &Vec)
float LongitudeDeviation
Definition CaService.h:101
FVector mLastCamPosition
Definition CaService.h:64
float mLastCamTimeStamp
Definition CaService.h:47
float VelocityDeviation
Definition CaService.h:112
float mGenCamMin
Definition CaService.h:49
CAM_t mCAMMessage
Definition CaService.h:127
void SetYawrateDeviation(const float noise_yawrate_stddev, const float noise_yawrate_bias)
unsigned int mGenCamLowDynamicsCounter
Definition CaService.h:56
bool mFixedRate
Definition CaService.h:55
float ComputeYawRate()
bool CheckHeadingDelta(float DeltaSeconds)
float mGenCam
Definition CaService.h:51
carla::geom::Vector3D ComputeAccelerometer(const float DeltaTime)
FVector mLastCamHeading
Definition CaService.h:66
ITSContainer::StationType_t GetStationType()
std::array< FVector, 2 > PrevLocation
Used to compute the acceleration
Definition CaService.h:92
long mStationId
Definition CaService.h:83
double mElapsedTime
Definition CaService.h:52
float LatitudeBias
Definition CaService.h:105
std::chrono::milliseconds mGenerationDelta0
Definition CaService.h:67
float mLastCamSpeed
Definition CaService.h:65
FVector StdDevAccel
Standard deviation for acceleration settings.
Definition CaService.h:89
CaService(URandomEngine *random_engine)
Definition CaService.cpp:33
long mStationType
Definition CaService.h:84
FCarlaActor * mCarlaActor
Definition CaService.h:43
unsigned int mGenCamLowDynamicsLimit
Definition CaService.h:57
float GetHeading()
carla::geom::GeoLocation CurrentGeoReference
Definition CaService.h:99
bool CheckPositionDelta(float DeltaSeconds)
void AddLowFrequencyContainer(CAMContainer::LowFrequencyContainer_t &lfc)
void AddBasicVehicleContainerHighFrequency(CAMContainer::HighFrequencyContainer_t &hfc, float DeltaTime)
float mGenCamMax
Definition CaService.h:50
float YawrateBias
Definition CaService.h:118
CAM_t GetCamMessage()
float mGenDeltaTimeMod
Definition CaService.h:53
URandomEngine * mRandomEngine
Definition CaService.h:130
float HeadingBias
Definition CaService.h:108
float VehicleSpeed
Definition CaService.h:60
ITSContainer::SpeedValue_t BuildSpeedValue(const float vel)
Definition CaService.cpp:15
long GetVehicleRole()
void GenerateCamMessage(float DeltaTime)
bool CheckSpeedDelta(float DeltaSeconds)
ACarlaWheeledVehicle * mVehicle
Definition CaService.h:46
const float ComputeYawNoise(const FVector &Gyroscope)
AActor * mActorOwner
Definition CaService.h:42
float PrevDeltaTime
Used to compute the acceleration
Definition CaService.h:95
float ComputeSpeed()
void SetParams(const float GenCamMin, const float GenCamMax, const bool FixedRate)
Definition CaService.cpp:90
void AddRSUContainerHighFrequency(CAMContainer::HighFrequencyContainer_t &hfc)
double GetFVectorAngle(const FVector &a, const FVector &b)
float AltitudeDeviation
Definition CaService.h:102
CAM_t CreateCooperativeAwarenessMessage(float DeltaTime)
FVector VehicleHeading
Definition CaService.h:62
bool CheckTriggeringConditions(float DeltaSeconds)
float mLastLowCamTimeStamp
Definition CaService.h:48
void AddCooperativeAwarenessMessage(CAMContainer::CoopAwareness_t &CoopAwarenessMessage, float DeltaTime)
FVector VehiclePosition
Definition CaService.h:61
void AddBasicContainer(CAMContainer::BasicContainer_t &BasicContainer)
A view over an actor and its properties.
Definition CarlaActor.h:25
long StationType_t
Definition LibITS.h:148
long SpeedValue_t
Definition LibITS.h:195
@ messageID_cam
Definition LibITS.h:164
A simulation episode.
Definition LibITS.h:761