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
50 CurrentGeoReference = mCarlaEpisode->GetGeoReference();
51
52 mActorOwner = Owner;
54 mCarlaActor = mCarlaEpisode->FindCarlaActor(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
64 mLastCamTimeStamp = mCarlaEpisode->GetElapsedGameTime() - mGenCamMax;
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 // 生成速率的最大值和最小值
94
95 mGenCamMin = GenCamMin; // 以秒为单位
96 mGenCamMax = GenCamMax; // 以秒为单位
98 // 如果想设置一个固定的间隔,将此项设置为 true
99 mFixedRate = FixedRate;
100}
101
102/*
103 * 检查RSU触发条件的函数
104 */
105bool CaService::Trigger(float DeltaSeconds)
106{
107
108 mElapsedTime = mCarlaEpisode->GetElapsedGameTime();
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 * 如果需要,向其他对象提供CAM消息的函数
128 */
133
134/*
135 * 检查车辆的触发条件,如果触发条件为真,则请求生成CAM消息
136 */
138{
139 float &T_GenCam = mGenCam;
140 const float T_GenCamMin = mGenCamMin;
141 const float T_GenCamMax = mGenCamMax;
142 const float T_GenCamDcc = mDccRestriction ? 0 : T_GenCamMin;
143 const float T_elapsed = mElapsedTime - mLastCamTimeStamp;
144 if (T_elapsed >= T_GenCamDcc)
145 {
146 // If message need to be generated every sim tick then set this to true.
147 if (mFixedRate)
148 {
149 GenerateCamMessage(DeltaSeconds);
150 return true;
151 }
152
153 else if (CheckHeadingDelta(DeltaSeconds) || CheckPositionDelta(DeltaSeconds) || CheckSpeedDelta(DeltaSeconds))
154 {
155 GenerateCamMessage(DeltaSeconds);
156 T_GenCam = std::min(T_elapsed, T_GenCamMax);
158 return true;
159 }
160 else if (T_elapsed >= T_GenCam)
161 {
162 GenerateCamMessage(DeltaSeconds);
164 {
165 T_GenCam = T_GenCamMax;
166 }
167 return true;
168 }
169 }
170 return false;
171}
172
173bool CaService::CheckPositionDelta(float DeltaSeconds)
174{
175 // If position change is more the 4m
176 VehiclePosition = mVehicle->GetActorLocation();
177 double Distance = FVector::Distance(VehiclePosition, mLastCamPosition) / 100.0f; // From cm to m
178 if (Distance > 4.0f)
179 {
180 return true;
181 }
182 return false;
183}
184
185bool CaService::CheckSpeedDelta(float DeltaSeconds)
186{
187 VehicleSpeed = mVehicle->GetVehicleForwardSpeed() / 100.0f; // From cm/s to m/s
188 float DeltaSpeed = std::abs(VehicleSpeed - mLastCamSpeed);
189
190 // Speed differance is greater than 0.5m/s
191 if (DeltaSpeed > 0.5)
192 {
193 return true;
194 }
195
196 return false;
197}
198
199double CaService::GetFVectorAngle(const FVector &a, const FVector &b)
200{
201 double Dot = a.X * b.X + a.Y * b.Y + a.Z * b.Z;
202 return std::acos(Dot / (a.Size() * b.Size()));
203}
204
213
214// Function to get the station type
216{
217 check(mActorOwner != nullptr);
219 mCarlaActor = mCarlaEpisode->FindCarlaActor(mActorOwner);
221 // return unknown if carla actor is gone
222 if (mCarlaActor == nullptr)
223 {
224 return static_cast<long>(stationType);
225 }
226 auto Tag = ATagger::GetTagOfTaggedComponent(*mVehicle->GetMesh());
227
228 switch (Tag)
229 {
230 case crp::CityObjectLabel::None:
232 break;
233 case crp::CityObjectLabel::Pedestrians:
235 break;
236 case crp::CityObjectLabel::Bicycle:
238 break;
239 case crp::CityObjectLabel::Motorcycle:
241 break;
242 case crp::CityObjectLabel::Car:
244 break;
245 case crp::CityObjectLabel::Bus:
246 stationType = ITSContainer::StationType_bus;
247 break;
248 // TODO Modify this in future is CARLA adds difference truck
249 case crp::CityObjectLabel::Truck:
251 break;
252 case crp::CityObjectLabel::Buildings:
253 case crp::CityObjectLabel::Walls:
254 case crp::CityObjectLabel::Fences:
255 case crp::CityObjectLabel::Poles:
256 case crp::CityObjectLabel::TrafficLight:
257 case crp::CityObjectLabel::TrafficSigns:
259 break;
260 case crp::CityObjectLabel::Train:
261 stationType = ITSContainer::StationType_tram;
262 break;
263 default:
265 }
266
267 // Can improve this later for different special vehicles once carla implements it
270 {
271 if (mCarlaActor->GetActorInfo()->Description.Variations.Contains("special_type"))
272 {
273 std::string special_type = carla::rpc::FromFString(*mCarlaActor->GetActorInfo()->Description.Variations["special_type"].Value);
274 if (special_type.compare("emergency") == 0)
275 {
277 }
278 }
279 }
280 return static_cast<long>(stationType);
281}
282
284{
285 FVector RefPos;
286 carla::geom::Location ActorLocation = mActorOwner->GetActorLocation();
288 if (LargeMap)
289 {
290 ActorLocation = LargeMap->LocalToGlobalLocation(ActorLocation);
291 }
292 carla::geom::Location Location = ActorLocation;
293 carla::geom::GeoLocation CurrentLocation = CurrentGeoReference.Transform(Location);
294
295 // Compute the noise for the sensor
296 const float LatError = mRandomEngine->GetNormalDistribution(0.0f, LatitudeDeviation);
297 const float LonError = mRandomEngine->GetNormalDistribution(0.0f, LongitudeDeviation);
298 const float AltError = mRandomEngine->GetNormalDistribution(0.0f, AltitudeDeviation);
299
300 // Apply the noise to the sensor
301 double Latitude = CurrentLocation.latitude + LatitudeBias + LatError;
302 double Longitude = CurrentLocation.longitude + LongitudeBias + LonError;
303 double Altitude = CurrentLocation.altitude + AltitudeBias + AltError;
304
305 RefPos.X = Latitude;
306 RefPos.Y = Longitude;
307 RefPos.Z = Altitude;
308 return RefPos;
309}
310
312{
313 // Magnetometer: orientation with respect to the North in rad
314 const FVector CarlaNorthVector = FVector(0.0f, -1.0f, 0.0f);
315 const FVector ForwVect = mActorOwner->GetActorForwardVector().GetSafeNormal2D();
316 const float DotProd = FVector::DotProduct(CarlaNorthVector, ForwVect);
317
318 // We check if the dot product is higher than 1.0 due to numerical error
319 if (DotProd >= 1.00f)
320 return 0.0f;
321
322 float Heading = std::acos(DotProd);
323 // Keep the angle between [0, 2pi)
324 if (FVector::CrossProduct(CarlaNorthVector, ForwVect).Z < 0.0f)
325 Heading = carla::geom::Math::Pi2<float>() - Heading;
326
327 const double HeadingDegree = carla::geom::Math::ToDegrees(Heading);
328
329 // Compute the noise for the sensor
330 const float HeadingError = mRandomEngine->GetNormalDistribution(0.0f, HeadingDeviation);
331
332 // add errors
333 return HeadingDegree + HeadingBias + HeadingError;
334}
335
336// Function to get the vehicle role
338{
339 long VehicleRole = ITSContainer::VehicleRole_default;
340 long StationType = GetStationType();
341 switch (StationType)
342 {
347 break;
351 break;
354 break;
355 default:
357 break;
358 }
359 return VehicleRole;
360}
361
363{
364 CAM_t message = CAM_t();
365
366 CreateITSPduHeader(message);
367 AddCooperativeAwarenessMessage(message.cam, DeltaTime);
368
369 return message;
370}
371
373{
374 ITSContainer::ItsPduHeader_t &header = message.header;
376 header.messageID = mMessageId;
377 header.stationID = mStationId;
378}
379
381{
382
383 /* GenerationDeltaTime */
384 auto genDeltaTime = mGenerationDelta0 + std::chrono::milliseconds(static_cast<long long>(mCarlaEpisode->GetElapsedGameTime() * 1000));
385 CoopAwarenessMessage.generationDeltaTime = genDeltaTime.count() % 65536 * CAMContainer::GenerationDeltaTime_oneMilliSec; // TODOCheck this logic
386 AddBasicContainer(CoopAwarenessMessage.camParameters.basicContainer);
388 {
389 // TODO Future Implementation
391 }
393 {
394 // TODO no container available for Pedestrains
395 }
396 else
397 {
398 // BasicVehicleContainer
400
402 {
405 }
406 else
407 {
408 // Store nothing if not used
410 }
411 /*
412 *TODO Add Special container if it a special vehicle
413 */
414 }
415}
416
431
433{
434 StdDevAccel = Vec;
435}
436
437void CaService::SetGNSSDeviation(const float noise_lat_stddev,
438 const float noise_lon_stddev,
439 const float noise_alt_stddev,
440 const float noise_head_stddev,
441 const float noise_lat_bias,
442 const float noise_lon_bias,
443 const float noise_alt_bias,
444 const float noise_head_bias)
445{
446 LatitudeDeviation = noise_lat_stddev;
447 LongitudeDeviation = noise_lon_stddev;
448 AltitudeDeviation = noise_alt_stddev;
449 HeadingDeviation = noise_head_stddev;
450 LatitudeBias = noise_lat_bias;
451 LongitudeBias = noise_lon_bias;
452 AltitudeBias = noise_alt_bias;
453 HeadingBias = noise_head_bias;
454}
455
456void CaService::SetVelDeviation(const float noise_vel_stddev_x)
457{
458 VelocityDeviation = noise_vel_stddev_x;
459}
460
461void CaService::SetYawrateDeviation(const float noise_yawrate_stddev, const float noise_yawrate_bias)
462{
463 YawrateDeviation = noise_yawrate_stddev;
464 YawrateBias = noise_yawrate_bias;
465}
466
468{
471 // heading
472 bvc.heading.headingValue = std::round(GetHeading() * 10.0);
474 // speed
475 // speed with noise
478 // direction
480 // length and width
482 float length = bb.Extent.X * 2.0; // half box
483 float width = bb.Extent.Y * 2.0; // half box
484
485 bvc.vehicleLength.vehicleLengthValue = std::round(length * 10.0); // 0.1 meter
487 bvc.vehicleWidth = std::round(width * 10.0); // 0.1 meter
488
489 // acceleration
491
492 const double lonAccelValue = Accel.x * 10.0; // m/s to 0.1 m/s
493 // limit changes
494 if (lonAccelValue >= -160.0 && lonAccelValue <= 161.0)
495 {
497 }
498 else
499 {
501 }
503
504 // curvature TODO
508
509 // yaw rate is in rad/s --> to centidegree per second
511 if (bvc.yawRate.yawRateValue < -32766 || bvc.yawRate.yawRateValue > 32766)
512 {
514 }
516
517 // optional lat and vertical accelerations
519 const double latAccelValue = Accel.y * 10.0; // m/s to 0.1 m/s
520 if (latAccelValue >= -160.0 && latAccelValue <= 161.0)
521 {
523 }
524 else
525 {
527 }
529
531 const double vertAccelValue = Accel.z * 10.0; // m/s to 0.1 m/s
532 if (vertAccelValue >= -160.0 && vertAccelValue <= 161.0)
533 {
535 }
536 else
537 {
539 }
541
542 // TODO
544 bvc.lanePositionAvailable = false;
545 bvc.steeringWheelAngleAvailable = false;
546 bvc.performanceClassAvailable = false;
547 bvc.cenDsrcTollingZoneAvailable = false;
548}
549
551 const FVector &Accelerometer)
552{
553 // Normal (or Gaussian or Gauss) distribution will be used as noise function.
554 // A mean of 0.0 is used as a first parameter, the standard deviation is
555 // determined by the client
556 constexpr float Mean = 0.0f;
558 Accelerometer.X + mRandomEngine->GetNormalDistribution(Mean, StdDevAccel.X),
559 Accelerometer.Y + mRandomEngine->GetNormalDistribution(Mean, StdDevAccel.Y),
560 Accelerometer.Z + mRandomEngine->GetNormalDistribution(Mean, StdDevAccel.Z)};
561}
562
564 const float DeltaTime)
565{
566 // Used to convert from UE4's cm to meters
567 constexpr float TO_METERS = 1e-2;
568 // Earth's gravitational acceleration is approximately 9.81 m/s^2
569 constexpr float GRAVITY = 9.81f;
570
571 // 2nd derivative of the polynomic (quadratic) interpolation
572 // using the point in current time and two previous steps:
573 // d2[i] = -2.0*(y1/(h1*h2)-y2/((h2+h1)*h2)-y0/(h1*(h2+h1)))
574 const FVector CurrentLocation = mVehicle->GetActorLocation();
575
576 const FVector Y2 = PrevLocation[0];
577 const FVector Y1 = PrevLocation[1];
578 const FVector Y0 = CurrentLocation;
579 const float H1 = DeltaTime;
580 const float H2 = PrevDeltaTime;
581
582 const float H1AndH2 = H2 + H1;
583 const FVector A = Y1 / (H1 * H2);
584 const FVector B = Y2 / (H2 * (H1AndH2));
585 const FVector C = Y0 / (H1 * (H1AndH2));
586 FVector FVectorAccelerometer = TO_METERS * -2.0f * (A - B - C);
587
588 // Update the previous locations
590 PrevLocation[1] = CurrentLocation;
591 PrevDeltaTime = DeltaTime;
592
593 // Add gravitational acceleration
594 FVectorAccelerometer.Z += GRAVITY;
595
596 FQuat ImuRotation = mActorOwner->GetRootComponent()->GetComponentTransform().GetRotation();
597 FVectorAccelerometer = ImuRotation.UnrotateVector(FVectorAccelerometer);
598
599 // Cast from FVector to our Vector3D to correctly send the data in m/s^2
600 // and apply the desired noise function, in this case a normal distribution
601 const carla::geom::Vector3D Accelerometer =
602 ComputeAccelerometerNoise(FVectorAccelerometer);
603
604 return Accelerometer;
605}
606
608{
609
610 const float speed = mVehicle->GetVehicleForwardSpeed() / 100.0f;
611
612 // Normal (or Gaussian or Gauss) distribution and a bias will be used as
613 // noise function.
614 // A mean of 0.0 is used as a first parameter.The standard deviation and the
615 // bias are determined by the client
616 constexpr float Mean = 0.0f;
617 return boost::algorithm::clamp(speed + mRandomEngine->GetNormalDistribution(Mean, VelocityDeviation), 0.0f, std::numeric_limits<float>::max());
618}
619
621{
622 check(mActorOwner != nullptr);
623 const FVector AngularVelocity =
625
626 const FQuat SensorLocalRotation =
627 mActorOwner->GetRootComponent()->GetRelativeTransform().GetRotation();
628
629 const FVector FVectorGyroscope =
630 SensorLocalRotation.RotateVector(AngularVelocity);
631
632 // Cast from FVector to our Vector3D to correctly send the data in rad/s
633 // and apply the desired noise function, in this case a normal distribution
634 float yawrate =
635 ComputeYawNoise(FVectorGyroscope);
636
637 return yawrate; // rad/s
638}
639
641 const FVector &Gyroscope)
642{
643 // Normal (or Gaussian or Gauss) distribution and a bias will be used as
644 // noise function.
645 // A mean of 0.0 is used as a first parameter.The standard deviation and the
646 // bias are determined by the client
647 constexpr float Mean = 0.0f;
649}
650
652{
653 // Define the epoch time (2004-01-01T00:00:00.000Z)
654 std::tm epoch_time = {};
655 epoch_time = {0, 0, 0, 1, 0, 104}; // January 1, 2004
656
657 // Convert epoch time to a std::chrono::time_point
658 std::chrono::system_clock::time_point epoch = std::chrono::system_clock::from_time_t(std::mktime(&epoch_time));
659
660 // Get the current time
661 std::chrono::system_clock::time_point now = std::chrono::system_clock::now();
662
663 // Calculate the duration since the epoch in milliseconds
664 std::chrono::milliseconds duration = std::chrono::duration_cast<std::chrono::milliseconds>(now - epoch);
665
666 // Return the number of milliseconds as a long
667 return duration.count();
668}
669
671{
674 // TODO For future implementation ITSContainer::ProtectedCommunicationZonesRSU_t PCZR
675
676 uint8_t ProtectedZoneDataLength = 16; // Maximum number of elements in path history
677
678 for (uint8_t i = 0; i <= ProtectedZoneDataLength; ++i)
679 {
682 PCZ.expiryTimeAvailable = false;
683 PCZ.protectedZoneLatitude = 50;
684 PCZ.protectedZoneLongitude = 50;
686 PCZ.protectedZoneIDAvailable = false;
687 rsu.protectedCommunicationZonesRSU.list.push_back(PCZ);
689 }
690}
691
693{
696
697 /*Vehicle Role*/
699
700 /*Exterior Lights*/
701 uint8_t *buf = &bvc.exteriorLights;
703 if (LightStateData.LowBeam)
704 {
706 }
707 if (LightStateData.HighBeam)
708 {
710 }
711 if (LightStateData.LeftBlinker)
712 {
714 }
715 if (LightStateData.RightBlinker)
716 {
718 }
719 if (LightStateData.Reverse)
720 {
722 }
723 if (LightStateData.Fog)
724 {
725 buf[0] |= 1 << (7 - ITSContainer::ExteriorLights_fogLightOn);
726 }
727 if (LightStateData.Position)
728 {
730 }
732}
733
734bool CaService::CheckHeadingDelta(float DeltaSeconds)
735{
736 // if heading diff is more than 4degree
739 if (HeadingDelta > 4.0)
740 {
741 return true;
742 }
743 return false;
744}
UE_LOG(LogCarla, Log, TEXT("UActorDispatcher::Destroying actor: '%s' %x"), *Id, Actor)
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)
检索已标记组件的标记。
Definition Tagger.h:52
@ GenerationDeltaTime_oneMilliSec
Definition LibITS.h:786
@ HighFrequencyContainer_PR_basicVehicleContainerHighFrequency
Definition LibITS.h:803
@ HighFrequencyContainer_PR_rsuContainerHighFrequency
Definition LibITS.h:804
@ LowFrequencyContainer_PR_basicVehicleContainerLowFrequency
Definition LibITS.h:865
@ LowFrequencyContainer_PR_NOTHING
Definition LibITS.h:864
float LongitudeBias
Definition CaService.h:111
void CreateITSPduHeader(CAM_t &message)
UWorld * mWorld
Definition CaService.h:50
const carla::geom::Vector3D ComputeAccelerometerNoise(const FVector &Accelerometer)
float AltitudeBias
Definition CaService.h:112
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:87
UCarlaEpisode * mCarlaEpisode
Definition CaService.h:49
void SetVelDeviation(const float noise_vel_stddev_x)
float HeadingDeviation
Definition CaService.h:108
float LatitudeDeviation
Definition CaService.h:105
bool mDccRestriction
Definition CaService.h:59
float mGenerationInterval
Definition CaService.h:63
const long mProtocolVersion
Definition CaService.h:86
void SetOwner(UWorld *world, AActor *Owner)
Definition CaService.cpp:44
bool Trigger(float DeltaSeconds)
float YawrateDeviation
Definition CaService.h:122
void SetAccelerationStandardDeviation(const FVector &Vec)
float LongitudeDeviation
Definition CaService.h:106
FVector mLastCamPosition
Definition CaService.h:69
float mLastCamTimeStamp
Definition CaService.h:52
float VelocityDeviation
Definition CaService.h:117
float mGenCamMin
Definition CaService.h:54
CAM_t mCAMMessage
Definition CaService.h:132
void SetYawrateDeviation(const float noise_yawrate_stddev, const float noise_yawrate_bias)
unsigned int mGenCamLowDynamicsCounter
Definition CaService.h:61
bool mFixedRate
Definition CaService.h:60
float ComputeYawRate()
bool CheckHeadingDelta(float DeltaSeconds)
float mGenCam
Definition CaService.h:56
carla::geom::Vector3D ComputeAccelerometer(const float DeltaTime)
FVector mLastCamHeading
Definition CaService.h:71
ITSContainer::StationType_t GetStationType()
std::array< FVector, 2 > PrevLocation
Used to compute the acceleration
Definition CaService.h:97
long mStationId
Definition CaService.h:88
double mElapsedTime
Definition CaService.h:57
float LatitudeBias
Definition CaService.h:110
std::chrono::milliseconds mGenerationDelta0
Definition CaService.h:72
float mLastCamSpeed
Definition CaService.h:70
FVector StdDevAccel
Standard deviation for acceleration settings.
Definition CaService.h:94
CaService(URandomEngine *random_engine)
Definition CaService.cpp:33
long mStationType
Definition CaService.h:89
FCarlaActor * mCarlaActor
Definition CaService.h:48
unsigned int mGenCamLowDynamicsLimit
Definition CaService.h:62
float GetHeading()
carla::geom::GeoLocation CurrentGeoReference
Definition CaService.h:104
bool CheckPositionDelta(float DeltaSeconds)
void AddLowFrequencyContainer(CAMContainer::LowFrequencyContainer_t &lfc)
void AddBasicVehicleContainerHighFrequency(CAMContainer::HighFrequencyContainer_t &hfc, float DeltaTime)
float mGenCamMax
Definition CaService.h:55
float YawrateBias
Definition CaService.h:123
CAM_t GetCamMessage()
URandomEngine * mRandomEngine
Definition CaService.h:135
float HeadingBias
Definition CaService.h:113
float VehicleSpeed
Definition CaService.h:65
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:51
const float ComputeYawNoise(const FVector &Gyroscope)
AActor * mActorOwner
Definition CaService.h:47
float PrevDeltaTime
Used to compute the acceleration
Definition CaService.h:100
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:107
CAM_t CreateCooperativeAwarenessMessage(float DeltaTime)
FVector VehicleHeading
Definition CaService.h:67
bool CheckTriggeringConditions(float DeltaSeconds)
float mLastLowCamTimeStamp
Definition CaService.h:53
void AddCooperativeAwarenessMessage(CAMContainer::CoopAwareness_t &CoopAwarenessMessage, float DeltaTime)
FVector VehiclePosition
Definition CaService.h:66
void AddBasicContainer(CAMContainer::BasicContainer_t &BasicContainer)
ActorType GetActorType() const
Definition CarlaActor.h:71
const FActorInfo * GetActorInfo() const
Definition CarlaActor.h:83
IdType GetActorId() const
Definition CarlaActor.h:67
@ YawRateConfidence_unavailable
Definition LibITS.h:509
@ ProtectedZoneType_cenDsrcTolling
Definition LibITS.h:637
@ LateralAccelerationValue_unavailable
Definition LibITS.h:580
@ LateralAccelerationValue_pointOneMeterPerSecSquaredToLeft
Definition LibITS.h:579
@ AltitudeConfidence_unavailable
Definition LibITS.h:169
@ LongitudinalAccelerationValue_pointOneMeterPerSecSquaredForward
Definition LibITS.h:410
@ LongitudinalAccelerationValue_unavailable
Definition LibITS.h:412
@ AltitudeValue_oneCentimeter
Definition LibITS.h:136
@ YawRateValue_unavailable
Definition LibITS.h:493
@ YawRateValue_degSec_000_01ToLeft
Definition LibITS.h:492
@ DriveDirection_forward
Definition LibITS.h:347
@ DriveDirection_backward
Definition LibITS.h:348
long StationType_t
Definition LibITS.h:242
@ SemiAxisLength_unavailable
Definition LibITS.h:62
@ Longitude_oneMicroDegreeEast
Definition LibITS.h:40
@ Latitude_oneMicroDegreeNorth
Definition LibITS.h:22
long SpeedValue_t
Definition LibITS.h:317
@ StationType_passengerCar
Definition LibITS.h:222
@ StationType_moped
Definition LibITS.h:218
@ StationType_lightTruck
Definition LibITS.h:226
@ StationType_specialVehicles
Definition LibITS.h:232
@ StationType_tram
Definition LibITS.h:234
@ StationType_motorcycle
Definition LibITS.h:220
@ StationType_unknown
Definition LibITS.h:212
@ StationType_cyclist
Definition LibITS.h:216
@ StationType_roadSideUnit
Definition LibITS.h:236
@ StationType_bus
Definition LibITS.h:224
@ StationType_pedestrian
Definition LibITS.h:214
@ ExteriorLights_reverseLightOn
Definition LibITS.h:712
@ ExteriorLights_highBeamHeadlightsOn
Definition LibITS.h:708
@ ExteriorLights_lowBeamHeadlightsOn
Definition LibITS.h:707
@ ExteriorLights_leftTurnSignalOn
Definition LibITS.h:709
@ ExteriorLights_rightTurnSignalOn
Definition LibITS.h:710
@ ExteriorLights_parkingLightsOn
Definition LibITS.h:714
@ ExteriorLights_fogLightOn
Definition LibITS.h:713
@ CurvatureCalculationMode_yarRateUsed
Definition LibITS.h:479
@ VehicleRole_publicTransport
Definition LibITS.h:685
@ VehicleRole_default
Definition LibITS.h:684
@ VehicleRole_emergency
Definition LibITS.h:690
@ CurvatureValue_unavailable
Definition LibITS.h:447
@ VerticalAccelerationValue_unavailable
Definition LibITS.h:597
@ VerticalAccelerationValue_pointOneMeterPerSecSquaredUp
Definition LibITS.h:595
@ AccelerationConfidence_unavailable
Definition LibITS.h:425
@ VehicleLengthConfidenceIndication_unavailable
Definition LibITS.h:377
@ HeadingValue_unavailable
Definition LibITS.h:84
@ HeadingConfidence_equalOrWithinOneDegree
Definition LibITS.h:99
@ SpeedValue_unavailable
Definition LibITS.h:313
@ SpeedValue_oneCentimeterPerSec
Definition LibITS.h:312
@ SpeedConfidence_equalOrWithInOneCentimerterPerSec
Definition LibITS.h:324
@ CurvatureConfidence_unavailable
Definition LibITS.h:463
static FBoundingBox GetActorBoundingBox(const AActor *Actor, uint8 InTagQueried=0xFF)
计算给定 Carla actor 的边界框。
static ALargeMapManager * GetLargeMapManager(const UObject *WorldContextObject)
static UCarlaEpisode * GetCurrentEpisode(const UObject *WorldContextObject)
float GetNormalDistribution(float Mean, float StandardDeviation)
double altitude
经度,初始化为0.0。
Definition GeoLocation.h:27
GeoLocation Transform(const Location &location) const
使用此对象作为地理参考,将给定的 location 转换为 GeoLocation。
double latitude
定义 GeoLocation 类,它是一个公开的成员。
Definition GeoLocation.h:23
double longitude
纬度,初始化为0.0。
Definition GeoLocation.h:25
static constexpr T ToDegrees(T rad)
Definition Math.h:40
ITSContainer::ReferencePosition_t referencePosition
Definition LibITS.h:796
ITSContainer::StationType_t stationType
Definition LibITS.h:795
ITSContainer::VehicleLength_t vehicleLength
Definition LibITS.h:815
ITSContainer::LateralAcceleration_t lateralAcceleration
Definition LibITS.h:832
ITSContainer::VehicleWidth_t vehicleWidth
Definition LibITS.h:816
OptionalStructAvailable_t lateralAccelerationAvailable
Definition LibITS.h:831
ITSContainer::CurvatureCalculationMode_t curvatureCalculationMode
Definition LibITS.h:819
OptionalStructAvailable_t verticalAccelerationAvailable
Definition LibITS.h:834
OptionalStructAvailable_t performanceClassAvailable
Definition LibITS.h:837
OptionalStructAvailable_t lanePositionAvailable
Definition LibITS.h:825
ITSContainer::DriveDirection_t driveDirection
Definition LibITS.h:814
OptionalStructAvailable_t accelerationControlAvailable
Definition LibITS.h:822
OptionalStructAvailable_t steeringWheelAngleAvailable
Definition LibITS.h:828
ITSContainer::VerticalAcceleration_t verticalAcceleration
Definition LibITS.h:835
OptionalStructAvailable_t cenDsrcTollingZoneAvailable
Definition LibITS.h:840
ITSContainer::LongitudinalAcceleration_t longitudinalAcceleration
Definition LibITS.h:817
ITSContainer::ExteriorLights_t exteriorLights
Definition LibITS.h:873
ITSContainer::PathHistory_t pathHistory
Definition LibITS.h:874
ITSContainer::VehicleRole_t vehicleRole
Definition LibITS.h:872
HighFrequencyContainer_t highFrequencyContainer
Definition LibITS.h:890
BasicContainer_t basicContainer
Definition LibITS.h:889
LowFrequencyContainer_t lowFrequencyContainer
Definition LibITS.h:891
GenerationDeltaTime_t generationDeltaTime
Definition LibITS.h:898
CamParameters_t camParameters
Definition LibITS.h:899
RSUContainerHighFrequency_t rsuContainerHighFrequency
Definition LibITS.h:857
BasicVehicleContainerHighFrequency_t basicVehicleContainerHighFrequency
Definition LibITS.h:856
HighFrequencyContainer_PR present
Definition LibITS.h:854
BasicVehicleContainerLowFrequency_t basicVehicleContainerLowFrequency
Definition LibITS.h:882
LowFrequencyContainer_PR present
Definition LibITS.h:880
ITSContainer::ProtectedCommunicationZonesRSU_t protectedCommunicationZonesRSU
Definition LibITS.h:848
Definition LibITS.h:907
CAMContainer::CoopAwareness_t cam
Definition LibITS.h:909
ITSContainer::ItsPduHeader_t header
Definition LibITS.h:908
TMap< FString, FActorAttribute > Variations
用户选择了参与者的变化版本。请注意,此时是 由不可修改的属性表示
FActorDescription Description
Definition ActorInfo.h:31
AltitudeValue_t altitudeValue
Definition LibITS.h:183
AltitudeConfidence_t altitudeConfidence
Definition LibITS.h:185
CurvatureValue_t curvatureValue
Definition LibITS.h:472
CurvatureConfidence_t curvatureConfidence
Definition LibITS.h:473
HeadingValue_t headingValue
Definition LibITS.h:301
HeadingConfidence_t headingConfidence
Definition LibITS.h:303
LateralAccelerationValue_t lateralAccelerationValue
Definition LibITS.h:589
AccelerationConfidence_t lateralAccelerationConfidence
Definition LibITS.h:590
LongitudinalAccelerationValue_t longitudinalAccelerationValue
Definition LibITS.h:436
AccelerationConfidence_t longitudinalAccelerationConfidence
Definition LibITS.h:437
SemiAxisLength_t semiMinorConfidence
Definition LibITS.h:121
HeadingValue_t semiMajorOrientation
Definition LibITS.h:124
SemiAxisLength_t semiMajorConfidence
Definition LibITS.h:118
OptionalValueAvailable_t protectedZoneRadiusAvailable
Definition LibITS.h:671
OptionalValueAvailable_t protectedZoneIDAvailable
Definition LibITS.h:673
ProtectedZoneType_t protectedZoneType
Definition LibITS.h:665
OptionalValueAvailable_t expiryTimeAvailable
Definition LibITS.h:667
std::vector< ProtectedCommunicationZone_t > list
Definition LibITS.h:679
PosConfidenceEllipse_t positionConfidenceEllipse
Definition LibITS.h:200
VehicleLengthConfidenceIndication_t vehicleLengthConfidenceIndication
Definition LibITS.h:389
VehicleLengthValue_t vehicleLengthValue
Definition LibITS.h:388
VerticalAccelerationValue_t verticalAccelerationValue
Definition LibITS.h:606
AccelerationConfidence_t verticalAccelerationConfidence
Definition LibITS.h:607
YawRateConfidence_t yawRateConfidence
Definition LibITS.h:519
YawRateValue_t yawRateValue
Definition LibITS.h:518
SpeedConfidence_t speedConfidence
Definition LibITS.h:339
SpeedValue_t speedValue
Definition LibITS.h:338