CARLA
InertialMeasurementUnit.h
Go to the documentation of this file.
1 // Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma
2 // de Barcelona (UAB).
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 
9 #include "Carla/Sensor/Sensor.h"
10 
13 
15 #include "carla/geom/Vector3D.h"
17 
18 #include <array>
19 
20 #include "InertialMeasurementUnit.generated.h"
21 
22 UCLASS()
23 class CARLA_API AInertialMeasurementUnit : public ASensor
24 {
25  GENERATED_BODY()
26 
27 public:
28 
29  AInertialMeasurementUnit(const FObjectInitializer &ObjectInitializer);
30 
31  static FActorDefinition GetSensorDefinition();
32 
33  void Set(const FActorDescription &ActorDescription) override;
34 
35  void SetOwner(AActor *Owner) override;
36 
37  virtual void PostPhysTick(UWorld *World, ELevelTick TickType, float DeltaTime) override;
38 
39  const carla::geom::Vector3D ComputeAccelerometerNoise(
40  const FVector &Accelerometer);
41 
42  const carla::geom::Vector3D ComputeGyroscopeNoise(
43  const FVector &Gyroscope);
44 
45  /// Accelerometer: measures linear acceleration in m/s^2
46  carla::geom::Vector3D ComputeAccelerometer(const float DeltaTime);
47 
48  /// Gyroscope: measures angular velocity in rad/sec
49  carla::geom::Vector3D ComputeGyroscope();
50 
51  /// Magnetometer: orientation with respect to the North in rad
52  float ComputeCompass();
53 
54  void SetAccelerationStandardDeviation(const FVector &Vec);
55 
56  void SetGyroscopeStandardDeviation(const FVector &Vec);
57 
58  void SetGyroscopeBias(const FVector &Vec);
59 
60  const FVector &GetAccelerationStandardDeviation() const;
61 
62  const FVector &GetGyroscopeStandardDeviation() const;
63 
64  const FVector &GetGyroscopeBias() const;
65 
66  /// Based on OpenDRIVE's lon and lat, North is in (0.0f, -1.0f, 0.0f)
67  static const FVector CarlaNorthVector;
68 
69 private:
70 
71  void BeginPlay() override;
72 
73  /// Standard deviation for acceleration settings.
74  FVector StdDevAccel;
75 
76  /// Standard deviation for gyroscope settings.
77  FVector StdDevGyro;
78 
79  /// Bias for gyroscope settings.
80  FVector BiasGyro;
81 
82  /// Used to compute the acceleration
83  std::array<FVector, 2> PrevLocation;
84 
85  /// Used to compute the acceleration
87 
88 };
FVector StdDevGyro
Standard deviation for gyroscope settings.
A definition of a Carla Actor with all the variation and attributes.
std::array< FVector, 2 > PrevLocation
Used to compute the acceleration.
FVector BiasGyro
Bias for gyroscope settings.
A description of a Carla Actor with all its variation.
float PrevDeltaTime
Used to compute the acceleration.
static const FVector CarlaNorthVector
Based on OpenDRIVE&#39;s lon and lat, North is in (0.0f, -1.0f, 0.0f)
FVector StdDevAccel
Standard deviation for acceleration settings.