CARLA
 
载入中...
搜索中...
未找到
CaService.cpp
浏览该文件的文档.
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#include "Carla.h"
8#include "CaService.h"
9#include <boost/algorithm/clamp.hpp>
10#include "carla/rpc/String.h"
12#include <chrono>
13static const float scLowFrequencyContainerInterval = 0.5;
14
16{
17 static const float lower = 0.0; // meter_per_second
18 static const float upper = 163.82; // meter_per_second
19
21 if (vel >= upper)
22 {
23 speed = 16382; // see CDD A.74 (TS 102 894 v1.2.1)
24 }
25 else if (vel >= lower)
26 {
27 // to cm per second
28 speed = std::round(vel * 100.0) * ITSContainer::SpeedValue_oneCentimeterPerSec;
29 }
30 return speed;
31}
32
34{
35 mRandomEngine = random_engine;
36 // The starting point now
37 std::chrono::system_clock::time_point start_Point = std::chrono::system_clock::now();
38 // the reference point for ETSI (2004-01-01T00:00:00:000Z)
39 std::chrono::system_clock::time_point ref_point = std::chrono::system_clock::from_time_t(1072915200); // Unix time for 2004-01-01
40
41 mGenerationDelta0 = std::chrono::duration_cast<std::chrono::milliseconds>(start_Point - ref_point);
42}
43
44void CaService::SetOwner(UWorld *world, AActor *Owner)
45{
46 UE_LOG(LogCarla, Warning, TEXT("CaService:SetOwner function called"));
47 mWorld = world;
49
51
52 mActorOwner = Owner;
55
56 if (mCarlaActor != nullptr)
57 {
58 mVehicle = Cast<ACarlaWheeledVehicle>(Owner);
59
61 {
62 UE_LOG(LogCarla, Warning, TEXT("CaService:Initialize Vehicle type"));
63
66 // Can add logic for this later
67 mDccRestriction = false;
68
69 mElapsedTime = 0;
70 VehicleSpeed = 0;
71 VehiclePosition = {0, 0, 0};
72 VehicleHeading = {0, 0, 0};
73 mLastCamSpeed = 0;
74 mLastCamPosition = {0, 0, 0};
75 mLastCamHeading = {0, 0, 0};
76 }
79 {
82 UE_LOG(LogCarla, Warning, TEXT("CaService:Initialize RSU type"));
83 }
84
85 mStationId = static_cast<long>(mCarlaActor->GetActorId());
87 }
88}
89
90void CaService::SetParams(const float GenCamMin, const float GenCamMax, const bool FixedRate)
91{
92 UE_LOG(LogCarla, Warning, TEXT("CaService:SetParams function called"));
93 // Max and Min for generation rate
94
95 mGenCamMin = GenCamMin; // in second
96 mGenCamMax = GenCamMax; // in second
98 // If we want set a fix interval make this as true
99 mFixedRate = FixedRate;
100}
101
102/*
103 * Function to check trigger condition for RSU
104 */
105bool CaService::Trigger(float DeltaSeconds)
106{
107
109 bool Trigger = false;
111 {
113 {
114 Trigger = true;
117 }
118 }
119 else
120 {
121 Trigger = CheckTriggeringConditions(DeltaSeconds);
122 }
123 return Trigger;
124}
125
126/*
127 * Function to provide CAM message to other objects if necessary
128 */
133
134/*
135 * Check the trigger condition in case of vehicles and if trigger is true request
136 * to generate CAM message
137 */
139{
140 float &T_GenCam = mGenCam;
141 const float T_GenCamMin = mGenCamMin;
142 const float T_GenCamMax = mGenCamMax;
143 const float T_GenCamDcc = mDccRestriction ? 0 : T_GenCamMin;
144 const float T_elapsed = mElapsedTime - mLastCamTimeStamp;
145 if (T_elapsed >= T_GenCamDcc)
146 {
147 // If message need to be generated every sim tick then set this to true.
148 if (mFixedRate)
149 {
150 GenerateCamMessage(DeltaSeconds);
151 return true;
152 }
153
154 else if (CheckHeadingDelta(DeltaSeconds) || CheckPositionDelta(DeltaSeconds) || CheckSpeedDelta(DeltaSeconds))
155 {
156 GenerateCamMessage(DeltaSeconds);
157 T_GenCam = std::min(T_elapsed, T_GenCamMax);
159 return true;
160 }
161 else if (T_elapsed >= T_GenCam)
162 {
163 GenerateCamMessage(DeltaSeconds);
165 {
166 T_GenCam = T_GenCamMax;
167 }
168 return true;
169 }
170 }
171 return false;
172}
173
174bool CaService::CheckPositionDelta(float DeltaSeconds)
175{
176 // If position change is more the 4m
177 VehiclePosition = mVehicle->GetActorLocation();
178 double Distance = FVector::Distance(VehiclePosition, mLastCamPosition) / 100.0f; // From cm to m
179 if (Distance > 4.0f)
180 {
181 return true;
182 }
183 return false;
184}
185
186bool CaService::CheckSpeedDelta(float DeltaSeconds)
187{
188 VehicleSpeed = mVehicle->GetVehicleForwardSpeed() / 100.0f; // From cm/s to m/s
189 float DeltaSpeed = std::abs(VehicleSpeed - mLastCamSpeed);
190
191 // Speed differance is greater than 0.5m/s
192 if (DeltaSpeed > 0.5)
193 {
194 return true;
195 }
196
197 return false;
198}
199
200double CaService::GetFVectorAngle(const FVector &a, const FVector &b)
201{
202 double Dot = a.X * b.X + a.Y * b.Y + a.Z * b.Z;
203 return std::acos(Dot / (a.Size() * b.Size()));
204}
205
214
215// Function to get the station type
217{
218 check(mActorOwner != nullptr);
222 // return unknown if carla actor is gone
223 if (mCarlaActor == nullptr)
224 {
225 return static_cast<long>(stationType);
226 }
227 auto Tag = ATagger::GetTagOfTaggedComponent(*mVehicle->GetMesh());
228
229 switch (Tag)
230 {
231 case crp::CityObjectLabel::None:
233 break;
234 case crp::CityObjectLabel::Pedestrians:
236 break;
237 case crp::CityObjectLabel::Bicycle:
239 break;
240 case crp::CityObjectLabel::Motorcycle:
242 break;
243 case crp::CityObjectLabel::Car:
245 break;
246 case crp::CityObjectLabel::Bus:
247 stationType = ITSContainer::StationType_bus;
248 break;
249 // TODO Modify this in future is CARLA adds difference truck
250 case crp::CityObjectLabel::Truck:
252 break;
253 case crp::CityObjectLabel::Buildings:
254 case crp::CityObjectLabel::Walls:
255 case crp::CityObjectLabel::Fences:
256 case crp::CityObjectLabel::Poles:
257 case crp::CityObjectLabel::TrafficLight:
258 case crp::CityObjectLabel::TrafficSigns:
260 break;
261 case crp::CityObjectLabel::Train:
262 stationType = ITSContainer::StationType_tram;
263 break;
264 default:
266 }
267
268 // Can improve this later for different special vehicles once carla implements it
271 {
272 if (mCarlaActor->GetActorInfo()->Description.Variations.Contains("special_type"))
273 {
274 std::string special_type = carla::rpc::FromFString(*mCarlaActor->GetActorInfo()->Description.Variations["special_type"].Value);
275 if (special_type.compare("emergency") == 0)
276 {
278 }
279 }
280 }
281 return static_cast<long>(stationType);
282}
283
285{
286 FVector RefPos;
287 carla::geom::Location ActorLocation = mActorOwner->GetActorLocation();
289 if (LargeMap)
290 {
291 ActorLocation = LargeMap->LocalToGlobalLocation(ActorLocation);
292 }
293 carla::geom::Location Location = ActorLocation;
294 carla::geom::GeoLocation CurrentLocation = CurrentGeoReference.Transform(Location);
295
296 // Compute the noise for the sensor
297 const float LatError = mRandomEngine->GetNormalDistribution(0.0f, LatitudeDeviation);
298 const float LonError = mRandomEngine->GetNormalDistribution(0.0f, LongitudeDeviation);
299 const float AltError = mRandomEngine->GetNormalDistribution(0.0f, AltitudeDeviation);
300
301 // Apply the noise to the sensor
302 double Latitude = CurrentLocation.latitude + LatitudeBias + LatError;
303 double Longitude = CurrentLocation.longitude + LongitudeBias + LonError;
304 double Altitude = CurrentLocation.altitude + AltitudeBias + AltError;
305
306 RefPos.X = Latitude;
307 RefPos.Y = Longitude;
308 RefPos.Z = Altitude;
309 return RefPos;
310}
311
313{
314 // Magnetometer: orientation with respect to the North in rad
315 const FVector CarlaNorthVector = FVector(0.0f, -1.0f, 0.0f);
316 const FVector ForwVect = mActorOwner->GetActorForwardVector().GetSafeNormal2D();
317 const float DotProd = FVector::DotProduct(CarlaNorthVector, ForwVect);
318
319 // We check if the dot product is higher than 1.0 due to numerical error
320 if (DotProd >= 1.00f)
321 return 0.0f;
322
323 float Heading = std::acos(DotProd);
324 // Keep the angle between [0, 2pi)
325 if (FVector::CrossProduct(CarlaNorthVector, ForwVect).Z < 0.0f)
326 Heading = carla::geom::Math::Pi2<float>() - Heading;
327
328 const double HeadingDegree = carla::geom::Math::ToDegrees(Heading);
329
330 // Compute the noise for the sensor
331 const float HeadingError = mRandomEngine->GetNormalDistribution(0.0f, HeadingDeviation);
332
333 // add errors
334 return HeadingDegree + HeadingBias + HeadingError;
335}
336
337// Function to get the vehicle role
339{
340 long VehicleRole = ITSContainer::VehicleRole_default;
341 long StationType = GetStationType();
342 switch (StationType)
343 {
348 break;
352 break;
355 break;
356 default:
358 break;
359 }
360 return VehicleRole;
361}
362
364{
365 CAM_t message = CAM_t();
366
367 CreateITSPduHeader(message);
368 AddCooperativeAwarenessMessage(message.cam, DeltaTime);
369
370 return message;
371}
372
374{
375 ITSContainer::ItsPduHeader_t &header = message.header;
377 header.messageID = mMessageId;
378 header.stationID = mStationId;
379}
380
382{
383
384 /* GenerationDeltaTime */
385 auto genDeltaTime = mGenerationDelta0 + std::chrono::milliseconds(static_cast<long long>(mCarlaEpisode->GetElapsedGameTime() * 1000));
386 CoopAwarenessMessage.generationDeltaTime = genDeltaTime.count() % 65536 * CAMContainer::GenerationDeltaTime_oneMilliSec; // TODOCheck this logic
387 AddBasicContainer(CoopAwarenessMessage.camParameters.basicContainer);
389 {
390 // TODO Future Implementation
392 }
394 {
395 // TODO no container available for Pedestrains
396 }
397 else
398 {
399 // BasicVehicleContainer
401
403 {
406 }
407 else
408 {
409 // Store nothing if not used
411 }
412 /*
413 *TODO Add Special container if it a special vehicle
414 */
415 }
416}
417
432
434{
435 StdDevAccel = Vec;
436}
437
438void CaService::SetGNSSDeviation(const float noise_lat_stddev,
439 const float noise_lon_stddev,
440 const float noise_alt_stddev,
441 const float noise_head_stddev,
442 const float noise_lat_bias,
443 const float noise_lon_bias,
444 const float noise_alt_bias,
445 const float noise_head_bias)
446{
447 LatitudeDeviation = noise_lat_stddev;
448 LongitudeDeviation = noise_lon_stddev;
449 AltitudeDeviation = noise_alt_stddev;
450 HeadingDeviation = noise_head_stddev;
451 LatitudeBias = noise_lat_bias;
452 LongitudeBias = noise_lon_bias;
453 AltitudeBias = noise_alt_bias;
454 HeadingBias = noise_head_bias;
455}
456
457void CaService::SetVelDeviation(const float noise_vel_stddev_x)
458{
459 VelocityDeviation = noise_vel_stddev_x;
460}
461
462void CaService::SetYawrateDeviation(const float noise_yawrate_stddev, const float noise_yawrate_bias)
463{
464 YawrateDeviation = noise_yawrate_stddev;
465 YawrateBias = noise_yawrate_bias;
466}
467
469{
472 // heading
473 bvc.heading.headingValue = std::round(GetHeading() * 10.0);
475 // speed
476 // speed with noise
479 // direction
481 // length and width
483 float length = bb.Extent.X * 2.0; // half box
484 float width = bb.Extent.Y * 2.0; // half box
485
486 bvc.vehicleLength.vehicleLengthValue = std::round(length * 10.0); // 0.1 meter
488 bvc.vehicleWidth = std::round(width * 10.0); // 0.1 meter
489
490 // acceleration
492
493 const double lonAccelValue = Accel.x * 10.0; // m/s to 0.1 m/s
494 // limit changes
495 if (lonAccelValue >= -160.0 && lonAccelValue <= 161.0)
496 {
498 }
499 else
500 {
502 }
504
505 // curvature TODO
509
510 // yaw rate is in rad/s --> to centidegree per second
512 if (bvc.yawRate.yawRateValue < -32766 || bvc.yawRate.yawRateValue > 32766)
513 {
515 }
517
518 // optional lat and vertical accelerations
520 const double latAccelValue = Accel.y * 10.0; // m/s to 0.1 m/s
521 if (latAccelValue >= -160.0 && latAccelValue <= 161.0)
522 {
524 }
525 else
526 {
528 }
530
532 const double vertAccelValue = Accel.z * 10.0; // m/s to 0.1 m/s
533 if (vertAccelValue >= -160.0 && vertAccelValue <= 161.0)
534 {
536 }
537 else
538 {
540 }
542
543 // TODO
545 bvc.lanePositionAvailable = false;
546 bvc.steeringWheelAngleAvailable = false;
547 bvc.performanceClassAvailable = false;
548 bvc.cenDsrcTollingZoneAvailable = false;
549}
550
552 const FVector &Accelerometer)
553{
554 // Normal (or Gaussian or Gauss) distribution will be used as noise function.
555 // A mean of 0.0 is used as a first parameter, the standard deviation is
556 // determined by the client
557 constexpr float Mean = 0.0f;
559 Accelerometer.X + mRandomEngine->GetNormalDistribution(Mean, StdDevAccel.X),
560 Accelerometer.Y + mRandomEngine->GetNormalDistribution(Mean, StdDevAccel.Y),
561 Accelerometer.Z + mRandomEngine->GetNormalDistribution(Mean, StdDevAccel.Z)};
562}
563
565 const float DeltaTime)
566{
567 // Used to convert from UE4's cm to meters
568 constexpr float TO_METERS = 1e-2;
569 // Earth's gravitational acceleration is approximately 9.81 m/s^2
570 constexpr float GRAVITY = 9.81f;
571
572 // 2nd derivative of the polynomic (quadratic) interpolation
573 // using the point in current time and two previous steps:
574 // d2[i] = -2.0*(y1/(h1*h2)-y2/((h2+h1)*h2)-y0/(h1*(h2+h1)))
575 const FVector CurrentLocation = mVehicle->GetActorLocation();
576
577 const FVector Y2 = PrevLocation[0];
578 const FVector Y1 = PrevLocation[1];
579 const FVector Y0 = CurrentLocation;
580 const float H1 = DeltaTime;
581 const float H2 = PrevDeltaTime;
582
583 const float H1AndH2 = H2 + H1;
584 const FVector A = Y1 / (H1 * H2);
585 const FVector B = Y2 / (H2 * (H1AndH2));
586 const FVector C = Y0 / (H1 * (H1AndH2));
587 FVector FVectorAccelerometer = TO_METERS * -2.0f * (A - B - C);
588
589 // Update the previous locations
591 PrevLocation[1] = CurrentLocation;
592 PrevDeltaTime = DeltaTime;
593
594 // Add gravitational acceleration
595 FVectorAccelerometer.Z += GRAVITY;
596
597 FQuat ImuRotation = mActorOwner->GetRootComponent()->GetComponentTransform().GetRotation();
598 FVectorAccelerometer = ImuRotation.UnrotateVector(FVectorAccelerometer);
599
600 // Cast from FVector to our Vector3D to correctly send the data in m/s^2
601 // and apply the desired noise function, in this case a normal distribution
602 const carla::geom::Vector3D Accelerometer =
603 ComputeAccelerometerNoise(FVectorAccelerometer);
604
605 return Accelerometer;
606}
607
609{
610
611 const float speed = mVehicle->GetVehicleForwardSpeed() / 100.0f;
612
613 // Normal (or Gaussian or Gauss) distribution and a bias will be used as
614 // noise function.
615 // A mean of 0.0 is used as a first parameter.The standard deviation and the
616 // bias are determined by the client
617 constexpr float Mean = 0.0f;
618 return boost::algorithm::clamp(speed + mRandomEngine->GetNormalDistribution(Mean, VelocityDeviation), 0.0f, std::numeric_limits<float>::max());
619}
620
622{
623 check(mActorOwner != nullptr);
624 const FVector AngularVelocity =
626
627 const FQuat SensorLocalRotation =
628 mActorOwner->GetRootComponent()->GetRelativeTransform().GetRotation();
629
630 const FVector FVectorGyroscope =
631 SensorLocalRotation.RotateVector(AngularVelocity);
632
633 // Cast from FVector to our Vector3D to correctly send the data in rad/s
634 // and apply the desired noise function, in this case a normal distribution
635 float yawrate =
636 ComputeYawNoise(FVectorGyroscope);
637
638 return yawrate; // rad/s
639}
640
642 const FVector &Gyroscope)
643{
644 // Normal (or Gaussian or Gauss) distribution and a bias will be used as
645 // noise function.
646 // A mean of 0.0 is used as a first parameter.The standard deviation and the
647 // bias are determined by the client
648 constexpr float Mean = 0.0f;
650}
651
653{
654 // Define the epoch time (2004-01-01T00:00:00.000Z)
655 std::tm epoch_time = {};
656 epoch_time = {0, 0, 0, 1, 0, 104}; // January 1, 2004
657
658 // Convert epoch time to a std::chrono::time_point
659 std::chrono::system_clock::time_point epoch = std::chrono::system_clock::from_time_t(std::mktime(&epoch_time));
660
661 // Get the current time
662 std::chrono::system_clock::time_point now = std::chrono::system_clock::now();
663
664 // Calculate the duration since the epoch in milliseconds
665 std::chrono::milliseconds duration = std::chrono::duration_cast<std::chrono::milliseconds>(now - epoch);
666
667 // Return the number of milliseconds as a long
668 return duration.count();
669}
670
672{
675 // TODO For future implementation ITSContainer::ProtectedCommunicationZonesRSU_t PCZR
676
677 uint8_t ProtectedZoneDataLength = 16; // Maximum number of elements in path history
678
679 for (uint8_t i = 0; i <= ProtectedZoneDataLength; ++i)
680 {
683 PCZ.expiryTimeAvailable = false;
684 PCZ.protectedZoneLatitude = 50;
685 PCZ.protectedZoneLongitude = 50;
687 PCZ.protectedZoneIDAvailable = false;
688 rsu.protectedCommunicationZonesRSU.list.push_back(PCZ);
690 }
691}
692
694{
697
698 /*Vehicle Role*/
700
701 /*Exterior Lights*/
702 uint8_t *buf = &bvc.exteriorLights;
704 if (LightStateData.LowBeam)
705 {
707 }
708 if (LightStateData.HighBeam)
709 {
711 }
712 if (LightStateData.LeftBlinker)
713 {
715 }
716 if (LightStateData.RightBlinker)
717 {
719 }
720 if (LightStateData.Reverse)
721 {
723 }
724 if (LightStateData.Fog)
725 {
726 buf[0] |= 1 << (7 - ITSContainer::ExteriorLights_fogLightOn);
727 }
728 if (LightStateData.Position)
729 {
731 }
733}
734
735bool CaService::CheckHeadingDelta(float DeltaSeconds)
736{
737 // if heading diff is more than 4degree
740 if (HeadingDelta > 4.0)
741 {
742 return true;
743 }
744 return false;
745}
static const float scLowFrequencyContainerInterval
Definition CaService.cpp:13
long millisecondsSince2004()
static FVector FIMU_GetActorAngularVelocityInRadians(AActor &Actor)
struct CAM CAM_t
FVehicleLightState GetVehicleLightState() const
FVector GetVehicleOrientation() const
Orientation vector of the vehicle, pointing forward.
float GetVehicleForwardSpeed() const
Forward speed in cm/s. Might be negative if goes backwards.
FVector LocalToGlobalLocation(const FVector &InLocation) const
static crp::CityObjectLabel GetTagOfTaggedComponent(const UPrimitiveComponent &Component)
Retrieve the tag of an already tagged component.
Definition Tagger.h:52
@ GenerationDeltaTime_oneMilliSec
Definition LibITS.h:640
@ HighFrequencyContainer_PR_basicVehicleContainerHighFrequency
Definition LibITS.h:657
@ HighFrequencyContainer_PR_rsuContainerHighFrequency
Definition LibITS.h:658
@ LowFrequencyContainer_PR_basicVehicleContainerLowFrequency
Definition LibITS.h:719
@ LowFrequencyContainer_PR_NOTHING
Definition LibITS.h:718
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()
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)
ActorType GetActorType() const
Definition CarlaActor.h:86
const FActorInfo * GetActorInfo() const
Definition CarlaActor.h:101
IdType GetActorId() const
Definition CarlaActor.h:81
@ YawRateConfidence_unavailable
Definition LibITS.h:366
@ ProtectedZoneType_cenDsrcTolling
Definition LibITS.h:492
@ LateralAccelerationValue_unavailable
Definition LibITS.h:436
@ LateralAccelerationValue_pointOneMeterPerSecSquaredToLeft
Definition LibITS.h:435
@ AltitudeConfidence_unavailable
Definition LibITS.h:107
@ LongitudinalAccelerationValue_pointOneMeterPerSecSquaredForward
Definition LibITS.h:272
@ LongitudinalAccelerationValue_unavailable
Definition LibITS.h:274
@ AltitudeValue_oneCentimeter
Definition LibITS.h:82
@ YawRateValue_unavailable
Definition LibITS.h:350
@ YawRateValue_degSec_000_01ToLeft
Definition LibITS.h:349
@ DriveDirection_forward
Definition LibITS.h:219
@ DriveDirection_backward
Definition LibITS.h:220
long StationType_t
Definition LibITS.h:148
@ SemiAxisLength_unavailable
Definition LibITS.h:40
@ Longitude_oneMicroDegreeEast
Definition LibITS.h:27
@ Latitude_oneMicroDegreeNorth
Definition LibITS.h:16
long SpeedValue_t
Definition LibITS.h:195
@ StationType_passengerCar
Definition LibITS.h:137
@ StationType_moped
Definition LibITS.h:135
@ StationType_lightTruck
Definition LibITS.h:139
@ StationType_specialVehicles
Definition LibITS.h:142
@ StationType_tram
Definition LibITS.h:143
@ StationType_motorcycle
Definition LibITS.h:136
@ StationType_unknown
Definition LibITS.h:132
@ StationType_cyclist
Definition LibITS.h:134
@ StationType_roadSideUnit
Definition LibITS.h:144
@ StationType_bus
Definition LibITS.h:138
@ StationType_pedestrian
Definition LibITS.h:133
@ ExteriorLights_reverseLightOn
Definition LibITS.h:567
@ ExteriorLights_highBeamHeadlightsOn
Definition LibITS.h:563
@ ExteriorLights_lowBeamHeadlightsOn
Definition LibITS.h:562
@ ExteriorLights_leftTurnSignalOn
Definition LibITS.h:564
@ ExteriorLights_rightTurnSignalOn
Definition LibITS.h:565
@ ExteriorLights_parkingLightsOn
Definition LibITS.h:569
@ ExteriorLights_fogLightOn
Definition LibITS.h:568
@ CurvatureCalculationMode_yarRateUsed
Definition LibITS.h:336
@ VehicleRole_publicTransport
Definition LibITS.h:540
@ VehicleRole_default
Definition LibITS.h:539
@ VehicleRole_emergency
Definition LibITS.h:545
@ CurvatureValue_unavailable
Definition LibITS.h:304
@ VerticalAccelerationValue_unavailable
Definition LibITS.h:453
@ VerticalAccelerationValue_pointOneMeterPerSecSquaredUp
Definition LibITS.h:451
@ AccelerationConfidence_unavailable
Definition LibITS.h:285
@ VehicleLengthConfidenceIndication_unavailable
Definition LibITS.h:245
@ HeadingValue_unavailable
Definition LibITS.h:53
@ HeadingConfidence_equalOrWithinOneDegree
Definition LibITS.h:62
@ SpeedValue_unavailable
Definition LibITS.h:191
@ SpeedValue_oneCentimeterPerSec
Definition LibITS.h:190
@ SpeedConfidence_equalOrWithInOneCentimerterPerSec
Definition LibITS.h:200
@ CurvatureConfidence_unavailable
Definition LibITS.h:320
static FBoundingBox GetActorBoundingBox(const AActor *Actor, uint8 InTagQueried=0xFF)
Compute the bounding box of the given Carla actor.
FCarlaActor * FindCarlaActor(FCarlaActor::IdType ActorId)
Find a Carla actor by id.
double GetElapsedGameTime() const
Game seconds since the start of this episode.
const carla::geom::GeoLocation & GetGeoReference() const
Return the GeoLocation point of the map loaded
static ALargeMapManager * GetLargeMapManager(const UObject *WorldContextObject)
static UCarlaEpisode * GetCurrentEpisode(const UObject *WorldContextObject)
float GetNormalDistribution(float Mean, float StandardDeviation)
GeoLocation Transform(const Location &location) const
Transform the given location to a GeoLocation using this as geo-reference.
static constexpr T ToDegrees(T rad)
Definition Math.h:37
ITSContainer::ReferencePosition_t referencePosition
Definition LibITS.h:650
ITSContainer::StationType_t stationType
Definition LibITS.h:649
ITSContainer::VehicleLength_t vehicleLength
Definition LibITS.h:669
ITSContainer::LateralAcceleration_t lateralAcceleration
Definition LibITS.h:686
ITSContainer::VehicleWidth_t vehicleWidth
Definition LibITS.h:670
OptionalStructAvailable_t lateralAccelerationAvailable
Definition LibITS.h:685
ITSContainer::CurvatureCalculationMode_t curvatureCalculationMode
Definition LibITS.h:673
OptionalStructAvailable_t verticalAccelerationAvailable
Definition LibITS.h:688
OptionalStructAvailable_t performanceClassAvailable
Definition LibITS.h:691
OptionalStructAvailable_t lanePositionAvailable
Definition LibITS.h:679
ITSContainer::DriveDirection_t driveDirection
Definition LibITS.h:668
OptionalStructAvailable_t accelerationControlAvailable
Definition LibITS.h:676
OptionalStructAvailable_t steeringWheelAngleAvailable
Definition LibITS.h:682
ITSContainer::VerticalAcceleration_t verticalAcceleration
Definition LibITS.h:689
OptionalStructAvailable_t cenDsrcTollingZoneAvailable
Definition LibITS.h:694
ITSContainer::LongitudinalAcceleration_t longitudinalAcceleration
Definition LibITS.h:671
ITSContainer::ExteriorLights_t exteriorLights
Definition LibITS.h:727
ITSContainer::PathHistory_t pathHistory
Definition LibITS.h:728
ITSContainer::VehicleRole_t vehicleRole
Definition LibITS.h:726
HighFrequencyContainer_t highFrequencyContainer
Definition LibITS.h:744
BasicContainer_t basicContainer
Definition LibITS.h:743
LowFrequencyContainer_t lowFrequencyContainer
Definition LibITS.h:745
GenerationDeltaTime_t generationDeltaTime
Definition LibITS.h:752
CamParameters_t camParameters
Definition LibITS.h:753
RSUContainerHighFrequency_t rsuContainerHighFrequency
Definition LibITS.h:711
BasicVehicleContainerHighFrequency_t basicVehicleContainerHighFrequency
Definition LibITS.h:710
HighFrequencyContainer_PR present
Definition LibITS.h:708
BasicVehicleContainerLowFrequency_t basicVehicleContainerLowFrequency
Definition LibITS.h:736
LowFrequencyContainer_PR present
Definition LibITS.h:734
ITSContainer::ProtectedCommunicationZonesRSU_t protectedCommunicationZonesRSU
Definition LibITS.h:702
Definition LibITS.h:761
CAMContainer::CoopAwareness_t cam
Definition LibITS.h:763
ITSContainer::ItsPduHeader_t header
Definition LibITS.h:762
TMap< FString, FActorAttribute > Variations
User selected variations of the actor.
FActorDescription Description
Definition ActorInfo.h:26
AltitudeValue_t altitudeValue
Definition LibITS.h:116
AltitudeConfidence_t altitudeConfidence
Definition LibITS.h:117
CurvatureValue_t curvatureValue
Definition LibITS.h:329
CurvatureConfidence_t curvatureConfidence
Definition LibITS.h:330
HeadingValue_t headingValue
Definition LibITS.h:182
HeadingConfidence_t headingConfidence
Definition LibITS.h:183
LateralAccelerationValue_t lateralAccelerationValue
Definition LibITS.h:445
AccelerationConfidence_t lateralAccelerationConfidence
Definition LibITS.h:446
LongitudinalAccelerationValue_t longitudinalAccelerationValue
Definition LibITS.h:294
AccelerationConfidence_t longitudinalAccelerationConfidence
Definition LibITS.h:295
SemiAxisLength_t semiMinorConfidence
Definition LibITS.h:74
HeadingValue_t semiMajorOrientation
Definition LibITS.h:75
SemiAxisLength_t semiMajorConfidence
Definition LibITS.h:73
OptionalValueAvailable_t protectedZoneRadiusAvailable
Definition LibITS.h:526
OptionalValueAvailable_t protectedZoneIDAvailable
Definition LibITS.h:528
ProtectedZoneType_t protectedZoneType
Definition LibITS.h:520
OptionalValueAvailable_t expiryTimeAvailable
Definition LibITS.h:522
std::vector< ProtectedCommunicationZone_t > list
Definition LibITS.h:534
PosConfidenceEllipse_t positionConfidenceEllipse
Definition LibITS.h:125
VehicleLengthConfidenceIndication_t vehicleLengthConfidenceIndication
Definition LibITS.h:255
VehicleLengthValue_t vehicleLengthValue
Definition LibITS.h:254
VerticalAccelerationValue_t verticalAccelerationValue
Definition LibITS.h:462
AccelerationConfidence_t verticalAccelerationConfidence
Definition LibITS.h:463
YawRateConfidence_t yawRateConfidence
Definition LibITS.h:376
YawRateValue_t yawRateValue
Definition LibITS.h:375
SpeedConfidence_t speedConfidence
Definition LibITS.h:213
SpeedValue_t speedValue
Definition LibITS.h:212